-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat: support non-zero genesis block numbers #19877
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
mattsse
left a comment
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.
supportive in general, but would like to hear more about where and how this is currently causing issues, because I'm unsure why we need this on the db level
for this I'd also like to see an e2e that uses a modified genesis block
| /// Genesis block number, default is 0; | ||
| genesis_block_number: u64, |
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.
can you elaborate on why we need this here?
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.
When static files are empty, we need this to reliably fallback to custom genesis number.
| number: genesis.number.unwrap_or_default(), | ||
| parent_hash: genesis.parent_hash.unwrap_or_default(), |
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.
this makes sense
Please read the full description #19874. We need custom genesis block since we migrate from a different blockchain to reth. We want to preserve our previous block height (or block data) for our users. So it will extremely awesome if you guys can accept our change. In theory, my changes should not influence the default behavior, which starting reth from 0 block height. Some e2e tests have been added for eth and op nodes. |
welcome frens, and thx for the prs thus far. as mentioned, not opposed to this in general, but I'd like to avoid doing this if feasible because I'd prefer if we could avoid introducing additional corner cases in the static file logic. I assume you'd need to do some form of regenesis with state snapshot anyway then? |
I will continue this conversion in #19874, but will this PR opened till we come to an mutual understanding. |
mattsse
left a comment
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.
mind taking a look at this @joshieDo @shekhirin
adding genesis handling doesnt look too bad imo
Add support for non-zero genesis block numbers
Adds support for chains with genesis blocks that don't start at block 0, enabling compatibility with custom chain configurations.
Attempts to address issue described in #19874.
Key Changes
numberandparent_hashfrom chain specwith_genesis_block_number()builder method with documentationappend_header_direct()for non-zero genesis blocks and updated block range calculationsThis ensures all database operations, static file operations, and stage checkpoints correctly handle chains with non-zero genesis blocks.