-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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: use OpChainSpec
in OptimismNode
and its components
#11304
Conversation
68e19a6
to
48a4702
Compare
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 is awesome!
left some ideas for good-first-issues/followups
@@ -50,14 +50,14 @@ pub struct EnvironmentArgs<C: ChainSpecParser> { | |||
pub db: DatabaseArgs, | |||
} | |||
|
|||
impl<C: ChainSpecParser<ChainSpec = ChainSpec>> EnvironmentArgs<C> { | |||
impl<C: ChainSpecParser<ChainSpec: EthChainSpec + EthereumHardforks>> EnvironmentArgs<C> { |
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.
we're using this combo a few times,
what we could do is introduce a helper trait that combines both, but perhaps not useful. maybe we introduce EthereumChainSpec
and rename EthChainSpec
fn deposit_contract(&self) -> Option<&DepositContract> { | ||
self.inner.deposit_contract() | ||
} |
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.
followup here would be to check if we actually need this in the trait because this is just an ethereum setting.
it might be useful to split EthChainSpec
into two traits
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 is only used for pruning configuration
reth/crates/node/core/src/args/pruning.rs
Lines 106 to 111 in 48a4702
// prune all receipts if chain doesn't have deposit contract specified in chain | |
// spec | |
receipts: chain_spec | |
.deposit_contract() | |
.map(|contract| PruneMode::Before(contract.block)) | |
.or(Some(PruneMode::Distance(MINIMUM_PRUNING_DISTANCE))), |
I think we can either move prune_config
fn to chainspec trait or introduce trait(s) which would be able to produce a concrete *Config
type based on concrete cli *Args
type and a chainspec
we also have similar pattern in NetworkArgs
reth/crates/node/core/src/args/network.rs
Line 199 in 48a4702
pub fn network_config( |
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.
I see, I guess this doesn't matter really if this is part of the trait since option
Closes #11238
Closes #10909
Closes #10770
This PR relaxes chainspec bounds on CLI, changes
OpChainSpecParser
AT toOpChainSpec
and makes optimism-specific CLI types to useOpChainSpec