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

cleanup chainspec value parsers #11397

Closed
Tracked by #8904
mattsse opened this issue Oct 1, 2024 · 3 comments · Fixed by #11412
Closed
Tracked by #8904

cleanup chainspec value parsers #11397

mattsse opened this issue Oct 1, 2024 · 3 comments · Fixed by #11412
Assignees
Labels
D-good-first-issue Nice and easy! A great choice to get started

Comments

@mattsse
Copy link
Collaborator

mattsse commented Oct 1, 2024

atm the chainspec parsers are still in the utils crate

pub fn chain_value_parser(s: &str) -> eyre::Result<Arc<ChainSpec>, eyre::Error> {
Ok(match s {
"mainnet" => MAINNET.clone(),
"sepolia" => SEPOLIA.clone(),
"holesky" => HOLESKY.clone(),
"dev" => DEV.clone(),
_ => Arc::new(parse_custom_chain_spec(s)?),
})
}
/// Clap value parser for [`OpChainSpec`](reth_optimism_chainspec::OpChainSpec)s.
///
/// The value parser matches either a known chain, the path
/// to a json file, or a json formatted string in-memory. The json needs to be a Genesis struct.
#[cfg(feature = "optimism")]
pub fn chain_value_parser(s: &str) -> eyre::Result<Arc<ChainSpec>, eyre::Error> {

but they are no longer used in this crate. They should be moved to where the chainspec parsers are defined (chainspec crates).

we also need to rename:

pub struct DefaultChainSpecParser;

to EthereumChainSpecParser

@garwahl
Copy link
Contributor

garwahl commented Oct 2, 2024

Yeah I can do this

@garwahl
Copy link
Contributor

garwahl commented Oct 2, 2024

Hey @mattsse it appears these parsing functions already exist in their corresponding crates
crates/ethereum/../chainspec.rs

fn chain_value_parser(s: &str) -> eyre::Result<Arc<ChainSpec>, eyre::Error> {
Ok(match s {
"mainnet" => MAINNET.clone(),

crates/optimism/../chainspec.rs

/// to a json file, or a json formatted string in-memory. The json needs to be a Genesis struct.
fn chain_value_parser(s: &str) -> eyre::Result<Arc<OpChainSpec>, eyre::Error> {
Ok(match s {

Wondering how the value parsers inutils.rs are used and if we want this duplication/ can they be removed?

@mattsse
Copy link
Collaborator Author

mattsse commented Oct 2, 2024

I think these are duplicated and we can remove if possible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
D-good-first-issue Nice and easy! A great choice to get started
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants