You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.3 KiB

  1. const chai = require("chai");
  2. const path = require("path");
  3. const bigInt = require("big-integer");
  4. const tester = require("circom").tester;
  5. function print(circuit, w, s) {
  6. console.log(s + ": " + w[circuit.getSignalIdx(s)]);
  7. }
  8. describe("Escalarmul test", function () {
  9. let circuitEMulAny;
  10. this.timeout(100000);
  11. let g = [
  12. bigInt("5299619240641551281634865583518297030282874472190772894086521144482721001553"),
  13. bigInt("16950150798460657717958625567821834550301663161624707787222815936182638968203")
  14. ];
  15. before( async() => {
  16. circuitEMulAny = await tester(path.join(__dirname, "circuits", "escalarmulany_test.circom"));
  17. });
  18. it("Should generate Same escalar mul", async () => {
  19. const w = await circuitEMulAny.calculateWitness({"e": 1, "p": g});
  20. await circuitEMulAny.checkConstraints(w);
  21. await circuitEMulAny.assertOut(w, {out: g});
  22. });
  23. it("If multiply by order should return 0", async () => {
  24. const r = bigInt("2736030358979909402780800718157159386076813972158567259200215660948447373041");
  25. const w = await circuitEMulAny.calculateWitness({"e": r, "p": g});
  26. await circuitEMulAny.checkConstraints(w);
  27. await circuitEMulAny.assertOut(w, {out: [0,1]});
  28. });
  29. });