Split witness calculation step for circom 2

This commit is contained in:
Nalin Bhardwaj 2022-01-13 15:53:16 -08:00
parent 4583d3c3b0
commit e2bcb9f96a
2 changed files with 388 additions and 352 deletions

File diff suppressed because it is too large Load Diff

@ -29,11 +29,19 @@ export default async function wtnsCalculate(input, wasmFileName, wtnsFileName, o
await fdWasm.close();
const wc = await WitnessCalculatorBuilder(wasm);
const w = await wc.calculateBinWitness(input);
if (wc.circom_version() == 1) {
const w = await wc.calculateBinWitness(input);
const fdWtns = await binFileUtils.createBinFile(wtnsFileName, "wtns", 2, 2);
const fdWtns = await binFileUtils.createBinFile(wtnsFileName, "wtns", 2, 2);
await wtnsUtils.writeBin(fdWtns, w, wc.prime);
await fdWtns.close();
await wtnsUtils.writeBin(fdWtns, w, wc.prime);
await fdWtns.close();
} else {
const fdWtns = await fastFile.createOverride(wtnsFileName);
const w = await wc.calculateWTNSBin(input);
await fdWtns.write(w);
await fdWtns.close();
}
}