Skip to content
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: enable optimism hardforks on genesis parse #7935

Conversation

fgimenez
Copy link
Member

@fgimenez fgimenez commented Apr 27, 2024

Closes #7043, Closes #7702

Modifies the From<Genesis> implementation of ChainSpec to take into account the Optimism hardfork info in extra_fields.

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice,
one suggestion for reusability

Comment on lines 1045 to 1059
#[cfg(feature = "optimism")]
(
Hardfork::Regolith,
genesis.config.extra_fields.get("regolithTime").and_then(|value| value.as_u64()),
),
#[cfg(feature = "optimism")]
(
Hardfork::Ecotone,
genesis.config.extra_fields.get("ecotoneTime").and_then(|value| value.as_u64()),
),
#[cfg(feature = "optimism")]
(
Hardfork::Canyon,
genesis.config.extra_fields.get("canyonTime").and_then(|value| value.as_u64()),
),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this works, but perhaps we could make this reusable by adding a helper struct that contains all the activation info as Optional fields and has a OptimsismGenesisInfo::extract_from(&Genesis) or similar

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure done here 1a781c3 PTAL

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mattsse mattsse added this pull request to the merge queue Apr 29, 2024
@mattsse mattsse added the A-op-reth Related to Optimism and op-reth label Apr 29, 2024
Merged via the queue into paradigmxyz:main with commit 76e3aa9 Apr 29, 2024
28 checks passed
mw2000 pushed a commit to mw2000/reth that referenced this pull request Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-op-reth Related to Optimism and op-reth
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add OptimismGenesis fields type Parse Optimism hardforks from Genesis in op-reth --chain genesis.json
2 participants