fullprocess: define path at beginning

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
Csaba Kiraly 2022-11-28 10:49:21 +01:00
parent 92200bd506
commit 43ba6e6bf3
No known key found for this signature in database
GPG Key ID: 0FE274EE8C95166E
1 changed files with 8 additions and 4 deletions

View File

@ -19,6 +19,9 @@ const sizeOf = value => typeSizes[typeof value](value);
describe("Full process", function () { describe("Full process", function () {
this.timeout(1000000000); this.timeout(1000000000);
const r1csPath = path.join("test", "circuit", "circuit.r1cs");
const wasmPath = path.join("test", "circuit", "circuit.wasm");
let curve; let curve;
const ptau_0 = {type: "mem"}; const ptau_0 = {type: "mem"};
const ptau_1 = {type: "mem"}; const ptau_1 = {type: "mem"};
@ -84,7 +87,8 @@ describe("Full process", function () {
}); });
it ("groth16 setup", async () => { it ("groth16 setup", async () => {
await snarkjs.zKey.newZKey(path.join("test", "circuit", "circuit.r1cs"), ptau_final, zkey_0); await snarkjs.zKey.newZKey(r1csPath, ptau_final, zkey_0);
console.warn(zkey_0);
}); });
it ("zkey contribute ", async () => { it ("zkey contribute ", async () => {
@ -108,7 +112,7 @@ describe("Full process", function () {
}); });
it ("zkey verify r1cs", async () => { it ("zkey verify r1cs", async () => {
const res = await snarkjs.zKey.verifyFromR1cs(path.join("test", "circuit", "circuit.r1cs"), ptau_final, zkey_final); const res = await snarkjs.zKey.verifyFromR1cs(r1csPath, ptau_final, zkey_final);
assert(res); assert(res);
}); });
@ -122,7 +126,7 @@ describe("Full process", function () {
}); });
it ("witness calculate", async () => { it ("witness calculate", async () => {
await snarkjs.wtns.calculate({a: 11, b:2}, path.join("test", "circuit", "circuit.wasm"), wtns); await snarkjs.wtns.calculate({a: 11, b:2}, wasmPath, wtns);
//console.warn("witness: ", wtns); //console.warn("witness: ", wtns);
console.warn("witness: ", wtns.data.length, " bytes"); console.warn("witness: ", wtns.data.length, " bytes");
console.warn("witness: ", sizeOf(wtns.data), " bytes"); console.warn("witness: ", sizeOf(wtns.data), " bytes");
@ -143,7 +147,7 @@ describe("Full process", function () {
}); });
it ("plonk setup", async () => { it ("plonk setup", async () => {
await snarkjs.plonk.setup(path.join("test", "circuit", "circuit.r1cs"), ptau_final, zkey_plonk); await snarkjs.plonk.setup(r1csPath, ptau_final, zkey_plonk);
}); });
it ("zkey export verificationkey", async () => { it ("zkey export verificationkey", async () => {