mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
integrate FullNodeComponents in exexcomponents (#8051)
This commit is contained in:
committed by
GitHub
parent
29be4072cb
commit
9eb7d961d7
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -6910,8 +6910,10 @@ dependencies = [
|
|||||||
"metrics",
|
"metrics",
|
||||||
"reth-config",
|
"reth-config",
|
||||||
"reth-metrics",
|
"reth-metrics",
|
||||||
|
"reth-network",
|
||||||
"reth-node-api",
|
"reth-node-api",
|
||||||
"reth-node-core",
|
"reth-node-core",
|
||||||
|
"reth-payload-builder",
|
||||||
"reth-primitives",
|
"reth-primitives",
|
||||||
"reth-provider",
|
"reth-provider",
|
||||||
"reth-tasks",
|
"reth-tasks",
|
||||||
|
|||||||
@ -21,6 +21,8 @@ reth-primitives.workspace = true
|
|||||||
reth-provider.workspace = true
|
reth-provider.workspace = true
|
||||||
reth-tasks.workspace = true
|
reth-tasks.workspace = true
|
||||||
reth-tracing.workspace = true
|
reth-tracing.workspace = true
|
||||||
|
reth-network.workspace = true
|
||||||
|
reth-payload-builder.workspace = true
|
||||||
|
|
||||||
## async
|
## async
|
||||||
tokio.workspace = true
|
tokio.workspace = true
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
use reth_node_api::FullNodeComponents;
|
use reth_node_api::{FullNodeComponents, FullNodeTypes, NodeTypes};
|
||||||
use reth_node_core::{
|
use reth_node_core::{
|
||||||
dirs::{ChainPath, DataDirPath},
|
dirs::{ChainPath, DataDirPath},
|
||||||
node_config::NodeConfig,
|
node_config::NodeConfig,
|
||||||
@ -14,18 +14,12 @@ use crate::{ExExEvent, ExExNotification};
|
|||||||
pub struct ExExContext<Node: FullNodeComponents> {
|
pub struct ExExContext<Node: FullNodeComponents> {
|
||||||
/// The current head of the blockchain at launch.
|
/// The current head of the blockchain at launch.
|
||||||
pub head: Head,
|
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.
|
/// The data dir of the node.
|
||||||
pub data_dir: ChainPath<DataDirPath>,
|
pub data_dir: ChainPath<DataDirPath>,
|
||||||
/// The config of the node
|
/// The config of the node
|
||||||
pub config: NodeConfig,
|
pub config: NodeConfig,
|
||||||
/// The loaded node config
|
/// The loaded node config
|
||||||
pub reth_config: reth_config::Config,
|
pub reth_config: reth_config::Config,
|
||||||
/// The transaction pool of the node.
|
|
||||||
pub pool: Node::Pool,
|
|
||||||
/// Channel used to send [`ExExEvent`]s to the rest of the node.
|
/// Channel used to send [`ExExEvent`]s to the rest of the node.
|
||||||
///
|
///
|
||||||
/// # Important
|
/// # Important
|
||||||
@ -41,4 +35,46 @@ pub struct ExExContext<Node: FullNodeComponents> {
|
|||||||
/// Once a an [`ExExNotification`] is sent over the channel, it is considered delivered by the
|
/// Once a an [`ExExNotification`] is sent over the channel, it is considered delivered by the
|
||||||
/// node.
|
/// node.
|
||||||
pub notifications: Receiver<ExExNotification>,
|
pub notifications: Receiver<ExExNotification>,
|
||||||
|
|
||||||
|
/// node components
|
||||||
|
pub components: Node,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<Node: FullNodeComponents> NodeTypes for ExExContext<Node> {
|
||||||
|
type Primitives = Node::Primitives;
|
||||||
|
type Engine = Node::Engine;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<Node: FullNodeComponents> FullNodeTypes for ExExContext<Node> {
|
||||||
|
type DB = Node::DB;
|
||||||
|
type Provider = Node::Provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<Node: FullNodeComponents> FullNodeComponents for ExExContext<Node> {
|
||||||
|
type Pool = Node::Pool;
|
||||||
|
type Evm = Node::Evm;
|
||||||
|
|
||||||
|
fn pool(&self) -> &Self::Pool {
|
||||||
|
self.components.pool()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn provider(&self) -> &Self::Provider {
|
||||||
|
self.components.provider()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn network(&self) -> &reth_network::NetworkHandle {
|
||||||
|
self.components.network()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn payload_builder(&self) -> &reth_payload_builder::PayloadBuilderHandle<Self::Engine> {
|
||||||
|
self.components.payload_builder()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn task_executor(&self) -> &TaskExecutor {
|
||||||
|
self.components.task_executor()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn evm_config(&self) -> &Self::Evm {
|
||||||
|
self.components.evm_config()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -196,12 +196,10 @@ where
|
|||||||
// create the launch context for the exex
|
// create the launch context for the exex
|
||||||
let context = ExExContext {
|
let context = ExExContext {
|
||||||
head,
|
head,
|
||||||
provider: blockchain_db.clone(),
|
|
||||||
task_executor: ctx.task_executor().clone(),
|
|
||||||
data_dir: ctx.data_dir().clone(),
|
data_dir: ctx.data_dir().clone(),
|
||||||
config: ctx.node_config().clone(),
|
config: ctx.node_config().clone(),
|
||||||
reth_config: ctx.toml_config().clone(),
|
reth_config: ctx.toml_config().clone(),
|
||||||
pool: node_adapter.components.pool().clone(),
|
components: node_adapter.clone(),
|
||||||
events,
|
events,
|
||||||
notifications,
|
notifications,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user