mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: extract cli runner from node-core (#7719)
This commit is contained in:
11
Cargo.lock
generated
11
Cargo.lock
generated
@ -6090,6 +6090,7 @@ dependencies = [
|
||||
"reth-basic-payload-builder",
|
||||
"reth-beacon-consensus",
|
||||
"reth-blockchain-tree",
|
||||
"reth-cli-runner",
|
||||
"reth-config",
|
||||
"reth-consensus-common",
|
||||
"reth-db",
|
||||
@ -6244,6 +6245,16 @@ dependencies = [
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "reth-cli-runner"
|
||||
version = "0.2.0-beta.5"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"reth-tasks",
|
||||
"tokio",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "reth-codecs"
|
||||
version = "0.2.0-beta.5"
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
members = [
|
||||
"bin/reth/",
|
||||
"crates/blockchain-tree/",
|
||||
"crates/cli/runner/",
|
||||
"crates/config/",
|
||||
"crates/consensus/auto-seal/",
|
||||
"crates/consensus/beacon/",
|
||||
@ -202,6 +203,7 @@ reth-basic-payload-builder = { path = "crates/payload/basic" }
|
||||
reth-beacon-consensus = { path = "crates/consensus/beacon" }
|
||||
reth-beacon-consensus-core = { path = "crates/consensus/beacon-core" }
|
||||
reth-blockchain-tree = { path = "crates/blockchain-tree" }
|
||||
reth-cli-runner = { path = "crates/cli/runner" }
|
||||
reth-codecs = { path = "crates/storage/codecs" }
|
||||
reth-config = { path = "crates/config" }
|
||||
reth-consensus-common = { path = "crates/consensus/common" }
|
||||
|
||||
@ -24,6 +24,7 @@ reth-interfaces = { workspace = true, features = ["clap"] }
|
||||
reth-transaction-pool.workspace = true
|
||||
reth-beacon-consensus.workspace = true
|
||||
reth-auto-seal-consensus.workspace = true
|
||||
reth-cli-runner.workspace = true
|
||||
reth-consensus-common.workspace = true
|
||||
reth-blockchain-tree.workspace = true
|
||||
reth-rpc-engine-api.workspace = true
|
||||
|
||||
@ -9,10 +9,10 @@ use crate::{
|
||||
config_cmd, db, debug_cmd, dump_genesis, import, init_cmd, node, node::NoArgs, p2p,
|
||||
recover, stage, test_vectors,
|
||||
},
|
||||
core::cli::runner::CliRunner,
|
||||
version::{LONG_VERSION, SHORT_VERSION},
|
||||
};
|
||||
use clap::{value_parser, Parser, Subcommand};
|
||||
use reth_cli_runner::CliRunner;
|
||||
use reth_db::DatabaseEnv;
|
||||
use reth_node_builder::{InitState, WithLaunchContext};
|
||||
use reth_primitives::ChainSpec;
|
||||
|
||||
@ -5,7 +5,6 @@ use crate::{
|
||||
utils::{chain_help, genesis_value_parser, SUPPORTED_CHAINS},
|
||||
DatabaseArgs,
|
||||
},
|
||||
core::cli::runner::CliContext,
|
||||
dirs::{DataDirPath, MaybePlatformPath},
|
||||
};
|
||||
use alloy_rlp::Decodable;
|
||||
@ -18,6 +17,7 @@ use reth_beacon_consensus::BeaconConsensus;
|
||||
use reth_blockchain_tree::{
|
||||
BlockchainTree, BlockchainTreeConfig, ShareableBlockchainTree, TreeExternals,
|
||||
};
|
||||
use reth_cli_runner::CliContext;
|
||||
use reth_db::{init_db, DatabaseEnv};
|
||||
use reth_interfaces::{consensus::Consensus, RethResult};
|
||||
use reth_node_api::PayloadBuilderAttributes;
|
||||
|
||||
@ -6,13 +6,13 @@ use crate::{
|
||||
utils::{chain_help, genesis_value_parser, SUPPORTED_CHAINS},
|
||||
DatabaseArgs, NetworkArgs,
|
||||
},
|
||||
core::cli::runner::CliContext,
|
||||
dirs::{DataDirPath, MaybePlatformPath},
|
||||
utils::get_single_header,
|
||||
};
|
||||
use clap::Parser;
|
||||
use futures::{stream::select as stream_select, StreamExt};
|
||||
use reth_beacon_consensus::BeaconConsensus;
|
||||
use reth_cli_runner::CliContext;
|
||||
use reth_config::{config::EtlConfig, Config};
|
||||
use reth_db::{database::Database, init_db, DatabaseEnv};
|
||||
use reth_downloaders::{
|
||||
|
||||
@ -6,12 +6,12 @@ use crate::{
|
||||
utils::{chain_help, genesis_value_parser, SUPPORTED_CHAINS},
|
||||
DatabaseArgs, NetworkArgs,
|
||||
},
|
||||
core::cli::runner::CliContext,
|
||||
dirs::{DataDirPath, MaybePlatformPath},
|
||||
utils::{get_single_body, get_single_header},
|
||||
};
|
||||
use backon::{ConstantBuilder, Retryable};
|
||||
use clap::Parser;
|
||||
use reth_cli_runner::CliContext;
|
||||
use reth_config::Config;
|
||||
use reth_db::{init_db, DatabaseEnv};
|
||||
use reth_interfaces::executor::BlockValidationError;
|
||||
|
||||
@ -6,13 +6,13 @@ use crate::{
|
||||
utils::{chain_help, genesis_value_parser, SUPPORTED_CHAINS},
|
||||
DatabaseArgs, NetworkArgs,
|
||||
},
|
||||
core::cli::runner::CliContext,
|
||||
dirs::{DataDirPath, MaybePlatformPath},
|
||||
utils::get_single_header,
|
||||
};
|
||||
use backon::{ConstantBuilder, Retryable};
|
||||
use clap::Parser;
|
||||
use reth_beacon_consensus::BeaconConsensus;
|
||||
use reth_cli_runner::CliContext;
|
||||
use reth_config::Config;
|
||||
use reth_db::{cursor::DbCursorRO, init_db, tables, transaction::DbTx, DatabaseEnv};
|
||||
use reth_interfaces::{consensus::Consensus, p2p::full_block::FullBlockClient};
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
//! `reth debug` command. Collection of various debugging routines.
|
||||
|
||||
use crate::core::cli::runner::CliContext;
|
||||
use clap::{Parser, Subcommand};
|
||||
use reth_cli_runner::CliContext;
|
||||
|
||||
mod build_block;
|
||||
mod execution;
|
||||
mod in_memory_merkle;
|
||||
|
||||
@ -4,7 +4,6 @@ use crate::{
|
||||
utils::{chain_help, genesis_value_parser, SUPPORTED_CHAINS},
|
||||
DatabaseArgs, NetworkArgs,
|
||||
},
|
||||
core::cli::runner::CliContext,
|
||||
dirs::{DataDirPath, MaybePlatformPath},
|
||||
};
|
||||
use clap::Parser;
|
||||
@ -14,6 +13,7 @@ use reth_beacon_consensus::{hooks::EngineHooks, BeaconConsensus, BeaconConsensus
|
||||
use reth_blockchain_tree::{
|
||||
BlockchainTree, BlockchainTreeConfig, ShareableBlockchainTree, TreeExternals,
|
||||
};
|
||||
use reth_cli_runner::CliContext;
|
||||
use reth_config::Config;
|
||||
use reth_db::{init_db, DatabaseEnv};
|
||||
use reth_interfaces::consensus::Consensus;
|
||||
|
||||
@ -6,10 +6,10 @@ use crate::{
|
||||
DatabaseArgs, DebugArgs, DevArgs, NetworkArgs, PayloadBuilderArgs, PruningArgs,
|
||||
RpcServerArgs, TxPoolArgs,
|
||||
},
|
||||
core::cli::runner::CliContext,
|
||||
dirs::{DataDirPath, MaybePlatformPath},
|
||||
};
|
||||
use clap::{value_parser, Args, Parser};
|
||||
use reth_cli_runner::CliContext;
|
||||
use reth_db::{init_db, DatabaseEnv};
|
||||
use reth_node_builder::{InitState, NodeBuilder, WithLaunchContext};
|
||||
use reth_node_core::{node_config::NodeConfig, version};
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
//! `reth recover` command.
|
||||
|
||||
use crate::core::cli::runner::CliContext;
|
||||
use clap::{Parser, Subcommand};
|
||||
use reth_cli_runner::CliContext;
|
||||
|
||||
mod storage_tries;
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
use crate::{
|
||||
args::utils::{chain_help, genesis_value_parser, SUPPORTED_CHAINS},
|
||||
core::cli::runner::CliContext,
|
||||
dirs::{DataDirPath, MaybePlatformPath},
|
||||
};
|
||||
use clap::Parser;
|
||||
use reth_cli_runner::CliContext;
|
||||
use reth_db::{
|
||||
cursor::{DbCursorRO, DbDupCursorRW},
|
||||
init_db, tables,
|
||||
|
||||
@ -158,6 +158,10 @@ pub mod rpc {
|
||||
}
|
||||
}
|
||||
|
||||
// re-export for convenience
|
||||
#[doc(inline)]
|
||||
pub use reth_cli_runner::{tokio_runtime, CliContext, CliRunner};
|
||||
|
||||
#[cfg(all(unix, any(target_env = "gnu", target_os = "macos")))]
|
||||
pub mod sigsegv_handler;
|
||||
|
||||
|
||||
22
crates/cli/runner/Cargo.toml
Normal file
22
crates/cli/runner/Cargo.toml
Normal file
@ -0,0 +1,22 @@
|
||||
[package]
|
||||
name = "reth-cli-runner"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
license.workspace = true
|
||||
homepage.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
# reth
|
||||
reth-tasks.workspace = true
|
||||
|
||||
# async
|
||||
futures.workspace = true
|
||||
tokio = { workspace = true, features = ["macros", "rt-multi-thread", "signal"] }
|
||||
|
||||
# misc
|
||||
tracing.workspace = true
|
||||
@ -1,3 +1,13 @@
|
||||
//! A tokio based CLI runner.
|
||||
|
||||
#![doc(
|
||||
html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
|
||||
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
|
||||
issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/"
|
||||
)]
|
||||
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||
|
||||
//! Entrypoint for running commands.
|
||||
|
||||
use futures::pin_mut;
|
||||
@ -6,6 +16,8 @@ use std::future::Future;
|
||||
use tracing::{debug, error, trace};
|
||||
|
||||
/// Executes CLI commands.
|
||||
///
|
||||
/// Provides utilities for running a cli command to completion.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
#[non_exhaustive]
|
||||
pub struct CliRunner;
|
||||
@ -1,4 +1,3 @@
|
||||
//! Additional CLI configuration support.
|
||||
|
||||
pub mod config;
|
||||
pub mod runner;
|
||||
|
||||
Reference in New Issue
Block a user