From 4bb73bc9271944f0761c70451bf9b67f6eef4a10 Mon Sep 17 00:00:00 2001 From: schaeff Date: Mon, 29 Aug 2022 23:52:36 +0200 Subject: [PATCH] merge dev --- zokrates_js/tests/tests.js | 39 +++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/zokrates_js/tests/tests.js b/zokrates_js/tests/tests.js index aa211d72..86ed3bcd 100644 --- a/zokrates_js/tests/tests.js +++ b/zokrates_js/tests/tests.js @@ -25,8 +25,8 @@ describe("tests", () => { after(() => { if (globalThis.curve_bn128) { - return globalThis.curve_bn128.terminate() - }; + return globalThis.curve_bn128.terminate(); + } }); describe("metadata", () => { @@ -167,8 +167,7 @@ describe("tests", () => { it("compile", () => { assert.doesNotThrow(() => { - const code = - `def main(private field a, field b) -> bool { + const code = `def main(private field a, field b) -> bool { bool check = if (a == 0){ true} else {a * a == b}; assert(check); return true; @@ -179,9 +178,13 @@ describe("tests", () => { it("compute witness", () => { assert.doesNotThrow(() => { - computationResult = provider.computeWitness(artifacts, ["337", "113569"], { - snarkjs: true, - }); + computationResult = provider.computeWitness( + artifacts, + ["337", "113569"], + { + snarkjs: true, + } + ); }); }); @@ -205,8 +208,11 @@ describe("tests", () => { return fs.promises .writeFile(r1csPath, artifacts.snarkjs.program) .then(() => { - return snarkjs.zKey - .newZKey(r1csPath, "./tests/powersOfTau5_0000.ptau", zkeyPath) + return snarkjs.zKey.newZKey( + r1csPath, + "./tests/powersOfTau5_0000.ptau", + zkeyPath + ); }); }); } @@ -242,13 +248,16 @@ describe("tests", () => { .writeFile(witnessPath, computationResult.snarkjs.witness) .then(() => { return snarkjs.groth16.prove(zkeyPath, witnessPath); - }).then(r => { + }) + .then((r) => { return snarkjs.zKey.exportVerificationKey(zkeyPath).then((vk) => { - return snarkjs.groth16.verify(vk, r.publicSignals, r.proof).then((res) => { - assert.deepEqual(res, true); - return - }); - }) + return snarkjs.groth16 + .verify(vk, r.publicSignals, r.proof) + .then((res) => { + assert.deepEqual(res, true); + return; + }); + }); }); }); }