-
Notifications
You must be signed in to change notification settings - Fork 250
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
Unreachable Error when calling std::verify_proof() multiple times in recursion circuit #4409
Comments
Thanks for submitting the Issue! The Meanwhile, would you be able to copy the full |
The error call stack is not very useful for my case. It is the stack: |
Thank you. Is that the full stack trace though? As in do you have the option to expand it further. Separately, is it right to assume the same circuit works on Nargo, just not on NoirJS? |
Hi, the recursion circuit is executed successfully with nargo. Only NoirJS raises errors. |
Were you able to verify in Nargo? I am experiencing this same issue for the same reason, but my circuit also fails to verify in Nargo - though it will prove with Nargo and creates the intermediate proof in NoirJS. |
Yes, I have the same issue. Proving with nargo is ok but verification is also fail. The error is: Failed to verify proof |
FWIW Steps ran:
@n4ru / @tuhoag could you upload the Prover.toml file for reproduction? It'd be easier for our engineers if we could first confirm if there is / what is the problem in Nargo first, then move on to NoirJS. |
After spending the majority of my day debugging this, I'm no longer convinced Nargo has any issues, but I cannot even get one However, the noir-examples recursion repo DOES work with a single I'm at a loss here and have nearly lost track of my test cases. I've tried just about every combination of Could it be related to circuit size? I vaguely recall someone else mentioning a similar issue with bigger circuits in NoirJS, even though they were below the maximum wasm constraint size, but it wouldn't explain why one verify would fail in one case and succeed in the other, since the inner circuit size shouldn't be relevant when verifying a single inner proof (?). 😮💨 |
Hey we're on it, hold on my friend! |
Hi, I updated the Prover.toml. I tested it again today and the verification is correct. Maybe I made some mistakes yesterday. However, noirjs cannot be run. I think the main problem is due to the limitation of WASM. When the memory is more than 4GB, it would crash. I think it is better if Noir has another API in rust/go to tackle this issue. In my project, I have to develop a wrapper to interact with Nargo instead of using NoirJS. |
I've made repo with the same issue: |
I'm also blocked by this. Occurs on 0.25.0, 0.26.0 and For the following circuit with EITHER call to use dep::std::verify_proof as aggregate_proof;
fn main(
public_left: [Field; 22],
public_right: [Field; 22],
proof_left: [Field; 93],
proof_right: [Field; 93],
vk: [Field; 114],
vk_hash: Field,
) {
// Aggregate left proof.
aggregate_proof(
vk.as_slice(),
proof_left.as_slice(),
public_left.as_slice(),
vk_hash,
);
// Aggregate right proof.
aggregate_proof(
vk.as_slice(),
proof_right.as_slice(),
public_right.as_slice(),
vk_hash,
);
} Error trace: 53 | this.logger(str2)
54 | if (str2.startsWith('WARNING:')) {
55 | this.logger(new Error().stack)
56 | }
57 | },
58 | get_data: (keyAddr, outBufAddr) => {
^
RuntimeError: Unreachable code should not be executed (evaluating 'this.exports()[name](...args)')
at <?>.wasm-function[18106] (native:1:1)
at <?>.wasm-function[197] (native:1:1)
at <?>.wasm-function[192] (native:1:1)
at <?>.wasm-function[155] (native:1:1)
at 155 (native:1:1)
at call (/Users/tsujp/programming/~aztec/tikan/node_modules/@aztec/bb.js/dest/node/barretenberg_wasm/barretenberg_wasm_base/index.js:58:34)
at callWasmExport (/Users/tsujp/programming/~aztec/tikan/node_modules/@aztec/bb.js/dest/node/barretenberg_wasm/barretenberg_wasm_main/index.js:85:14)
at callback (/Users/tsujp/programming/~aztec/tikan/node_modules/comlink/dist/umd/comlink.js:109:52)
at l (/Users/tsujp/programming/~aztec/tikan/node_modules/@aztec/bb.js/dest/node/barretenberg_wasm/helpers/node/node_endpoint.js:11:21) |
Ah, @Savio-Sou you mentioned here a ~500k circuit size. The circuit I posted above is 526338 gates which is indeed over 2^19. |
If your circuit is >2^19, currently your only option is to use a combination of nargo and barretenberg directly to generate a proof. However, you can use said proofs via a single |
Yes @tsujp it seems like the number of public inputs in your example exceeded what the WASM memory limit could hold. The basically identical double_verify_proof test case with one public input is sized at 519,537 gates, marginally below 2^19 (i.e. 524,288). |
Intermediary update on Noir v0.31.0 and bb v0.41.0: On further debugging, we've found that with the proving backend barretenberg:
At some point changes resulted in the test case to creep beyond the 2^19 limit, causing verification of two recursive proofs in one (that is by extension compressing proofs in the binary tree manner >2 levels) to not currently work in JS. This is hence a barretenberg issue (not of a problem inherent to Noir) and is logged accordingly as AztecProtocol/aztec-packages#6672. A way to circumvent the WASM memory limit would be to gather the recursive proof artifacts and engage in the entire workflow in CLI; kudos to @akonior for creating a script to make things easier here: #4336 (comment) In the meantime, the barretenberg team is coming up possible solutions for the problem; will circle back when there is further update 🙏 |
Informational update: The barretenberg team has been working on getting the UltraHonk version of barretenberg to work with Noir: https://github.com/AztecProtocol/barretenberg/milestone/9, which might resolve the Issue here in one go. To confirm once the integration completes. |
Early access steps of how to prove and verify Noir programs with UltraHonk are available here: https://github.com/AztecProtocol/aztec-packages/blob/86afa81d744bcf0c3ffd732663a24234b26e8aa8/barretenberg/cpp/src/barretenberg/bb/readme.md#usage-with-ultrahonk#usage-with-ultrahonk If you come across bugs and bumps, the team is welcoming feedback there! |
Aim
I am trying to write a rollup circuit that can verify proofs from many sub circuits. Then, the rollup circuit needs to call std::verify_proof() multiple times to verify proofs from sub circuits. However, I got the Unreachble Runtime Error when generating the proof of the rollup circuit.
Moreover, I tried to generate the solidity verifier of the rollup circuit and deploy it using Remix (Default network). However, I got the error PUBLIC_INPUT_COUNT_INVALID.
I executed the repositories in macOS Sonoma 14.3.1 with Apple M3 Pro (12 cores).
Expected Behavior
The rollup circuit must be able to generate the rollup proof.
Bug
Generating proof from the rollup circuit in NoirJS raises the RuntimeError: unreachable.
To Reproduce
To reproduce the error, you can use the following two repositories:
ts-node src/index.ts
npx hardhat run scripts/test_recursive_proofs.ts
Project Impact
Blocker
Impact Context
This feature is required in my project since the rollup circuit must verify more than one proof to reduce the verification cost.
Workaround
None
Workaround Description
No response
Additional Context
No response
Installation Method
Binary (
noirup
default)Nargo Version
nargo version = 0.23.0
noirc version = 0.23.0+5be9f9d7e2f39ca228df10e5a530474af0331704
(git version hash: 5be9f9d, is dirty: false)
NoirJS Version
0.23.0
Would you like to submit a PR for this Issue?
Maybe
Support Needs
No response
The text was updated successfully, but these errors were encountered: