|
|
@ -38,6 +38,8 @@ describe("Exponentioation test", () => { |
|
|
|
|
|
|
|
const w = circuit.calculateWitness({in: 1}); |
|
|
|
|
|
|
|
assert(circuit.checkWitness(w)); |
|
|
|
|
|
|
|
let g = [bigInt("5299619240641551281634865583518297030282874472190772894086521144482721001553"), |
|
|
|
bigInt("16950150798460657717958625567821834550301663161624707787222815936182638968203")] |
|
|
|
|
|
|
@ -46,12 +48,12 @@ describe("Exponentioation test", () => { |
|
|
|
for (let i=0; i<16; i++) { |
|
|
|
const xout1 = w[circuit.getSignalIdx(`main.out[${i}][0]`)]; |
|
|
|
const yout1 = w[circuit.getSignalIdx(`main.out[${i}][1]`)]; |
|
|
|
/* |
|
|
|
console.log(xout1.toString()); |
|
|
|
console.log(yout1.toString()); |
|
|
|
console.log(dbl[0]); |
|
|
|
console.log(dbl[1]); |
|
|
|
*/ |
|
|
|
|
|
|
|
// console.log(xout1.toString());
|
|
|
|
// console.log(yout1.toString());
|
|
|
|
// console.log(dbl[0]);
|
|
|
|
// console.log(dbl[1]);
|
|
|
|
|
|
|
|
assert(xout1.equals(dbl[0])); |
|
|
|
assert(yout1.equals(dbl[1])); |
|
|
|
|
|
|
@ -74,6 +76,8 @@ describe("Exponentioation test", () => { |
|
|
|
|
|
|
|
const w = circuit.calculateWitness({in: 1}); |
|
|
|
|
|
|
|
assert(circuit.checkWitness(w)); |
|
|
|
|
|
|
|
let g = [snarkjs.bigInt("5299619240641551281634865583518297030282874472190772894086521144482721001553"), |
|
|
|
snarkjs.bigInt("16950150798460657717958625567821834550301663161624707787222815936182638968203")] |
|
|
|
|
|
|
@ -87,12 +91,12 @@ describe("Exponentioation test", () => { |
|
|
|
const xout1 = w[circuit.getSignalIdx(`main.out[${i}][0]`)]; |
|
|
|
const yout1 = w[circuit.getSignalIdx(`main.out[${i}][1]`)]; |
|
|
|
|
|
|
|
/* |
|
|
|
console.log(xout1.toString()); |
|
|
|
console.log(yout1.toString()); |
|
|
|
console.log(dbl[0]); |
|
|
|
console.log(dbl[1]); |
|
|
|
*/ |
|
|
|
|
|
|
|
// console.log(xout1.toString());
|
|
|
|
// console.log(yout1.toString());
|
|
|
|
// console.log(dbl[0]);
|
|
|
|
// console.log(dbl[1]);
|
|
|
|
|
|
|
|
assert(xout1.equals(dbl[0])); |
|
|
|
assert(yout1.equals(dbl[1])); |
|
|
|
|
|
|
@ -102,7 +106,7 @@ describe("Exponentioation test", () => { |
|
|
|
}); |
|
|
|
|
|
|
|
it("Should exponentiate g^31", async () => { |
|
|
|
const cirDef = await compiler(path.join(__dirname, "circuits", "escalarmul_test.circom")); |
|
|
|
const cirDef = await compiler(path.join(__dirname, "circuits", "escalarmul_test.circom"), {reduceConstraints: true}); |
|
|
|
|
|
|
|
// console.log(JSON.stringify(cirDef, null, 1));
|
|
|
|
|
|
|
@ -146,12 +150,12 @@ describe("Exponentioation test", () => { |
|
|
|
c = addPoint(c,c); |
|
|
|
} |
|
|
|
c = addPoint(c,g); |
|
|
|
/* |
|
|
|
console.log(xout2.toString()); |
|
|
|
console.log(yout2.toString()); |
|
|
|
console.log(c[0].toString()); |
|
|
|
console.log(c[1].toString()); |
|
|
|
*/ |
|
|
|
|
|
|
|
// console.log(xout2.toString());
|
|
|
|
// console.log(yout2.toString());
|
|
|
|
// console.log(c[0].toString());
|
|
|
|
// console.log(c[1].toString());
|
|
|
|
|
|
|
|
assert(xout2.equals(c[0])); |
|
|
|
assert(yout2.equals(c[1])); |
|
|
|
|
|
|
|