diff --git a/crates/node-builder/src/components/payload.rs b/crates/node-builder/src/components/payload.rs index 4a92e4b88..7c50299bc 100644 --- a/crates/node-builder/src/components/payload.rs +++ b/crates/node-builder/src/components/payload.rs @@ -9,7 +9,7 @@ use std::future::Future; pub trait PayloadServiceBuilder: Send { /// Spawns the payload service and returns the handle to it. /// - /// The [BuilderContext] is provided to allow give to access the node's configuration. + /// The [BuilderContext] is provided to allow access to the node's configuration. fn spawn_payload_service( self, ctx: &BuilderContext, diff --git a/crates/node-builder/src/node.rs b/crates/node-builder/src/node.rs index 226dab0f4..564997b6f 100644 --- a/crates/node-builder/src/node.rs +++ b/crates/node-builder/src/node.rs @@ -36,11 +36,11 @@ pub trait Node: NodeTypes + Clone { /// The type that configures stateless node types, the node's primitive types. pub trait NodeTypes: Send + Sync + 'static { - /// The node's primitive types. + /// The node's primitive types, defining basic operations and structures. type Primitives: NodePrimitives; - /// The node's engine types. + /// The node's engine types, defining the interaction with the consensus engine. type Engine: EngineTypes; - /// The node's evm configuration. + /// The node's EVM configuration, defining settings for the Ethereum Virtual Machine. type Evm: ConfigureEvm; /// Returns the node's evm config. diff --git a/crates/node-core/src/events/node.rs b/crates/node-core/src/events/node.rs index bac061935..a43aa3104 100644 --- a/crates/node-core/src/events/node.rs +++ b/crates/node-core/src/events/node.rs @@ -28,7 +28,10 @@ use tracing::{debug, info, warn}; /// Interval of reporting node state. const INFO_MESSAGE_INTERVAL: Duration = Duration::from_secs(25); -/// The current high-level state of the node. +/// The current high-level state of the node, including the node's database environemt, network +/// connections, current processing stage, and the latest block information. It provides +/// methods to handle different types of events that affect the node's state, such as pipeline +/// events, network events, and consensus engine events. struct NodeState { /// Database environment. /// Used for freelist calculation reported in the "Status" log message. diff --git a/crates/node-core/src/node_config.rs b/crates/node-core/src/node_config.rs index 8991d860e..69bc05e9e 100644 --- a/crates/node-core/src/node_config.rs +++ b/crates/node-core/src/node_config.rs @@ -403,7 +403,48 @@ impl NodeConfig { Ok(builder) } - /// Build the blockchain tree + /// Builds the blockchain tree for the node. + /// + /// This method configures the blockchain tree, which is a critical component of the node, + /// responsible for managing the blockchain state, including blocks, transactions, and receipts. + /// It integrates with the consensus mechanism and the EVM for executing transactions. + /// + /// # Parameters + /// - `provider_factory`: A factory for creating various blockchain-related providers, such as + /// for accessing the database or static files. + /// - `consensus`: The consensus configuration, which defines how the node reaches agreement on + /// the blockchain state with other nodes. + /// - `prune_config`: Configuration for pruning old blockchain data. This helps in managing the + /// storage space efficiently. It's important to validate this configuration to ensure it does + /// not lead to unintended data loss. + /// - `sync_metrics_tx`: A transmitter for sending synchronization metrics. This is used for + /// monitoring the node's synchronization process with the blockchain network. + /// - `tree_config`: Configuration for the blockchain tree, including any parameters that affect + /// its structure or performance. + /// - `evm_config`: The EVM (Ethereum Virtual Machine) configuration, which affects how smart + /// contracts and transactions are executed. Proper validation of this configuration is + /// crucial for the correct execution of transactions. + /// + /// # Returns + /// A `ShareableBlockchainTree` instance, which provides access to the blockchain state and + /// supports operations like block insertion, state reversion, and transaction execution. + /// + /// # Example + /// ```rust,ignore + /// let tree = config.build_blockchain_tree( + /// provider_factory, + /// consensus, + /// prune_config, + /// sync_metrics_tx, + /// BlockchainTreeConfig::default(), + /// evm_config, + /// )?; + /// ``` + /// + /// # Note + /// Ensure that all configurations passed to this method are validated beforehand to prevent + /// runtime errors. Specifically, `prune_config` and `evm_config` should be checked to ensure + /// they meet the node's operational requirements. pub fn build_blockchain_tree( &self, provider_factory: ProviderFactory,