mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: exex crate (#7506)
This commit is contained in:
@ -16,6 +16,7 @@ workspace = true
|
||||
reth-auto-seal-consensus.workspace = true
|
||||
reth-beacon-consensus.workspace = true
|
||||
reth-blockchain-tree.workspace = true
|
||||
reth-exex.workspace = true
|
||||
reth-provider.workspace = true
|
||||
reth-revm.workspace = true
|
||||
reth-db.workspace = true
|
||||
|
||||
@ -7,7 +7,7 @@ use crate::{
|
||||
ComponentsBuilder, FullNodeComponents, FullNodeComponentsAdapter, NodeComponents,
|
||||
NodeComponentsBuilder, PoolBuilder,
|
||||
},
|
||||
exex::{BoxedLaunchExEx, ExExContext},
|
||||
exex::BoxedLaunchExEx,
|
||||
hooks::NodeHooks,
|
||||
node::FullNode,
|
||||
rpc::{RethRpcServerHandles, RpcContext, RpcHooks},
|
||||
@ -28,6 +28,7 @@ use reth_db::{
|
||||
test_utils::{create_test_rw_db, TempDatabase},
|
||||
DatabaseEnv,
|
||||
};
|
||||
use reth_exex::ExExContext;
|
||||
use reth_interfaces::p2p::either::EitherDownloader;
|
||||
use reth_network::{NetworkBuilder, NetworkConfig, NetworkEvents, NetworkHandle};
|
||||
use reth_node_api::{FullNodeTypes, FullNodeTypesAdapter, NodeTypes};
|
||||
|
||||
@ -25,49 +25,14 @@
|
||||
//! `block_number >= 0`.
|
||||
//!
|
||||
//! [`Future`]: std::future::Future
|
||||
//! [`ExExContext`]: crate::exex::ExExContext
|
||||
//! [`ExExContext`]: reth_exex::ExExContext
|
||||
//! [`CanonStateNotification`]: reth_provider::CanonStateNotification
|
||||
|
||||
use crate::FullNodeTypes;
|
||||
use futures::{future::BoxFuture, FutureExt};
|
||||
use reth_node_core::{
|
||||
dirs::{ChainPath, DataDirPath},
|
||||
node_config::NodeConfig,
|
||||
};
|
||||
use reth_primitives::{BlockNumber, Head};
|
||||
use reth_tasks::TaskExecutor;
|
||||
use reth_exex::ExExContext;
|
||||
use std::future::Future;
|
||||
|
||||
/// Events emitted by an ExEx.
|
||||
#[derive(Debug)]
|
||||
pub enum ExExEvent {
|
||||
/// Highest block processed by the ExEx.
|
||||
///
|
||||
/// The ExEx must guarantee that it will not require all earlier blocks in the future, meaning
|
||||
/// that Reth is allowed to prune them.
|
||||
///
|
||||
/// On reorgs, it's possible for the height to go down.
|
||||
FinishedHeight(BlockNumber),
|
||||
}
|
||||
|
||||
/// Captures the context that an ExEx has access to.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ExExContext<Node: FullNodeTypes> {
|
||||
/// The current head of the blockchain at launch.
|
||||
pub head: Head,
|
||||
/// The configured provider to interact with the blockchain.
|
||||
pub provider: Node::Provider,
|
||||
/// The task executor of the node.
|
||||
pub task_executor: TaskExecutor,
|
||||
/// The data dir of the node.
|
||||
pub data_dir: ChainPath<DataDirPath>,
|
||||
/// The config of the node
|
||||
pub config: NodeConfig,
|
||||
/// The loaded node config
|
||||
pub reth_config: reth_config::Config,
|
||||
// TODO(alexey): add pool, payload builder, anything else?
|
||||
}
|
||||
|
||||
/// A trait for launching an ExEx.
|
||||
trait LaunchExEx<Node: FullNodeTypes>: Send {
|
||||
/// Launches the ExEx.
|
||||
|
||||
Reference in New Issue
Block a user