Skip to content

feat: replace SP1 with ecip-gnark Groth16 Ed25519 verification#3

Open
anhductn2001 wants to merge 18 commits intominh/relayerfrom
ducnt/ai
Open

feat: replace SP1 with ecip-gnark Groth16 Ed25519 verification#3
anhductn2001 wants to merge 18 commits intominh/relayerfrom
ducnt/ai

Conversation

@anhductn2001
Copy link
Member

Summary

  • Replace SP1 ZK verification with ecip-gnark Groth16 for Ed25519 signature verification
  • Uncomment and wire Groth16 proof verification in SP1ICS07Tendermint.updateClient()
  • Add IVerifier and IGroth16Verifier interfaces with documentation
  • Regenerate Groth16Verifier.sol from PreHashCircuit (24 public inputs, 149830 constraints)
  • Add MsgUpdateClient fields: proof[8], commitments[2], commitmentPok[2], signature[2], validatorPubkey, voteSignBytes
  • Add prover circuit setup tool (operator/prover/cmd/) and fixture generator (operator/prover/cmd/fixture/)
  • Add ExtractValidatorSignature for extracting Ed25519 sig from LightBlock
  • Complete Predicates.sol voting power checks
  • Add Solidity tests: Groth16Verifier tests with fixtures, Predicates voting power tests
  • Add Go prover unit tests and extractor tests
  • Regenerate Go bindings (UpdateClient, Misbehaviour, SP1ICS07Tendermint)
  • Add run_node.sh for e2e testing (Kurtosis ETH + Gaia)
  • Update E2ETestDeploy.s.sol to deploy ecip-gnark contracts

Test plan

  • Go prover tests: cd operator && go test ./prover/...
  • Solidity Predicates tests: forge test --match-contract PredicatesTest (7/7 pass)
  • Solidity Groth16Verifier tests: forge test --match-contract Groth16VerifierTest (WrapperVerifier SHA-512 overflow needs fix)
  • E2E: bash run_node.sh (requires kurtosis + Docker)

- 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.
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

Successfully merging this pull request may close these issues.

1 participant