Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error calculating witness for Groth16 in v2.2.0 #308

Open
geovgy opened this issue Oct 15, 2024 · 2 comments
Open

Error calculating witness for Groth16 in v2.2.0 #308

geovgy opened this issue Oct 15, 2024 · 2 comments

Comments

@geovgy
Copy link

geovgy commented Oct 15, 2024

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.

@numtel
Copy link

numtel commented Oct 15, 2024

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"
  },

@geovgy
Copy link
Author

geovgy commented Oct 16, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants