Skip to content

Commit

Permalink
Remove reth-payload-builder from dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
johntaiko committed Jul 8, 2024
1 parent 0b9a76d commit 8fa22e9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 56 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion crates/node-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ reth-consensus-common.workspace = true
reth-beacon-consensus.workspace = true
reth-prune-types.workspace = true
reth-stages-types.workspace = true
reth-payload-builder.workspace = true

# taiko
taiko-reth-payload-builder = { workspace = true, optional = true }
Expand Down
60 changes: 6 additions & 54 deletions crates/node-core/src/args/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,62 +35,10 @@ pub const SUPPORTED_CHAINS: &[&str] = &["testnet", "internal_devnet_a", "mainnet

/// Helper to parse a [Duration] from seconds
pub fn parse_duration_from_secs(arg: &str) -> eyre::Result<Duration, std::num::ParseIntError> {
let seconds = arg.parse()?;
let seconds: u64 = arg.parse()?;
Ok(Duration::from_secs(seconds))
}

/// Clap value parser for [`ChainSpec`]s that takes either a built-in chainspec or the path
/// to a custom one.
pub fn chain_spec_value_parser(s: &str) -> eyre::Result<Arc<ChainSpec>, eyre::Error> {
Ok(match s {
#[cfg(not(any(feature = "optimism", feature = "taiko")))]
"mainnet" => MAINNET.clone(),
#[cfg(not(any(feature = "optimism", feature = "taiko")))]
"goerli" => GOERLI.clone(),
#[cfg(not(any(feature = "optimism", feature = "taiko")))]
"sepolia" => SEPOLIA.clone(),
#[cfg(not(any(feature = "optimism", feature = "taiko")))]
"holesky" => HOLESKY.clone(),
#[cfg(not(any(feature = "optimism", feature = "taiko")))]
"dev" => DEV.clone(),
#[cfg(feature = "optimism")]
"optimism" => OP_MAINNET.clone(),
#[cfg(feature = "optimism")]
"optimism_sepolia" | "optimism-sepolia" => OP_SEPOLIA.clone(),
#[cfg(feature = "optimism")]
"base" => BASE_MAINNET.clone(),
#[cfg(feature = "optimism")]
"base_sepolia" | "base-sepolia" => BASE_SEPOLIA.clone(),
#[cfg(feature = "taiko")]
"testnet" => TAIKO_TESTNET.clone(),
#[cfg(feature = "taiko")]
"internal_devnet_a" => TAIKO_INTERNAL_L2_A.clone(),
#[cfg(feature = "taiko")]
"hekla" => TAIKO_HEKLA.clone(),
#[cfg(feature = "taiko")]
"mainnet" => TAIKO_MAINNET.clone(),
_ => {
// try to read json from path first
let raw = match fs::read_to_string(PathBuf::from(shellexpand::full(s)?.into_owned())) {
Ok(raw) => raw,
Err(io_err) => {
// valid json may start with "\n", but must contain "{"
if s.contains('{') {
s.to_string()
} else {
return Err(io_err.into()) // assume invalid path
}
}
};

// both serialized Genesis and ChainSpec structs supported
let genesis: Genesis = serde_json::from_str(&raw)?;

Arc::new(genesis.into())
}
})
}

/// The help info for the --chain flag
pub fn chain_help() -> String {
format!("The chain this node is running.\nPossible values are either a built-in chain or the path to a chain specification file.\n\nBuilt-in chains:\n {}", SUPPORTED_CHAINS.join(", "))
Expand Down Expand Up @@ -123,6 +71,10 @@ pub fn chain_value_parser(s: &str) -> eyre::Result<Arc<ChainSpec>, eyre::Error>
"testnet" => TAIKO_TESTNET.clone(),
#[cfg(feature = "taiko")]
"internal_devnet_a" => TAIKO_INTERNAL_L2_A.clone(),
#[cfg(feature = "taiko")]
"hekla" => TAIKO_HEKLA.clone(),
#[cfg(feature = "taiko")]
"mainnet" => TAIKO_MAINNET.clone(),
_ => {
// try to read json from path first
let raw = match fs::read_to_string(PathBuf::from(shellexpand::full(s)?.into_owned())) {
Expand All @@ -132,7 +84,7 @@ pub fn chain_value_parser(s: &str) -> eyre::Result<Arc<ChainSpec>, eyre::Error>
if s.contains('{') {
s.to_string()
} else {
return Err(io_err.into()); // assume invalid path
return Err(io_err.into()) // assume invalid path
}
}
};
Expand Down

0 comments on commit 8fa22e9

Please sign in to comment.