feat: integrate circom verifier#1987
Conversation
Changes to gas cost
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
c451ae5 to
60b70fd
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR adds full support for Circom Groth16 BN128 proofs by introducing proof generation scripts, integrating a Go-based Circom verifier, updating the CLI and batcher/operator code, and extending documentation and Makefiles.
- Introduce Circom proof generation and test scripts (JSON fixtures, shell, JS, and C++ files).
- Integrate
go-circom-prover-verifierparser/verifier via FFI in batcher and operator. - Extend CLI, Dockerfiles, and documentation to recognize
CircomGroth16Bn128.
Reviewed Changes
Copilot reviewed 37 out of 62 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/test_files/circom_groth16_bn128_script/generate_proof.sh | Add proof generation steps via snarkjs |
| scripts/test_files/circom_groth16_bn128_script/circuit_cpp/main.cpp | Generated C++ witness calculator for the circuit |
| operator/pkg/operator.go | Add verifyCircomGroth16Bn128Proof for server-side checks |
| crates/cli/src/main.rs | Register new CLI argument CircomGroth16Bn128 |
| crates/batcher/src/circom/verifier.rs | FFI wrapper to call Circom verifier from Rust |
| docs/3_guides/9_aligned_cli.md | Document new CircomGroth16Bn128 option in CLI guide |
Comments suppressed due to low confidence (3)
scripts/test_files/circom_groth16_bn128_script/circuit_cpp/main.cpp:67
- Allocating a zero-length array can be confusing and non-portable; consider using
nullptror an emptystd::vector<uint>instead.
u32 dataiomap[(sb.st_size-inisize)/sizeof(u32)];
operator/pkg/operator.go:620
- Consider adding unit tests for
verifyCircomGroth16Bn128Proofto validate parsing errors and successful verification paths.
func (o *Operator) verifyCircomGroth16Bn128Proof(proofBytes []byte, pubInputBytes []byte, verificationKeyBytes []byte) bool {
scripts/test_files/circom_groth16_bn128_script/circuit_cpp/main.cpp:60
- Avoid using variable-length arrays in C++; prefer
std::vector<u32>or dynamic allocation for portability and standard compliance.
u32 index[get_size_of_io_map()];
scripts/test_files/circom_groth16_bn128_script/generate_proof.sh
Outdated
Show resolved
Hide resolved
|
|
||
| # Params: | ||
| # PROOF_TYPE = sp1|groth16|plonk|risc0 (default sp1) | ||
| # PROOF_TYPE = sp1|groth16|plonk|risc0|circom (default sp1) |
There was a problem hiding this comment.
Proof types should change, since Circom is also groth16, we should rename circom_groth16 and gnark_groth16 and gnark_plonk, we can do the gnark ones in another PR but at least we should rename the circom one
| # PROOF_TYPE = sp1|groth16|plonk|risc0|circom (default sp1) | |
| # PROOF_TYPE = sp1|groth16|plonk|risc0|circom (default sp1) |
MauroToscano
left a comment
There was a problem hiding this comment.
- The CRS for the example shouldn't be needed to be uploaded, randomness can be fixed if it's an example and regenerated quickly
- FFI's should contain Rust FFIs, not code
- ListRef is defined twice, it should be under the code of the Rust FFIs
- Following this, the go code shouldn't be called an FFI, it can be go_verifiers_lib or something like that, it's not very important
- Paramater on the CLI should clarifiy that is circom_groth16_bn254, at least in the description, or at least circom_grotyh16. We should rename in the future the plonk and groth16 ones to clarify they are from gnark
refactor: rename libraries
…ifier # Conflicts: # crates/cli/send_proof_with_random_address.sh # docs/2_architecture/0_supported_verifiers.md # docs/3_guides/0_submitting_proofs.md
Integrate Circom Verifier
Description
Description of the pull request changes and motivation.
Tasks
How to Test
Note: You need to rebuild ffis
Note: Examples in docs won't work in Holesky until the deploy is done.
Type of change
Checklist
testnet, everything else tostaging