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

chore: move reth commands to separate folder #5886

Merged
merged 3 commits into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions bin/reth/src/chain/mod.rs

This file was deleted.

7 changes: 4 additions & 3 deletions bin/reth/src/cli/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl RethCliExt for () {
}

/// A trait that allows for extending and customizing parts of the node command
/// [NodeCommand](crate::node::NodeCommand).
/// [NodeCommand](crate::commands::node::NodeCommand).
///
/// The functions are invoked during the initialization of the node command in the following order:
///
Expand Down Expand Up @@ -177,7 +177,8 @@ pub trait RethNodeCommandExt: RethNodeCommandConfig + fmt::Debug + clap::Args {}
// blanket impl for all types that implement the required traits.
impl<T> RethNodeCommandExt for T where T: RethNodeCommandConfig + fmt::Debug + clap::Args {}

/// The default configuration for the reth node command [Command](crate::node::NodeCommand).
/// The default configuration for the reth node command
/// [Command](crate::commands::node::NodeCommand).
///
/// This is a convenience type for [NoArgs<()>].
#[derive(Debug, Clone, Copy, Default, Args)]
Expand All @@ -200,7 +201,7 @@ impl<Conf: RethNodeCommandConfig> RethCliExt for NoArgsCliExt<Conf> {
/// additional CLI arguments.
///
/// Note: This type must be manually filled with a [RethNodeCommandConfig] manually before executing
/// the [NodeCommand](crate::node::NodeCommand).
/// the [NodeCommand](crate::commands::node::NodeCommand).
#[derive(Debug, Clone, Copy, Default, Args)]
pub struct NoArgs<T = ()> {
#[clap(skip)]
Expand Down
13 changes: 6 additions & 7 deletions bin/reth/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

use crate::{
args::utils::{chain_help, genesis_value_parser, SUPPORTED_CHAINS},
chain,
cli::ext::RethCliExt,
db, debug_cmd,
commands::{
config_cmd, db, debug_cmd, import, init_cmd, node, p2p, recover, stage, test_vectors,
},
dirs::{LogsDir, PlatformPath},
node, p2p, recover,
runner::CliRunner,
stage, test_vectors,
version::{LONG_VERSION, SHORT_VERSION},
};
use clap::{value_parser, ArgAction, Args, Parser, Subcommand, ValueEnum};
Expand Down Expand Up @@ -140,10 +139,10 @@ pub enum Commands<Ext: RethCliExt = ()> {
Node(node::NodeCommand<Ext>),
/// Initialize the database from a genesis file.
#[command(name = "init")]
Init(chain::InitCommand),
Init(init_cmd::InitCommand),
/// This syncs RLP encoded blocks from a file.
#[command(name = "import")]
Import(chain::ImportCommand),
Import(import::ImportCommand),
/// Database debugging utilities
#[command(name = "db")]
Db(db::Command),
Expand All @@ -158,7 +157,7 @@ pub enum Commands<Ext: RethCliExt = ()> {
TestVectors(test_vectors::Command),
/// Write config to stdout
#[command(name = "config")]
Config(crate::config::Command),
Config(config_cmd::Command),
/// Various debug routines
#[command(name = "debug")]
Debug(debug_cmd::Command),
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/cli/node_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ use crate::{
db_type::{DatabaseBuilder, DatabaseInstance},
ext::{RethCliExt, RethNodeCommandConfig},
},
commands::node::{cl_events::ConsensusLayerHealthEvents, events},
dirs::{ChainPath, DataDirPath, MaybePlatformPath},
init::init_genesis,
node::{cl_events::ConsensusLayerHealthEvents, events},
prometheus_exporter,
utils::{get_single_header, write_peers_to_file},
version::SHORT_VERSION,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use crate::{
utils::{chain_help, genesis_value_parser, SUPPORTED_CHAINS},
DatabaseArgs, NetworkArgs,
},
commands::node::events,
dirs::{DataDirPath, MaybePlatformPath},
init::init_genesis,
node::events,
runner::CliContext,
utils::get_single_header,
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
//! Command that initializes the node by importing a chain from a file.

use crate::{
args::{
utils::{chain_help, genesis_value_parser, SUPPORTED_CHAINS},
DatabaseArgs,
},
commands::node::events::{handle_events, NodeEvent},
dirs::{DataDirPath, MaybePlatformPath},
init::init_genesis,
node::events::{handle_events, NodeEvent},
version::SHORT_VERSION,
};
use clap::Parser;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Command that initializes the node from a genesis file.

use crate::{
args::{
utils::{chain_help, genesis_value_parser, SUPPORTED_CHAINS},
Expand Down
12 changes: 12 additions & 0 deletions bin/reth/src/commands/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//! This contains all of the `reth` commands

pub mod config_cmd;
pub mod db;
pub mod debug_cmd;
pub mod import;
pub mod init_cmd;
pub mod node;
pub mod p2p;
pub mod recover;
pub mod stage;
pub mod test_vectors;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Support for handling events emitted by node components.

use crate::node::cl_events::ConsensusLayerHealthEvent;
use crate::commands::node::cl_events::ConsensusLayerHealthEvent;
use futures::Stream;
use reth_beacon_consensus::BeaconConsensusEngineEvent;
use reth_db::{database::Database, database_metrics::DatabaseMetadata};
Expand Down Expand Up @@ -466,7 +466,7 @@ impl Display for Eta {

#[cfg(test)]
mod tests {
use crate::node::events::Eta;
use crate::commands::node::events::Eta;
use std::time::{Duration, Instant};

#[test]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 1 addition & 9 deletions bin/reth/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,12 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

pub mod args;
pub mod chain;
pub mod cli;
pub mod config;
pub mod db;
pub mod debug_cmd;
pub mod commands;
pub mod dirs;
pub mod init;
pub mod node;
pub mod p2p;
pub mod prometheus_exporter;
pub mod recover;
pub mod runner;
pub mod stage;
pub mod test_vectors;
pub mod utils;
pub mod version;

Expand Down
2 changes: 1 addition & 1 deletion crates/consensus/auto-seal/tests/it/auto_mine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use reth::{
components::RethNodeComponents,
ext::{NoArgs, NoArgsCliExt, RethNodeCommandConfig},
},
node::NodeCommand,
commands::node::NodeCommand,
runner::CliRunner,
tasks::TaskSpawner,
};
Expand Down
Loading