-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat: enable optimism hardforks on genesis parse #7935
Conversation
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,
one suggestion for reusability
crates/primitives/src/chain/spec.rs
Outdated
#[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()), | ||
), |
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 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
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.
sure done here 1a781c3 PTAL
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
Closes #7043, Closes #7702
Modifies the
From<Genesis>
implementation ofChainSpec
to take into account the Optimism hardfork info inextra_fields
.