diff --git a/Cargo.lock b/Cargo.lock index 7f4b8d4ee9e0..43313c6a3222 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6610,6 +6610,7 @@ version = "1.0.0" dependencies = [ "ahash", "arbitrary", + "backon", "clap", "comfy-table", "confy", @@ -6622,6 +6623,8 @@ dependencies = [ "ratatui", "reth-beacon-consensus", "reth-chainspec", + "reth-cli-runner", + "reth-cli-util", "reth-config", "reth-db", "reth-db-api", @@ -6629,15 +6632,20 @@ dependencies = [ "reth-downloaders", "reth-evm", "reth-fs-util", + "reth-network", + "reth-network-p2p", "reth-node-core", "reth-primitives", "reth-provider", + "reth-prune", "reth-stages", "reth-static-file", "reth-static-file-types", + "reth-trie", "serde", "serde_json", "tokio", + "toml", "tracing", ] diff --git a/bin/reth/src/cli/mod.rs b/bin/reth/src/cli/mod.rs index cc9911898b0a..baa617b2601e 100644 --- a/bin/reth/src/cli/mod.rs +++ b/bin/reth/src/cli/mod.rs @@ -6,15 +6,15 @@ use crate::{ LogArgs, }, commands::{ - config_cmd, debug_cmd, dump_genesis, import, init_cmd, init_state, + debug_cmd, import, node::{self, NoArgs}, - p2p, prune, recover, stage, + stage, }, version::{LONG_VERSION, SHORT_VERSION}, }; use clap::{value_parser, Parser, Subcommand}; use reth_chainspec::ChainSpec; -use reth_cli_commands::db; +use reth_cli_commands::{config_cmd, db, dump_genesis, init_cmd, init_state, p2p, prune, recover}; use reth_cli_runner::CliRunner; use reth_db::DatabaseEnv; use reth_node_builder::{NodeBuilder, WithLaunchContext}; diff --git a/bin/reth/src/commands/mod.rs b/bin/reth/src/commands/mod.rs index 23d54e098228..2bd023f4aec0 100644 --- a/bin/reth/src/commands/mod.rs +++ b/bin/reth/src/commands/mod.rs @@ -1,13 +1,6 @@ //! This contains all of the `reth` commands -pub mod config_cmd; pub mod debug_cmd; -pub mod dump_genesis; pub mod import; -pub mod init_cmd; -pub mod init_state; pub mod node; -pub mod p2p; -pub mod prune; -pub mod recover; pub mod stage; diff --git a/crates/cli/commands/Cargo.toml b/crates/cli/commands/Cargo.toml index 909e00eb749a..d413815f57ce 100644 --- a/crates/cli/commands/Cargo.toml +++ b/crates/cli/commands/Cargo.toml @@ -10,23 +10,28 @@ repository.workspace = true [lints] [dependencies] -reth-db = { workspace = true, features = ["mdbx"] } -reth-db-api.workspace = true -reth-provider.workspace = true -reth-primitives.workspace = true -reth-node-core.workspace = true -reth-fs-util.workspace = true -reth-db-common.workspace = true -reth-static-file-types.workspace = true reth-beacon-consensus.workspace = true reth-chainspec.workspace = true +reth-cli-runner.workspace = true +reth-cli-util.workspace = true reth-config.workspace = true +reth-db = { workspace = true, features = ["mdbx"] } +reth-db-api.workspace = true +reth-db-common.workspace = true reth-downloaders.workspace = true reth-evm.workspace = true +reth-fs-util.workspace = true +reth-network = { workspace = true, features = ["serde"] } +reth-network-p2p.workspace = true +reth-node-core.workspace = true +reth-primitives.workspace = true +reth-provider.workspace = true +reth-prune.workspace = true reth-stages.workspace = true +reth-static-file-types.workspace = true reth-static-file.workspace = true +reth-trie = { workspace = true, features = ["metrics"] } -confy.workspace = true tokio.workspace = true itertools.workspace = true @@ -38,6 +43,11 @@ clap = { workspace = true, features = ["derive", "env"] } serde.workspace = true serde_json.workspace = true tracing.workspace = true +backon.workspace = true + +# io +confy.workspace = true +toml = { workspace = true, features = ["display"] } # tui comfy-table = "7.0" diff --git a/bin/reth/src/commands/config_cmd.rs b/crates/cli/commands/src/config_cmd.rs similarity index 100% rename from bin/reth/src/commands/config_cmd.rs rename to crates/cli/commands/src/config_cmd.rs diff --git a/bin/reth/src/commands/dump_genesis.rs b/crates/cli/commands/src/dump_genesis.rs similarity index 93% rename from bin/reth/src/commands/dump_genesis.rs rename to crates/cli/commands/src/dump_genesis.rs index 70b95e73639b..ae425ca8c29d 100644 --- a/bin/reth/src/commands/dump_genesis.rs +++ b/crates/cli/commands/src/dump_genesis.rs @@ -1,7 +1,7 @@ //! Command that dumps genesis block JSON configuration to stdout -use crate::args::utils::{chain_help, chain_value_parser, SUPPORTED_CHAINS}; use clap::Parser; use reth_chainspec::ChainSpec; +use reth_node_core::args::utils::{chain_help, chain_value_parser, SUPPORTED_CHAINS}; use std::sync::Arc; /// Dumps genesis block JSON configuration to stdout diff --git a/bin/reth/src/commands/init_cmd.rs b/crates/cli/commands/src/init_cmd.rs similarity index 90% rename from bin/reth/src/commands/init_cmd.rs rename to crates/cli/commands/src/init_cmd.rs index df407c0659f0..933527cc565a 100644 --- a/bin/reth/src/commands/init_cmd.rs +++ b/crates/cli/commands/src/init_cmd.rs @@ -1,7 +1,7 @@ //! Command that initializes the node from a genesis file. +use crate::common::{AccessRights, Environment, EnvironmentArgs}; use clap::Parser; -use reth_cli_commands::common::{AccessRights, Environment, EnvironmentArgs}; use reth_provider::BlockHashReader; use tracing::info; diff --git a/bin/reth/src/commands/init_state.rs b/crates/cli/commands/src/init_state.rs similarity index 96% rename from bin/reth/src/commands/init_state.rs rename to crates/cli/commands/src/init_state.rs index 4324b7f46882..af26d15e0176 100644 --- a/bin/reth/src/commands/init_state.rs +++ b/crates/cli/commands/src/init_state.rs @@ -1,7 +1,7 @@ //! Command that initializes the node from a genesis file. +use crate::common::{AccessRights, Environment, EnvironmentArgs}; use clap::Parser; -use reth_cli_commands::common::{AccessRights, Environment, EnvironmentArgs}; use reth_config::config::EtlConfig; use reth_db_api::database::Database; use reth_db_common::init::init_from_state_dump; diff --git a/crates/cli/commands/src/lib.rs b/crates/cli/commands/src/lib.rs index e63d039d1cfd..3ddbd91a9362 100644 --- a/crates/cli/commands/src/lib.rs +++ b/crates/cli/commands/src/lib.rs @@ -9,6 +9,13 @@ #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] pub mod common; +pub mod config_cmd; pub mod db; +pub mod dump_genesis; +pub mod init_cmd; +pub mod init_state; +pub mod p2p; +pub mod prune; +pub mod recover; #[cfg(feature = "dev")] pub mod test_vectors; diff --git a/bin/reth/src/commands/p2p.rs b/crates/cli/commands/src/p2p.rs similarity index 98% rename from bin/reth/src/commands/p2p.rs rename to crates/cli/commands/src/p2p.rs index caa85a71dbb9..0fdefac8bd88 100644 --- a/bin/reth/src/commands/p2p.rs +++ b/crates/cli/commands/src/p2p.rs @@ -1,12 +1,5 @@ //! P2P Debugging tool -use crate::{ - args::{ - utils::{chain_help, chain_value_parser, SUPPORTED_CHAINS}, - DatabaseArgs, NetworkArgs, - }, - utils::get_single_header, -}; use backon::{ConstantBuilder, Retryable}; use clap::{Parser, Subcommand}; use reth_chainspec::ChainSpec; @@ -14,7 +7,13 @@ use reth_cli_util::{get_secret_key, hash_or_num_value_parser}; use reth_config::Config; use reth_network::NetworkConfigBuilder; use reth_network_p2p::bodies::client::BodiesClient; -use reth_node_core::args::DatadirArgs; +use reth_node_core::{ + args::{ + utils::{chain_help, chain_value_parser, SUPPORTED_CHAINS}, + DatabaseArgs, DatadirArgs, NetworkArgs, + }, + utils::get_single_header, +}; use reth_primitives::BlockHashOrNumber; use std::{path::PathBuf, sync::Arc}; diff --git a/bin/reth/src/commands/prune.rs b/crates/cli/commands/src/prune.rs similarity index 95% rename from bin/reth/src/commands/prune.rs rename to crates/cli/commands/src/prune.rs index cd9cfabb26a3..6cc5e033bc04 100644 --- a/bin/reth/src/commands/prune.rs +++ b/crates/cli/commands/src/prune.rs @@ -1,6 +1,6 @@ //! Command that runs pruning without any limits. +use crate::common::{AccessRights, Environment, EnvironmentArgs}; use clap::Parser; -use reth_cli_commands::common::{AccessRights, Environment, EnvironmentArgs}; use reth_prune::PrunerBuilder; use reth_static_file::StaticFileProducer; use tracing::info; diff --git a/bin/reth/src/commands/recover/mod.rs b/crates/cli/commands/src/recover/mod.rs similarity index 100% rename from bin/reth/src/commands/recover/mod.rs rename to crates/cli/commands/src/recover/mod.rs diff --git a/bin/reth/src/commands/recover/storage_tries.rs b/crates/cli/commands/src/recover/storage_tries.rs similarity index 96% rename from bin/reth/src/commands/recover/storage_tries.rs rename to crates/cli/commands/src/recover/storage_tries.rs index 7cab05ff8527..2b4087144805 100644 --- a/bin/reth/src/commands/recover/storage_tries.rs +++ b/crates/cli/commands/src/recover/storage_tries.rs @@ -1,5 +1,5 @@ +use crate::common::{AccessRights, Environment, EnvironmentArgs}; use clap::Parser; -use reth_cli_commands::common::{AccessRights, Environment, EnvironmentArgs}; use reth_cli_runner::CliContext; use reth_db::tables; use reth_db_api::{