diff --git a/bin/reth/src/cli/mod.rs b/bin/reth/src/cli/mod.rs index eaa0c77f52a5..4c7442b640b2 100644 --- a/bin/reth/src/cli/mod.rs +++ b/bin/reth/src/cli/mod.rs @@ -1,7 +1,7 @@ //! CLI definition and entrypoint to executable use crate::{ - args::{utils::chain_help, LogArgs}, + args::LogArgs, commands::debug_cmd, version::{LONG_VERSION, SHORT_VERSION}, }; @@ -45,7 +45,7 @@ pub struct Cli impl TypedValueParser> { Parser(std::marker::PhantomData::) } + + /// Produces a help message for the chain spec argument. + fn help_messge() -> 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 {}", Self::SUPPORTED_CHAINS.join(", ")) + } } diff --git a/crates/cli/commands/src/common.rs b/crates/cli/commands/src/common.rs index 8d50f16e07b7..dad35938bda6 100644 --- a/crates/cli/commands/src/common.rs +++ b/crates/cli/commands/src/common.rs @@ -10,7 +10,7 @@ use reth_db_common::init::init_genesis; use reth_downloaders::{bodies::noop::NoopBodiesDownloader, headers::noop::NoopHeaderDownloader}; use reth_evm::noop::NoopBlockExecutorProvider; use reth_node_core::{ - args::{utils::chain_help, DatabaseArgs, DatadirArgs}, + args::{DatabaseArgs, DatadirArgs}, dirs::{ChainPath, DataDirPath}, }; use reth_primitives::B256; @@ -38,7 +38,7 @@ pub struct EnvironmentArgs { #[arg( long, value_name = "CHAIN_OR_PATH", - long_help = chain_help(), + long_help = C::help_messge(), default_value = C::SUPPORTED_CHAINS[0], value_parser = C::parser() )] diff --git a/crates/cli/commands/src/dump_genesis.rs b/crates/cli/commands/src/dump_genesis.rs index 29d82b3e8439..a12c9d80c169 100644 --- a/crates/cli/commands/src/dump_genesis.rs +++ b/crates/cli/commands/src/dump_genesis.rs @@ -4,7 +4,6 @@ use std::sync::Arc; use clap::Parser; use reth_chainspec::ChainSpec; use reth_cli::chainspec::ChainSpecParser; -use reth_node_core::args::utils::chain_help; /// Dumps genesis block JSON configuration to stdout #[derive(Debug, Parser)] @@ -15,7 +14,7 @@ pub struct DumpGenesisCommand { #[arg( long, value_name = "CHAIN_OR_PATH", - long_help = chain_help(), + long_help = C::help_messge(), default_value = C::SUPPORTED_CHAINS[0], value_parser = C::parser() )] diff --git a/crates/cli/commands/src/node.rs b/crates/cli/commands/src/node.rs index 35b553f71378..704e931a3aa6 100644 --- a/crates/cli/commands/src/node.rs +++ b/crates/cli/commands/src/node.rs @@ -9,9 +9,8 @@ use reth_db::{init_db, DatabaseEnv}; use reth_node_builder::{NodeBuilder, WithLaunchContext}; use reth_node_core::{ args::{ - utils::{chain_help, DefaultChainSpecParser}, - DatabaseArgs, DatadirArgs, DebugArgs, DevArgs, NetworkArgs, PayloadBuilderArgs, - PruningArgs, RpcServerArgs, TxPoolArgs, + utils::DefaultChainSpecParser, DatabaseArgs, DatadirArgs, DebugArgs, DevArgs, NetworkArgs, + PayloadBuilderArgs, PruningArgs, RpcServerArgs, TxPoolArgs, }, node_config::NodeConfig, version, @@ -35,7 +34,7 @@ pub struct NodeCommand< #[arg( long, value_name = "CHAIN_OR_PATH", - long_help = chain_help(), + long_help = C::help_messge(), default_value = C::SUPPORTED_CHAINS[0], default_value_if("dev", "true", "dev"), value_parser = C::parser(), diff --git a/crates/cli/commands/src/p2p/mod.rs b/crates/cli/commands/src/p2p/mod.rs index 6b1d64443a3c..326fdb23585a 100644 --- a/crates/cli/commands/src/p2p/mod.rs +++ b/crates/cli/commands/src/p2p/mod.rs @@ -11,7 +11,7 @@ use reth_config::Config; use reth_network::{BlockDownloaderProvider, NetworkConfigBuilder}; use reth_network_p2p::bodies::client::BodiesClient; use reth_node_core::{ - args::{utils::chain_help, DatabaseArgs, DatadirArgs, NetworkArgs}, + args::{DatabaseArgs, DatadirArgs, NetworkArgs}, utils::get_single_header, }; use reth_primitives::BlockHashOrNumber; @@ -31,7 +31,7 @@ pub struct Command { #[arg( long, value_name = "CHAIN_OR_PATH", - long_help = chain_help(), + long_help = C::help_messge(), default_value = C::SUPPORTED_CHAINS[0], value_parser = C::parser() )] diff --git a/crates/node/core/src/args/utils.rs b/crates/node/core/src/args/utils.rs index 6b58978954a5..68cfc321921b 100644 --- a/crates/node/core/src/args/utils.rs +++ b/crates/node/core/src/args/utils.rs @@ -19,11 +19,6 @@ pub const SUPPORTED_CHAINS: &[&str] = /// Chains supported by reth. First value should be used as the default. pub const SUPPORTED_CHAINS: &[&str] = &["mainnet", "sepolia", "holesky", "dev"]; -/// 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(", ")) -} - /// Clap value parser for [`ChainSpec`]s. /// /// The value parser matches either a known chain, the path diff --git a/crates/optimism/cli/src/lib.rs b/crates/optimism/cli/src/lib.rs index 9019f2f8ce2f..4af95a88a0c7 100644 --- a/crates/optimism/cli/src/lib.rs +++ b/crates/optimism/cli/src/lib.rs @@ -43,7 +43,7 @@ use reth_db::DatabaseEnv; use reth_evm_optimism::OpExecutorProvider; use reth_node_builder::{NodeBuilder, WithLaunchContext}; use reth_node_core::{ - args::{utils::chain_help, LogArgs}, + args::LogArgs, version::{LONG_VERSION, SHORT_VERSION}, }; use reth_tracing::FileWorkerGuard; @@ -65,7 +65,7 @@ pub struct Cli { #[arg( long, value_name = "CHAIN_OR_PATH", - long_help = chain_help(), + long_help = OpChainSpecParser::help_messge(), default_value = OpChainSpecParser::SUPPORTED_CHAINS[0], value_parser = OpChainSpecParser::parser(), global = true,