-
Notifications
You must be signed in to change notification settings - Fork 126
docs(l2): add guide to re generate blobs #5317
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
07cb9c1
add docs
tomip01 70038c7
Update docs/developers/l2/state-reconstruction-blobs.md
tomip01 ca50ada
sadd suggestion
tomip01 9a7b7d1
add suggestion
tomip01 f3b8f0b
fix merge
tomip01 3c983b1
add compile contracts flag
tomip01 ddf8522
run prover step
tomip01 113f7e9
flip snippets
tomip01 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # Generate blobs for the state reconstruction test | ||
|
|
||
| The test in `crates/l2/tests/state_reconstruct.rs` replays a fixed set of blobs to reconstruct. If you ever need to regenerate those fixtures, you need to change the files `payload_builder.rs` and `l1_committer.rs`. | ||
|
|
||
| ## 1. Cap block payloads at 10 transactions | ||
|
|
||
| Edit `crates/l2/sequencer/block_producer/payload_builder.rs` and, inside the `fill_transactions` loop, add the early exit that forces every L2 block to contain at most ten transactions: | ||
|
|
||
| ```rust | ||
| if context.payload.body.transactions.len() >= 10 { | ||
| println!("Reached max transactions per block limit"); | ||
| break; | ||
| } | ||
| ``` | ||
|
|
||
| That guarantees we have transactions in each block for at least 6 batches. | ||
|
|
||
| ## 2. Persist every blob locally when the committer sends a batch | ||
|
|
||
| Still in the sequencer, open `crates/l2/sequencer/l1_committer.rs`: | ||
|
|
||
| - At the end of `send_commitment` (after logging the transaction hash) dump the blob that was just submitted: | ||
|
|
||
| ```rust | ||
| // Rest of the code ... | ||
| info!("Commitment sent: {commit_tx_hash:#x}"); | ||
| store_blobs(batch.blobs_bundle.blobs.clone(), batch.number); | ||
| Ok(commit_tx_hash) | ||
| ``` | ||
|
|
||
| - Add this helper function: | ||
|
|
||
| ```rust | ||
| fn store_blobs(blobs: Vec<Blob>, current_blob: u64) { | ||
| let blob = blobs.first().unwrap(); | ||
| fs::write(format!("{current_blob}-1.blob"), blob).unwrap(); | ||
| } | ||
| ``` | ||
tomip01 marked this conversation as resolved.
Show resolved
Hide resolved
tomip01 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Running the node with the deposits of the rich accounts will create `N-1.blob` files (you can move them into `fixtures/blobs/` afterwards). | ||
|
|
||
| ## 3. Run the L2 and capture six blobs | ||
|
|
||
| Start the local L2 with a 20 seconds per commit so we have at least 6 batches with transactions: | ||
|
|
||
| ```sh | ||
| ethrex l2 --dev --no-monitor --committer.commit-time 20000 | ||
| ``` | ||
|
|
||
| Once the sequencer has produced six batches you will see six files named `1-1.blob` through `6-1.blob`. Copy them into `fixtures/blobs/` (overwriting the existing files). | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.