mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
Moving more types from reth crate to node core crate (#6102)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -56,6 +56,7 @@ reth-trie.workspace = true
|
||||
reth-nippy-jar.workspace = true
|
||||
reth-node-api.workspace = true
|
||||
reth-node-builder.workspace = true
|
||||
reth-node-core.workspace = true
|
||||
|
||||
# crypto
|
||||
alloy-rlp.workspace = true
|
||||
@ -159,6 +160,7 @@ optimism = [
|
||||
"reth-ethereum-payload-builder/optimism",
|
||||
"reth-node-api/optimism",
|
||||
"reth-node-builder/optimism",
|
||||
"reth-node-core/optimism",
|
||||
]
|
||||
|
||||
# no-op feature flag for switching between the `optimism` and default functionality in CI matrices
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
//! Support for customizing the node
|
||||
|
||||
use super::cli::{components::RethRpcServerHandles, ext::DefaultRethNodeCommandConfig};
|
||||
use crate::{
|
||||
args::{
|
||||
@ -63,6 +64,7 @@ use reth_network_api::{NetworkInfo, PeersInfo};
|
||||
use reth_node_builder::EthEngineTypes;
|
||||
#[cfg(feature = "optimism")]
|
||||
use reth_node_builder::OptimismEngineTypes;
|
||||
|
||||
use reth_payload_builder::PayloadBuilderHandle;
|
||||
use reth_primitives::{
|
||||
constants::eip4844::{LoadKzgSettingsError, MAINNET_KZG_TRUSTED_SETUP},
|
||||
@ -1401,9 +1403,10 @@ impl NodeHandle {
|
||||
/// let (_handle, _manager) = spawn_node(builder).await.unwrap();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
pub async fn spawn_node(config: NodeConfig) -> eyre::Result<(NodeHandle, TaskManager)> {
|
||||
let task_manager = TaskManager::current();
|
||||
let ext = DefaultRethNodeCommandConfig;
|
||||
let ext = DefaultRethNodeCommandConfig::default();
|
||||
Ok((config.launch::<()>(ext, task_manager.executor()).await?, task_manager))
|
||||
}
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ impl RethCliExt for () {
|
||||
}
|
||||
|
||||
/// A trait that allows for extending and customizing parts of the node command
|
||||
/// [NodeCommand](crate::commands::node::NodeCommand).
|
||||
/// [NodeCommand](crate::cli::node::NodeCommand).
|
||||
///
|
||||
/// The functions are invoked during the initialization of the node command in the following order:
|
||||
///
|
||||
@ -185,7 +185,7 @@ pub trait RethNodeCommandExt: RethNodeCommandConfig + fmt::Debug + clap::Args {}
|
||||
impl<T> RethNodeCommandExt for T where T: RethNodeCommandConfig + fmt::Debug + clap::Args {}
|
||||
|
||||
/// The default configuration for the reth node command
|
||||
/// [Command](crate::commands::node::NodeCommand).
|
||||
/// [Command](crate::cli::node::NodeCommand).
|
||||
///
|
||||
/// This is a convenience type for [NoArgs<()>].
|
||||
#[derive(Debug, Clone, Copy, Default, Args)]
|
||||
@ -208,7 +208,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::commands::node::NodeCommand).
|
||||
/// the [NodeCommand](crate::cli::node::NodeCommand).
|
||||
#[derive(Debug, Clone, Copy, Default, Args)]
|
||||
pub struct NoArgs<T = ()> {
|
||||
#[clap(skip)]
|
||||
|
||||
@ -21,7 +21,6 @@ pub mod components;
|
||||
pub mod config;
|
||||
pub mod db_type;
|
||||
pub mod ext;
|
||||
|
||||
/// The main reth cli interface.
|
||||
///
|
||||
/// This is the entrypoint to the executable.
|
||||
|
||||
@ -7,13 +7,13 @@ use std::{
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use crate::utils::DbTool;
|
||||
use clap::Parser;
|
||||
|
||||
use crate::{
|
||||
args::DatabaseArgs,
|
||||
dirs::{DataDirPath, PlatformPath},
|
||||
utils::DbTool,
|
||||
};
|
||||
use clap::Parser;
|
||||
|
||||
use reth_db::{
|
||||
cursor::DbCursorRO, database::Database, open_db_read_only, table::Table, transaction::DbTx,
|
||||
AccountChangeSet, AccountHistory, AccountsTrie, BlockBodyIndices, BlockOmmers,
|
||||
|
||||
@ -1,13 +1,6 @@
|
||||
//! Command for debugging block building.
|
||||
|
||||
use crate::{
|
||||
args::{
|
||||
utils::{chain_help, genesis_value_parser, SUPPORTED_CHAINS},
|
||||
DatabaseArgs,
|
||||
},
|
||||
dirs::{DataDirPath, MaybePlatformPath},
|
||||
runner::CliContext,
|
||||
};
|
||||
use crate::runner::CliContext;
|
||||
use alloy_rlp::Decodable;
|
||||
use clap::Parser;
|
||||
use eyre::Context;
|
||||
@ -47,6 +40,13 @@ use reth_transaction_pool::{
|
||||
use std::{path::PathBuf, str::FromStr, sync::Arc};
|
||||
use tracing::*;
|
||||
|
||||
use crate::{
|
||||
args::{
|
||||
utils::{chain_help, genesis_value_parser, SUPPORTED_CHAINS},
|
||||
DatabaseArgs,
|
||||
},
|
||||
dirs::{DataDirPath, MaybePlatformPath},
|
||||
};
|
||||
#[cfg(not(feature = "optimism"))]
|
||||
use reth_payload_builder::EthPayloadBuilderAttributes;
|
||||
|
||||
|
||||
@ -27,6 +27,7 @@ use reth_interfaces::{
|
||||
};
|
||||
use reth_network::{NetworkEvents, NetworkHandle};
|
||||
use reth_network_api::NetworkInfo;
|
||||
|
||||
use reth_primitives::{fs, stage::StageId, BlockHashOrNumber, BlockNumber, ChainSpec, B256};
|
||||
use reth_provider::{BlockExecutionWriter, HeaderSyncMode, ProviderFactory, StageCheckpointReader};
|
||||
use reth_stages::{
|
||||
|
||||
@ -18,6 +18,7 @@ use reth_db::{cursor::DbCursorRO, init_db, tables, transaction::DbTx, DatabaseEn
|
||||
use reth_interfaces::{consensus::Consensus, p2p::full_block::FullBlockClient};
|
||||
use reth_network::NetworkHandle;
|
||||
use reth_network_api::NetworkInfo;
|
||||
|
||||
use reth_primitives::{
|
||||
fs,
|
||||
stage::{StageCheckpoint, StageId},
|
||||
|
||||
@ -1,12 +1,7 @@
|
||||
//! 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,
|
||||
version::SHORT_VERSION,
|
||||
};
|
||||
@ -31,6 +26,14 @@ use std::{path::PathBuf, sync::Arc};
|
||||
use tokio::sync::watch;
|
||||
use tracing::{debug, info};
|
||||
|
||||
use crate::{
|
||||
args::{
|
||||
utils::{chain_help, genesis_value_parser, SUPPORTED_CHAINS},
|
||||
DatabaseArgs,
|
||||
},
|
||||
dirs::{DataDirPath, MaybePlatformPath},
|
||||
};
|
||||
|
||||
/// Syncs RLP encoded blocks from a file.
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct ImportCommand {
|
||||
|
||||
@ -1,18 +1,19 @@
|
||||
//! Command that initializes the node from a genesis file.
|
||||
|
||||
use crate::init::init_genesis;
|
||||
use clap::Parser;
|
||||
use reth_db::init_db;
|
||||
use reth_primitives::ChainSpec;
|
||||
use std::sync::Arc;
|
||||
use tracing::info;
|
||||
|
||||
use crate::{
|
||||
args::{
|
||||
utils::{chain_help, genesis_value_parser, SUPPORTED_CHAINS},
|
||||
DatabaseArgs,
|
||||
},
|
||||
dirs::{DataDirPath, MaybePlatformPath},
|
||||
init::init_genesis,
|
||||
};
|
||||
use clap::Parser;
|
||||
use reth_db::init_db;
|
||||
use reth_primitives::ChainSpec;
|
||||
use std::sync::Arc;
|
||||
use tracing::info;
|
||||
|
||||
/// Initializes the database with the genesis block.
|
||||
#[derive(Debug, Parser)]
|
||||
|
||||
@ -2,6 +2,15 @@
|
||||
//!
|
||||
//! Starts the client
|
||||
|
||||
use clap::{value_parser, Parser};
|
||||
use reth_auto_seal_consensus::AutoSealConsensus;
|
||||
use reth_beacon_consensus::BeaconConsensus;
|
||||
use reth_interfaces::consensus::Consensus;
|
||||
use reth_primitives::ChainSpec;
|
||||
use std::{net::SocketAddr, path::PathBuf, sync::Arc};
|
||||
|
||||
pub mod cl_events;
|
||||
pub mod events;
|
||||
use crate::{
|
||||
args::{
|
||||
utils::{chain_help, genesis_value_parser, parse_socket_address, SUPPORTED_CHAINS},
|
||||
@ -13,15 +22,6 @@ use crate::{
|
||||
dirs::{DataDirPath, MaybePlatformPath},
|
||||
runner::CliContext,
|
||||
};
|
||||
use clap::{value_parser, Parser};
|
||||
use reth_auto_seal_consensus::AutoSealConsensus;
|
||||
use reth_beacon_consensus::BeaconConsensus;
|
||||
use reth_interfaces::consensus::Consensus;
|
||||
use reth_primitives::ChainSpec;
|
||||
use std::{net::SocketAddr, path::PathBuf, sync::Arc};
|
||||
|
||||
pub mod cl_events;
|
||||
pub mod events;
|
||||
|
||||
/// Start the node
|
||||
#[derive(Debug, Parser)]
|
||||
|
||||
@ -4,6 +4,11 @@ use crate::{
|
||||
dirs::{DataDirPath, MaybePlatformPath},
|
||||
utils::DbTool,
|
||||
};
|
||||
|
||||
use crate::args::{
|
||||
utils::{chain_help, genesis_value_parser, SUPPORTED_CHAINS},
|
||||
DatabaseArgs,
|
||||
};
|
||||
use clap::Parser;
|
||||
use reth_db::{
|
||||
cursor::DbCursorRO, database::Database, init_db, table::TableImporter, tables,
|
||||
@ -23,10 +28,6 @@ mod execution;
|
||||
use execution::dump_execution_stage;
|
||||
|
||||
mod merkle;
|
||||
use crate::args::{
|
||||
utils::{chain_help, genesis_value_parser, SUPPORTED_CHAINS},
|
||||
DatabaseArgs,
|
||||
};
|
||||
use merkle::dump_merkle_stage;
|
||||
|
||||
/// `reth dump-stage` command
|
||||
|
||||
@ -17,6 +17,7 @@ use reth_beacon_consensus::BeaconConsensus;
|
||||
use reth_config::Config;
|
||||
use reth_db::init_db;
|
||||
use reth_downloaders::bodies::bodies::BodiesDownloaderBuilder;
|
||||
|
||||
use reth_primitives::ChainSpec;
|
||||
use reth_provider::{ProviderFactory, StageCheckpointReader};
|
||||
use reth_stages::{
|
||||
|
||||
@ -1,5 +1,11 @@
|
||||
//! Unwinding a certain block range
|
||||
|
||||
use clap::{Parser, Subcommand};
|
||||
use reth_db::{cursor::DbCursorRO, database::Database, open_db, tables, transaction::DbTx};
|
||||
use reth_primitives::{BlockHashOrNumber, ChainSpec};
|
||||
use reth_provider::{BlockExecutionWriter, ProviderFactory};
|
||||
use std::{ops::RangeInclusive, sync::Arc};
|
||||
|
||||
use crate::{
|
||||
args::{
|
||||
utils::{chain_help, genesis_value_parser, SUPPORTED_CHAINS},
|
||||
@ -7,12 +13,6 @@ use crate::{
|
||||
},
|
||||
dirs::{DataDirPath, MaybePlatformPath},
|
||||
};
|
||||
use clap::{Parser, Subcommand};
|
||||
use reth_db::{cursor::DbCursorRO, database::Database, open_db, tables, transaction::DbTx};
|
||||
use reth_primitives::{BlockHashOrNumber, ChainSpec};
|
||||
use reth_provider::{BlockExecutionWriter, ProviderFactory};
|
||||
use std::{ops::RangeInclusive, sync::Arc};
|
||||
|
||||
/// `reth stage unwind` command
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct Command {
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/"
|
||||
)]
|
||||
#![allow(missing_debug_implementations)]
|
||||
#![allow(dead_code)]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||
|
||||
pub mod args;
|
||||
@ -44,6 +45,11 @@ pub mod payload {
|
||||
pub use reth_payload_validator::ExecutionPayloadValidator;
|
||||
}
|
||||
|
||||
/// Re-exported from `reth_node_core`.
|
||||
pub mod node_core {
|
||||
pub use reth_node_core::*;
|
||||
}
|
||||
|
||||
/// Re-exported from `reth_provider`.
|
||||
pub mod providers {
|
||||
pub use reth_provider::*;
|
||||
|
||||
Reference in New Issue
Block a user