circomlib/test/escalarmulany.js
test/escalarmulany.jsRaw
1const chai = require("chai");
2const path = require("path");
3const bigInt = require("big-integer");
4const tester = require("circom").tester;
5
6function print(circuit, w, s) {
7 console.log(s + ": " + w[circuit.getSignalIdx(s)]);
8}
9
10describe("Escalarmul test", function () {
11 let circuitEMulAny;
12
13 this.timeout(100000);
14
15 let g = [
16 bigInt("5299619240641551281634865583518297030282874472190772894086521144482721001553"),
17 bigInt("16950150798460657717958625567821834550301663161624707787222815936182638968203")
18 ];
19
20 before( async() => {
21 circuitEMulAny = await tester(path.join(__dirname, "circuits", "escalarmulany_test.circom"));
22 });
23
24 it("Should generate Same escalar mul", async () => {
25
26 const w = await circuitEMulAny.calculateWitness({"e": 1, "p": g});
27
28 // TODO
29 // assert(circuitEMulAny.checkWitness(w));
30
31 await circuitEMulAny.assertOut(w, {out: g});
32
33 });
34
35 it("If multiply by order should return 0", async () => {
36
37 const r = bigInt("2736030358979909402780800718157159386076813972158567259200215660948447373041");
38 const w = await circuitEMulAny.calculateWitness({"e": r, "p": g});
39
40 // TODO
41 // assert(circuitEMulAny.checkWitness(w));
42
43 await circuitEMulAny.assertOut(w, {out: [0,1]});
44
45 });
46
47});
48