feat: replace SP1 with ecip-gnark Groth16 Ed25519 verification#3
Open
anhductn2001 wants to merge 18 commits intominh/relayerfrom
Open
feat: replace SP1 with ecip-gnark Groth16 Ed25519 verification#3anhductn2001 wants to merge 18 commits intominh/relayerfrom
anhductn2001 wants to merge 18 commits intominh/relayerfrom
Conversation
- Add PreHashCircuit (24 public inputs) with pre-computed SHA512 hash - Add prover package: proof generation, signature extraction from LightBlock - Wire Groth16 verification in SP1ICS07Tendermint.updateClient() - Update WrapperVerifier: SHA512 on-chain, 24 public inputs (64-bit LE limbs) - Update MsgUpdateClient with signature, validatorPubkey, voteSignBytes fields - Complete bidirectional relayer: Cosmos->Eth and Eth->Cosmos packet relay - Add Eth->Cosmos relay via eth_getProof storage proofs - Complete Predicates.sol voting power checks - Fix membershipMsg ABI encoding (no function selector) - Fix transaction handler for UpdateClient and RecvPacket - Add unit tests for prover and extractor (12 tests pass)
Uncomment membership/non-membership verification in ackPacket and timeoutPacket to match minh/relayer. Update MsgAckPacket and MsgTimeoutPacket structs to use membershipMsg/nonMembershipMsg (abi-encoded) instead of separate proof fields.
- Change message param from bytes to bytes32 in IVerifier - Replace WrapperVerifier.sol with minh/relayer version - Change voteSignBytes to bytes32 in MsgUpdateClient and binding - Hash voteSignBytes with keccak256 before sending to contract
Align with minh/relayer: VERIFIER is WrapperVerifier (IVerifier), not the raw Groth16Verifier. Remove unused Groth16Verifier import.
…LAUDE.md - Add prover/cmd setup tool to compile circuit, run Groth16 setup, and export Groth16Verifier.sol + artifacts (r1cs, pk, vk) - Regenerate Groth16Verifier.sol with 24 public inputs from ecip-gnark - Update CLAUDE.md with operator/prover docs and Groth16 verification flow
7 tests covering: - Sufficient voting power (single validator) - Insufficient voting power (reverts) - Exactly above 2/3 threshold - Nil votes handling - No present signatures (reverts) - Signature count mismatch (reverts) - Faulty signer (reverts)
- Add fixture generator (operator/prover/cmd/fixture/) that generates Groth16 proof + Ed25519 signature data as JSON for Solidity tests - Add Groth16Verifier.t.sol testing WrapperVerifier.verifyProof with valid proof, tampered proof, wrong pubkey, and wrong message
Match minh/relayer contract name and interface implementation.
Update MsgAckPacket (membershipMsg), MsgTimeoutPacket (nonMembershipMsg), remove IICS02ClientMsgsHeight, fix method IDs, comments, ABI and Bin.
Rebuild all Solidity contracts and regenerate abigen bindings so ABI and Bin bytecode are in sync. Restore test files from minh/relayer.
- Update E2ETestDeploy.s.sol to deploy ecip-gnark contracts - Update operator/test/test.go with bidirectional config loading - Add run_node.sh for e2e testing setup
Take minh/relayer for operator files (prover, services, test, transaction). Keep ducnt/ai SP1ICS07Tendermint.sol with uncommented Groth16 verification.
- Fix go.mod replace directives to local paths (ecip-gnark, decentrio-gnark) - Upgrade bytedance/sonic to v1.15.0 for Go 1.25 compatibility - Remove duplicate EncodeClientState/EncodeConsensusState in tendermint.go - Remove duplicate type declarations in prover.go (already in circuit.go) - Update prover_test.go: Prover → EcipProver, ProveSignature → GenerateProof - Update CLAUDE.md with correct Go version and replace paths
- Import PreHashCircuit, Fp25519, Fr25519 from operator/prover package - Fix Worker struct literal to use NewWorker constructor in test.go
Cover pure functions across utils, keys, client, subscriber, and services. All 39 tests pass with race detector enabled.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SP1ICS07Tendermint.updateClient()IVerifierandIGroth16Verifierinterfaces with documentationGroth16Verifier.solfrom PreHashCircuit (24 public inputs, 149830 constraints)MsgUpdateClientfields:proof[8],commitments[2],commitmentPok[2],signature[2],validatorPubkey,voteSignBytesoperator/prover/cmd/) and fixture generator (operator/prover/cmd/fixture/)ExtractValidatorSignaturefor extracting Ed25519 sig from LightBlockPredicates.solvoting power checksUpdateClient,Misbehaviour,SP1ICS07Tendermint)run_node.shfor e2e testing (Kurtosis ETH + Gaia)E2ETestDeploy.s.solto deploy ecip-gnark contractsTest plan
cd operator && go test ./prover/...forge test --match-contract PredicatesTest(7/7 pass)forge test --match-contract Groth16VerifierTest(WrapperVerifier SHA-512 overflow needs fix)bash run_node.sh(requires kurtosis + Docker)