added BeaconConsensusEngineHandle to RpcHandle (#14348)

This commit is contained in:
Poulav Bhowmick
2025-02-10 03:44:23 +05:30
committed by GitHub
parent 21370c3911
commit d57535caad
2 changed files with 19 additions and 5 deletions

View File

@ -282,7 +282,7 @@ where
), ),
); );
let RpcHandle { rpc_server_handles, rpc_registry, engine_events } = let RpcHandle { rpc_server_handles, rpc_registry, engine_events, beacon_engine_handle } =
add_ons.launch_add_ons(add_ons_ctx).await?; add_ons.launch_add_ons(add_ons_ctx).await?;
// TODO: migrate to devmode with https://github.com/paradigmxyz/reth/issues/10104 // TODO: migrate to devmode with https://github.com/paradigmxyz/reth/issues/10104
@ -406,7 +406,12 @@ where
task_executor: ctx.task_executor().clone(), task_executor: ctx.task_executor().clone(),
config: ctx.node_config().clone(), config: ctx.node_config().clone(),
data_dir: ctx.data_dir().clone(), data_dir: ctx.data_dir().clone(),
add_ons_handle: RpcHandle { rpc_server_handles, rpc_registry, engine_events }, add_ons_handle: RpcHandle {
rpc_server_handles,
rpc_registry,
engine_events,
beacon_engine_handle,
},
}; };
// Notify on node started // Notify on node started
on_node_started.on_event(FullNode::clone(&full_node))?; on_node_started.on_event(FullNode::clone(&full_node))?;

View File

@ -7,7 +7,7 @@ use std::{
ops::{Deref, DerefMut}, ops::{Deref, DerefMut},
}; };
use crate::{BeaconConsensusEngineEvent, EthApiBuilderCtx}; use crate::{BeaconConsensusEngineEvent, BeaconConsensusEngineHandle, EthApiBuilderCtx};
use alloy_rpc_types::engine::ClientVersionV1; use alloy_rpc_types::engine::ClientVersionV1;
use futures::TryFutureExt; use futures::TryFutureExt;
use reth_node_api::{ use reth_node_api::{
@ -310,6 +310,9 @@ pub struct RpcHandle<Node: FullNodeComponents, EthApi: EthApiTypes> {
/// dispatch events /// dispatch events
pub engine_events: pub engine_events:
EventSender<BeaconConsensusEngineEvent<<Node::Types as NodeTypes>::Primitives>>, EventSender<BeaconConsensusEngineEvent<<Node::Types as NodeTypes>::Primitives>>,
/// Handle to the beacon consensus engine.
pub beacon_engine_handle:
BeaconConsensusEngineHandle<<Node::Types as NodeTypesWithEngine>::Engine>,
} }
impl<Node: FullNodeComponents, EthApi: EthApiTypes> Clone for RpcHandle<Node, EthApi> { impl<Node: FullNodeComponents, EthApi: EthApiTypes> Clone for RpcHandle<Node, EthApi> {
@ -318,6 +321,7 @@ impl<Node: FullNodeComponents, EthApi: EthApiTypes> Clone for RpcHandle<Node, Et
rpc_server_handles: self.rpc_server_handles.clone(), rpc_server_handles: self.rpc_server_handles.clone(),
rpc_registry: self.rpc_registry.clone(), rpc_registry: self.rpc_registry.clone(),
engine_events: self.engine_events.clone(), engine_events: self.engine_events.clone(),
beacon_engine_handle: self.beacon_engine_handle.clone(),
} }
} }
} }
@ -449,7 +453,7 @@ where
let engine_api = EngineApi::new( let engine_api = EngineApi::new(
node.provider().clone(), node.provider().clone(),
config.chain.clone(), config.chain.clone(),
beacon_engine_handle, beacon_engine_handle.clone(),
PayloadStore::new(node.payload_builder_handle().clone()), PayloadStore::new(node.payload_builder_handle().clone()),
node.pool().clone(), node.pool().clone(),
Box::new(node.task_executor().clone()), Box::new(node.task_executor().clone()),
@ -532,7 +536,12 @@ where
on_rpc_started.on_rpc_started(ctx, handles.clone())?; on_rpc_started.on_rpc_started(ctx, handles.clone())?;
Ok(RpcHandle { rpc_server_handles: handles, rpc_registry: registry, engine_events }) Ok(RpcHandle {
rpc_server_handles: handles,
rpc_registry: registry,
engine_events,
beacon_engine_handle,
})
} }
} }