-
Notifications
You must be signed in to change notification settings - Fork 86
feat(l2): exchange commit hash in node-prover communication #3339
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
feat(l2): exchange commit hash in node-prover communication #3339
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 ensures the node and prover exchange and verify the same git commit and branch information, preventing version divergence by embedding a code_version
field in requests and responses.
- Added
build.rs
scripts andbuild-dependencies
in multiple crates to exportVERGEN_GIT_BRANCH
andVERGEN_GIT_SHA
. - Extended
ProofData
and client/prover code to include acode_version
inBatchRequest
and handleInvalidCodeVersion
responses. - Updated the CLI
get_client_version
and build scripts incmd/ethrex
to use the new git-based version fields.
Reviewed Changes
Copilot reviewed 13 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
crates/l2/tee/quote-gen/src/sender.rs | Propagate and handle code_version in get_batch |
crates/l2/tee/quote-gen/src/main.rs | Pass code_version into do_loop and initialize it |
crates/l2/tee/quote-gen/build.rs | Add build script for exporting git branch and SHA |
crates/l2/tee/quote-gen/Cargo.toml | Configure build.rs and add vergen-git2 dependency |
crates/l2/sequencer/proof_coordinator.rs | Extend ProofData , add mismatch handling, and DRY send_response |
crates/l2/prover/src/prover.rs | Include code_version in Prover and request logic |
crates/l2/prover/build.rs | Add build script for exporting git branch and SHA |
crates/l2/prover/Cargo.toml | Configure build.rs and add vergen-git2 dependency |
crates/l2/build.rs | Add build script for exporting git branch and SHA |
crates/l2/Cargo.toml | Add vergen-git2 to build-dependencies |
cmd/ethrex/utils.rs | Update get_client_version format to include git branch and SHA |
cmd/ethrex/build.rs | Merge Rustc and Git build steps, add git2 builder |
cmd/ethrex/Cargo.toml | Swap vergen to vergen-git2 for build-dependencies |
Comments suppressed due to low confidence (3)
crates/l2/sequencer/proof_coordinator.rs:67
- [nitpick] The numeric step annotation ("3.") is separated from the description for
BatchRequest
; consider merging the numeric label and its description into a single doc comment to keep the enum documentation consistent and clear.
/// Code version is used to ensure the client and server are compatible.
crates/l2/sequencer/proof_coordinator.rs:432
- This new mismatch branch for handling
InvalidCodeVersion
appears untested; consider adding unit or integration tests to verify that when the code versions differ, the server sendsInvalidCodeVersion
and the client reacts correctly.
if code_version != state.code_version {
cmd/ethrex/build.rs:2
RustcBuilder
is not provided byvergen_git2
; it should be imported from thevergen
crate (e.g.,use vergen::{Emitter, RustcBuilder};
) and then combined with thegit2
instructions.
use vergen_git2::{Emitter, Git2Builder, RustcBuilder};
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.
Nice!
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.
LGTM
**Motivation** We want to prevent a divergence between the code that is running in the L2 node and the prover. **Description** - Updates the client version to use `GIT_BRANCH` and `GIT_SHA` instead of `RUSTC_COMMIT_HASH`. - Adds a `build.rs` script for both the node and prover, using `vergen_git2` to export the git env vars. - Adds a `code_version` field to the `BatchRequest` message. - Introduces a new `ProofData` message: `InvalidCodeVersion`. ## How to test You can create an empty commit with: ```bash git commit --allow-empty -m "empty commit" ``` Then run the node and the prover using different commits. > [!WARNING] > Remember to run `make build-prover` whenever you change the commit Closes #3311
**Motivation** We want to prevent a divergence between the code that is running in the L2 node and the prover. **Description** - Updates the client version to use `GIT_BRANCH` and `GIT_SHA` instead of `RUSTC_COMMIT_HASH`. - Adds a `build.rs` script for both the node and prover, using `vergen_git2` to export the git env vars. - Adds a `code_version` field to the `BatchRequest` message. - Introduces a new `ProofData` message: `InvalidCodeVersion`. You can create an empty commit with: ```bash git commit --allow-empty -m "empty commit" ``` Then run the node and the prover using different commits. > [!WARNING] > Remember to run `make build-prover` whenever you change the commit Closes #3311
…ass#3339) **Motivation** We want to prevent a divergence between the code that is running in the L2 node and the prover. **Description** - Updates the client version to use `GIT_BRANCH` and `GIT_SHA` instead of `RUSTC_COMMIT_HASH`. - Adds a `build.rs` script for both the node and prover, using `vergen_git2` to export the git env vars. - Adds a `code_version` field to the `BatchRequest` message. - Introduces a new `ProofData` message: `InvalidCodeVersion`. ## How to test You can create an empty commit with: ```bash git commit --allow-empty -m "empty commit" ``` Then run the node and the prover using different commits. > [!WARNING] > Remember to run `make build-prover` whenever you change the commit Closes lambdaclass#3311
Motivation
We want to prevent a divergence between the code that is running in the L2 node and the prover.
Description
GIT_BRANCH
andGIT_SHA
instead ofRUSTC_COMMIT_HASH
.build.rs
script for both the node and prover, usingvergen_git2
to export the git env vars.code_version
field to theBatchRequest
message.ProofData
message:InvalidCodeVersion
.How to test
You can create an empty commit with:
git commit --allow-empty -m "empty commit"
Then run the node and the prover using different commits.
Warning
Remember to run
make build-prover
whenever you change the commitCloses #3311