-
Notifications
You must be signed in to change notification settings - Fork 130
feat(l2): enable prover and sequencer versions per batch #5561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Lines of code reportTotal lines added: Detailed view |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements version tracking per batch to enable zero-downtime upgrades of the sequencer and prover. Each committed batch now stores the git commit hash of the sequencer build that created it, and verification keys are associated with specific commit hashes rather than being global. This allows different prover versions to coexist and prove only batches matching their version.
Key Changes:
- Added
commitHashfield toBatchCommitmentInfostruct to track the sequencer version per batch - Introduced
verificationKeysmapping keyed by commit hash and verifier type (SP1/RISC0) to support multiple verification keys simultaneously - Updated batch commitment and verification logic to use version-specific verification keys
- Modified prover coordination to gracefully handle version mismatches
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 27 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/l2/fundamentals/upgrades.md | New documentation explaining the upgrade process and how to register verification keys for new versions |
| crates/l2/tests/tests.rs | Updated default OnChainProposer address constant |
| crates/l2/tee/quote-gen/src/sender.rs | Renamed error variant from InvalidCodeVersion to NoBatchForVersion with updated error message |
| crates/l2/sequencer/proof_coordinator.rs | Changed version mismatch from error to debug log; provers now receive NoBatchForVersion response when no matching batch exists |
| crates/l2/sequencer/l1_committer.rs | Computes and includes commit hash in batch commitment transactions; updated function signatures |
| crates/l2/sdk/src/sdk.rs | Updated default bridge address constant |
| crates/l2/sdk/contract_utils/src/compile.rs | Added Solidity compiler optimization flags (--optimize with 50 runs) |
| crates/l2/prover/src/prover.rs | Changed handling of NoBatchForVersion from error to warning with graceful return |
| crates/l2/contracts/src/l1/interfaces/IOnChainProposer.sol | Updated interface signatures to include commit hash parameter in upgrade and commit functions; reordered commitBatch parameters |
| crates/l2/contracts/src/l1/based/interfaces/IOnChainProposer.sol | Updated interface signatures to include commit hash parameter in upgrade and commit functions |
| crates/l2/contracts/src/l1/based/OnChainProposer.sol | Implemented version-based verification key storage and retrieval; added validation for commit hash and verification key existence |
| crates/l2/contracts/src/l1/OnChainProposer.sol | Implemented version-based verification key storage and retrieval; added validation for commit hash and verification key existence |
| cmd/ethrex/l2/deployer.rs | Computes commit hash from git SHA and passes it during contract initialization |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| require( | ||
| (!REQUIRE_SP1_PROOF || | ||
| verificationKeys[commitHash][VK_SP1] != bytes32(0)) && | ||
| (!REQUIRE_RISC0_PROOF || | ||
| verificationKeys[commitHash][VK_RISC0] != bytes32(0)), | ||
| "013" // missing verification key for commit hash | ||
| ); |
Copilot
AI
Dec 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The validation logic checks that verification keys exist for the commit hash when a batch is committed. However, if REQUIRE_SP1_PROOF and REQUIRE_RISC0_PROOF are both false, the condition will always pass even if no verification keys are registered. This might be intentional for testing or special modes, but should be documented or validated more explicitly.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Motivation
We want to upgrade the network (sequencer + prover) without downtime. For this we associate the version of the sequencer when committing a batch. This allows to run provers with different versions and each will only prove batches that match with the same version as the one when committed
Description
commitHashfield toBatchCommitmentInfo.verificationKeyskeyed by commit hash and verifier type (SP1/RISC0), and an eventVerificationKeysUpdatedfor tracking verification key updates per commit.deployer.rsto compute the git commit hash, keccak it, and pass it as an argument when initializing contracts and batch commitments.