Skip to content

Replace onchain Nitro cert verification with Automata ZK verifier#197

Merged
leopoldjoy merged 26 commits intojoby.thundil/CHAIN-3293-migrate-multiproof-contracts-to-basecontractsfrom
feat/switch-nitro-certificate-verification-to-zk
Mar 5, 2026
Merged

Replace onchain Nitro cert verification with Automata ZK verifier#197
leopoldjoy merged 26 commits intojoby.thundil/CHAIN-3293-migrate-multiproof-contracts-to-basecontractsfrom
feat/switch-nitro-certificate-verification-to-zk

Conversation

@leopoldjoy
Copy link
Contributor

@leopoldjoy leopoldjoy commented Mar 2, 2026

This PR:

  • Replaces NitroValidator/CertManager with external NitroEnclaveVerifier (Risc0 ZK path) in SystemConfigGlobal.
  • Adds ISemver to SystemConfigGlobal, TEEVerifier, and AggregateVerifier.
  • Wires SystemConfigGlobal into standard Deploy.s.sol pipeline and Initializable.t.sol.
  • Integrates multiproof config into standard DeployConfig.s.sol and migrates dev deploy scripts to use it, removing separate sepolia-no-nitro.json / sepolia-with-nitro.json config files.
  • Fixes TEEVerifier proof format to match AggregateVerifier's l1head change (85 bytes instead of 149).
  • Adds pubKey length check in SystemConfigGlobal.registerSigner for defense-in-depth.

@jjtny1 jjtny1 force-pushed the joby.thundil/CHAIN-3293-migrate-multiproof-contracts-to-basecontracts branch from 9efb20a to ee8c3b9 Compare March 2, 2026 16:37
…d ISemver to multiproof contracts, wire SystemConfigGlobal into standard deploy pipeline
…er proof format to match AggregateVerifier's l1head change
…fig, add multiproof fields to sepolia.json and hardhat.json, remove separate nitro config files
@leopoldjoy leopoldjoy requested a review from jackchuma March 3, 2026 22:51
Copy link
Contributor

@jjtny1 jjtny1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from Jack's comments, lgtm

…eploy config, and parameterize hardcoded l2ChainID/block intervals in DeployImplementations
@leopoldjoy leopoldjoy requested a review from jackchuma March 4, 2026 03:09
@leopoldjoy leopoldjoy merged commit 3e6f2e7 into joby.thundil/CHAIN-3293-migrate-multiproof-contracts-to-basecontracts Mar 5, 2026
2 of 3 checks passed
@leopoldjoy leopoldjoy deleted the feat/switch-nitro-certificate-verification-to-zk branch March 5, 2026 02:42
jjtny1 added a commit that referenced this pull request Mar 6, 2026
* initial commit

* Refactor tests and simplify verifier

* Refactor proof verification methods to consolidate TEE and ZK proof handling into a single function, improving code clarity and maintainability. Update tests accordingly to reflect the new verification structure.

* refactor tests and errors

* Prevent proofs from extending resolution time

* ZK proof allows game creator to immediately reclaim bond

* Additional tests

* Refactor test cases to standardize warp duration and improve naming conventions for clarity in Nullify tests.

* Add validation to ensure parent game has a proof before creating a child game in AggregateVerifier. Implement corresponding test case to verify this behavior.

* Use calldata and remove unused variable

* Make internal verify functions consistent

* fix: can claim bond after nullifying a challenge

* prevent challenges if parent or game itself is invalid

* Enhance AggregateVerifier to include hashes for TEE and ZK images, and rollup configuration. Update verification methods to use a journal hash instead of root claims. Modify MockVerifier and tests accordingly.

* Add ReentrancyGuard to AggregateVerifier and protect claimCredit function

* Add constant for initialize calldata size in AggregateVerifier and update validation check to use this constant

* Add test to validate failure on invalid calldata size in AggregateVerifier

* Refactor l2BlockNumber function to l2SequenceNumber in AggregateVerifier, updating documentation and logic to clarify its purpose as the L2 sequence number.

* Refactor visibility of state variables in AggregateVerifier from internal to public, enhancing accessibility for contract interactions.

* Moved wasRespectedGameTypeWhenCreated for storage optimization

* Remove underscores from constructor variables

* IDIsputeGame compliance

* Remove implicit returns

* Add CreditClaimed event and update claimCredit logic in AggregateVerifier to emit event upon credit transfer

* Rename getParentGameStatus to _getParentGameStatus in AggregateVerifier for consistency with internal function naming conventions.

* Refactor return logic in getParentGameStatus to improve clarity by consolidating the return statement for the first dispute game scenario.

* solidity style guide

* forge fmt

* Fix tests

* remove unused imports

* Named imports, reorganized imports, defined errors directly

* linter

* Add underscores to deal with compiler warnings

* Refactor and have consistent comments

* Update verifier interface to include image ID

* Added feature where a proof is required for initialization

* Added feature where a proof is required for initialization

* Add back in IDisputeGame inheritance

* forge fmt

* refactor proof format

* game type validation on challenging game

* Add delayedWETH

* forge fmt

* Check challenging game validity when claiming credit

* Add TEEVerifier and SystemConfigGlobal contracts and update AggregateVerifier to include l1OriginNumber in journal

* fix(TEEVerifier): use correct EIP-2935 address and raw calldata for blockhash lookups

* Refactor TEE contracts and deployment script based on PR review feedback

* Refactor TEE contracts and deployment script based on PR review feedback

* Remove underscore-prefixed parameters from mock contracts per style guide

* Add comprehensive tests for TEEVerifier, SystemConfigGlobal, and DevSystemConfigGlobal; fix proof format in existing tests

* Update teeProposer to match proposer address

* correct teeImageHash in Sepolia deploy config

* Moving TEE proposer to TEEVerifier

* fix TEE comment

* feat: intermediate roots for nullification

* move L1 origin hash check from TEEVerifier to AggregateVerifier

* fix tests

* forge fmt

* feat: split deploy configs and scripts into no-nitro and with-nitro variants

* refactor _verifyProof

* added block interval tests and cleaned up some errors

* forge fmt

* verify proof earlier during initialize

* revert last commit

* refactor initialize

* refactor

* fix: register TEE proposer during deployment and add intermediateBlockInterval to WithNitro script

* use l1head for proofs after initialization

* forge fmt

* Fix comments from PR feedback

Co-authored-by: Leopold Joy <leo@leopoldjoy.com>

* step 1 fix dependencies and op commit

* make multiproof compatible with base contracts

* fix imports in scripts

* fix mocks

* format and seperate out multiproof tests

* add tests to just and gen semver

* fix tests

* rm unecessary op commit

* apply optimism patch for multiproof

* move multiproof tests

* move files and delete multiproof test usage and profile

* remove remappings of nitro and op enclave

* undo multiproof changes and solady import change

* support AggregateVerifier in initalizer test

* fix import path

* semver

* semver

* semver

* deterministic semverlock

* add comment

* refactor multiproof patch changes. fix typo

* semver

* fmt

* semver

* fix tests

* fix tests where bytecodes size was different

* fmt

* semver

* semver

* semver

* make aggregateverifies excluded like faultdispute game. fix systemconfiggloabal initialize

* fmt

* fix tests

* semver

* rm just test-multiproof

* Replace onchain Nitro cert verification with Automata ZK verifier (#197)

* Replace onchain Nitro cert verification with Automata ZK verifier, add ISemver to multiproof contracts, wire SystemConfigGlobal into standard deploy pipeline

* Integrate multiproof config into standard DeployConfig, fix TEEVerifier proof format to match AggregateVerifier's l1head change

* Fix fmt

* Replace aws-nitro-enclave-attestation submodule with no-git dependency in Makefile

* Consolidate deploy configs: migrate dev scripts to standard DeployConfig, add multiproof fields to sepolia.json and hardhat.json, remove separate nitro config files

* Regenerate snapshots for updated and new multiproof contracts

* Fix Initializable test: guard ETHLockbox entries for non-interop deploys, exclude AggregateVerifier (uses custom bool instead of OZ _initialized)

* Add test-multiproof recipe to Justfile for CI

* Address PR feedback: extract GameType local var, stricter pubKey check, iterate PCRs, add nitroEnclaveVerifier to Input, revert sepolia.json owner, remove redundant CI recipe

* Resolve merge conflicts and regenerate semver-lock snapshots

* Regenerate semver-lock with CI profile for correct bytecode hashes

* Regenerate semver-lock with all compiler profiles including dispute

* Regenerate semver-lock.json to remove stale dispute profile entries

* Fix misleading TEEVerifier comment, require nitroEnclaveVerifier in deploy config, and parameterize hardcoded l2ChainID/block intervals in DeployImplementations

* Reset semvar versioning in SystemConfigGlobal

* Regenerate semver-lock.json for SystemConfigGlobal and TEEVerifier changes

* correct SystemConfigGlobal.t.sol testInitialization() test cases to check correct version() number

* use a proof threshold and allow ZK proofs after TEE nullification (#199)

* use a proof threshold and allow ZK proofs after TEE nullification

* pr feedback

* update deployment scripts and tests

* allow tee nullfiication when a zk proof exists. extend timestamp in this case to allow for zk nullification

* Fix stack-too-deep in DeployImplementations and regenerate semver-lock

* add multiproofProofThreshold to DeployConfig.s.sol to fix CI failures

* Correct semver comment

* Regenerate semver-lock following fix

---------

Co-authored-by: roger-bai-coinbase <roger.bai@coinbase.com>

* pr feedback: delete unecessary snapshots

---------

Co-authored-by: Roger Bai <roger.bai@coinbase.com>
Co-authored-by: Leopold Joy <leo@leopoldjoy.com>
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.

4 participants