Reth celo state import storage layouts v1+v2#437
Reth celo state import storage layouts v1+v2#437piersy wants to merge 17 commits intocelo-rebase-17from
Conversation
Add a script to append L2 allocs (OP Stack predeploys injected at migration time) to the Celo L1 state dump for use with reth's init-state --without-ovm command. Also add migration documentation describing the full import workflow. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The L1 state dump omits the address field for the zero address, replacing it with the keccak256 hash as a key field. Add a script to fix this in place and document it as a required step. Also clarify that --update-state-root is required (not optional) and resolve open questions about decimal balances and nonce formats.
Remove --update-state-root flag from append_l2_allocs.py since the state root update is required for reth import. Add before/after output to fix_dump_zero_address.sh. Document ulimit requirement for dummy chain creation.
sed -i has incompatible syntax between macOS and Linux, and GNU sed fails with "regex input buffer length larger than INT_MAX" on the 50GB dump file. Switch to perl -i which works on both platforms.
…aration The append_l2_allocs.py script was naively appending L2 allocs to the L1 dump, causing a state root mismatch. Rewrite it to apply the same merge rules as the Go migration (applyAllocsToState + setupUnreleasedTreasury): allowlist-based account merging, treasury balance computation, and the zero address fix (absorbing fix_dump_zero_address.sh). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Log each alloc merge decision (case 2/3/5) and treasury handling so the output can be reviewed for correctness. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
With --storage.v2, genesis init creates changeset segments at block 0 (block_end=0), so next_block_number() returns 1. When importing at a non-zero migration block, this causes "trying to append data to StorageChangeSets as block #31056500 but expected block #1". Fix by advancing the changeset segments through the dummy blocks using increment_block, which properly creates segment files as needed.
The fix prevents the block being incremented for each inserted batch of changesets. Insetad the block is now incremented when the init-state requests a new block.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 160824069d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## celo-rebase-17 #437 +/- ##
================================================
- Coverage 76.2% 76.0% -0.2%
================================================
Files 591 592 +1
Lines 74215 75003 +788
================================================
+ Hits 56564 57037 +473
- Misses 17507 17822 +315
Partials 144 144
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
@piersy Looks good. Since reth v2.1.0, there's a storage migration command: https://github.com/paradigmxyz/reth/releases/tag/v2.1.0 Maybe it's worth to use that instead of updating the reth version required here? |
Provides the tooling to import a state dump from celo into reth, with either the v1 or v2 storage layout.
Includes the changes in #435
Relies on a fork of reth with this additional commit on top of the v1.11 branch
The rust-deny failures match those coming from the base branch, so are not related to these changes.