Skip to content

feat(CHAIN-3336): add Rust bindings and reorganize bindings directory#200

Closed
xenoliss wants to merge 18 commits intobo/chain-3335from
bo/chain-3336
Closed

feat(CHAIN-3336): add Rust bindings and reorganize bindings directory#200
xenoliss wants to merge 18 commits intobo/chain-3335from
bo/chain-3336

Conversation

@xenoliss
Copy link
Contributor

@xenoliss xenoliss commented Mar 4, 2026

Summary

Reorganize contract bindings under a single bindings/ directory with language-specific subdirectories:

  • bindings/go/ — existing Go bindings (BalanceTracker, FeeDisburser) moved from bindings/
  • bindings/rust/ — new Rust bindings crate (base-contracts-bindings) using Alloy's sol! macro, moved from crates/bindings/

The Rust crate exposes typed bindings (ABI + bytecode) generated from committed Forge artifacts, so downstream Rust consumers can depend on it via Cargo without needing Foundry.

@linear
Copy link

linear bot commented Mar 4, 2026

Copy link
Contributor

@jackchuma jackchuma left a comment

Choose a reason for hiding this comment

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

There's no CI check or script to verify that committed artifacts in bindings/rust/artifacts/ match the current compiled output from forge build. If someone modifies FlashblockIndex.sol without regenerating the artifact, the Rust bindings will silently be out of sync.

Can we also add a CI step or a just recipe that:

  1. Runs forge build
  2. Compares forge-artifacts/FlashblockIndex.sol/FlashblockIndex.json with bindings/rust/artifacts/FlashblockIndex.json
  3. Fails if they differ

This would be analogous to the existing snapshots-check pattern

@xenoliss xenoliss requested a review from jackchuma March 4, 2026 16:49
Copy link
Contributor

@jackchuma jackchuma left a comment

Choose a reason for hiding this comment

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

We also probably want to add a CI step that confirms the generated rust bindings compile. What do you think?

jjtny1 and others added 16 commits March 6, 2026 13:06
* 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>
* feat(CHAIN-3446): add getRegisteredSigners() enumeration to SystemConfigGlobal

* Fix fmt

* Regenerate semver-lock.json
* 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>

* Simplify AggregateVerifier and make it more modular for further proof systems

* allow bond refund after 14 days

* fix build and tests

* forge fmt

* forge fmt

* pr feedback

* semver lock

* Clean up AggregateVerifier

* Remove challenge after nullification

* semver lock

* Clean up

* semver lock

* fix: nullifying zk challenge has to use original intermediate root

* forge fmt

* fix: use starting anchor root when there is no parent game

* merge from main

* forge clean and rebuild

* fix forge fmt

* pr feedback

---------

Co-authored-by: Leopold Joy <leo@leopoldjoy.com>
Co-authored-by: Joby Thundil <joby.thundil@coinbase.com>
* refactor: rename SystemConfigGlobal to TEEProverRegistry

* fix: align ASCII tables in deploy script comments

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: regenerate semver-lock and snapshots after clean build

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…cts (#206)

* Add custom NitroEnclaveVerifier contract and update multiproof contracts

- Add NitroEnclaveVerifier with ZK-based AWS Nitro attestation verification
- Add tests for NitroEnclaveVerifier
- Add proof submitter configurability to NitroEnclaveVerifier
- Update TEEVerifier, MockVerifier, and deploy scripts accordingly
- Update snapshots and semver-lock

Made-with: Cursor

* pr feedback

* add INitroEnclaveVerifier

* update license

* add license to multiproof contracts

* pr feedback

* forge fmt
@xenoliss
Copy link
Contributor Author

Replaced by #207

@xenoliss xenoliss closed this Mar 17, 2026
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.

5 participants