Error calculating witness for Groth16 in v2.2.0
Closed this issue · 3 comments
There is an issue in the circom runtime that is causing the witness builder to fail. I attempted it with both WASM and C++ compiled circuits, neither having any luck. Regardless if I'm using circom_tester
, snarkjs.groth16.fullProve
or snarkjs.groth16.prove
(attempted with both snarkjs
versions 0.7.4 and 0.7.1), the error location remains the same.
Here is the error log when testing it:
LinkError: WebAssembly.instantiate(): Import #4 module="runtime" function="printDebug": function import requires a callable
at Object.builder [as WitnessCalculatorBuilder] (node_modules/circom_runtime/build/main.cjs:112:40)
at wtnsCalculate (node_modules/snarkjs/build/main.cjs:1257:16)
at Object.groth16FullProve [as fullProve] (node_modules/snarkjs/build/main.cjs:1301:5)
at prove (utils/prover.ts:207:36)
Note, this only occurs on v2.2.0. When I changed the compiler and installed v2.1.9, I no longer received this issue.
I'm guessing there's going to be a new snarkjs version soon once this pr is merged. It fixes this bug.
To use this version right now, put this in your package.json
file:
"overrides": {
"circom_runtime": "iden3/circom_runtime#fix/addMissingPrintDebug"
},
Thanks @numtel. Oddly, I was also having issue with trying the override in my project. So I went a step further by forking snarkjs
and adding the fix in this branch. Installing this branch in my project did the trick. Sharing this in case others also find it useful while waiting for that PR to merge and snarkjs
to update with the change.
Here's the install command for it:
npm install snarkjs@github:geovgy/snarkjs#circom-v2.2.0-temp-patch
Closing as this is fixed in snarkjs