From 8fa22e95b53c9f5517fae481e2367c8cbd775635 Mon Sep 17 00:00:00 2001 From: john xu Date: Mon, 8 Jul 2024 15:14:43 +0800 Subject: [PATCH] Remove reth-payload-builder from dependencies --- Cargo.lock | 1 - crates/node-core/Cargo.toml | 1 - crates/node-core/src/args/utils.rs | 60 +++--------------------------- 3 files changed, 6 insertions(+), 56 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4e2cd9ec3874..15101e18c0b2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7666,7 +7666,6 @@ dependencies = [ "reth-network", "reth-network-p2p", "reth-network-peers", - "reth-payload-builder", "reth-primitives", "reth-provider", "reth-prune-types", diff --git a/crates/node-core/Cargo.toml b/crates/node-core/Cargo.toml index 7051d8fc36d9..577b0576b2a1 100644 --- a/crates/node-core/Cargo.toml +++ b/crates/node-core/Cargo.toml @@ -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 } diff --git a/crates/node-core/src/args/utils.rs b/crates/node-core/src/args/utils.rs index f192910c049e..060d2e5ddd97 100644 --- a/crates/node-core/src/args/utils.rs +++ b/crates/node-core/src/args/utils.rs @@ -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 { - 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, 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(", ")) @@ -123,6 +71,10 @@ pub fn chain_value_parser(s: &str) -> eyre::Result, 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())) { @@ -132,7 +84,7 @@ pub fn chain_value_parser(s: &str) -> eyre::Result, 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 } } };