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: use OpChainSpec in OptimismNode and its components #11304

Merged
merged 10 commits into from
Sep 28, 2024

Conversation

klkvr
Copy link
Collaborator

@klkvr klkvr commented Sep 27, 2024

Closes #11238
Closes #10909
Closes #10770

This PR relaxes chainspec bounds on CLI, changes OpChainSpecParser AT to OpChainSpec and makes optimism-specific CLI types to use OpChainSpec

@github-actions github-actions bot added the A-sdk Related to reth's use as a library label Sep 27, 2024
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.

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> {
Copy link
Collaborator

@mattsse mattsse Sep 28, 2024

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

Comment on lines +63 to +65
fn deposit_contract(&self) -> Option<&DepositContract> {
self.inner.deposit_contract()
}
Copy link
Collaborator

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

Copy link
Collaborator Author

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

// 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

pub fn network_config(

Copy link
Collaborator

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

@mattsse mattsse added this pull request to the merge queue Sep 28, 2024
Merged via the queue into main with commit 2aa3dd0 Sep 28, 2024
37 checks passed
@mattsse mattsse deleted the klkvr/optimism-chain-spec branch September 28, 2024 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sdk Related to reth's use as a library
Projects
None yet
2 participants