mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat(l2-withdrawals): Define OpEngineApiBuilder (#14426)
This commit is contained in:
@ -23,6 +23,9 @@ pub use engine::OpEngineTypes;
|
||||
pub mod node;
|
||||
pub use node::{OpNetworkPrimitives, OpNode};
|
||||
|
||||
pub mod rpc;
|
||||
pub use rpc::OpEngineApiBuilder;
|
||||
|
||||
pub use reth_optimism_txpool as txpool;
|
||||
|
||||
/// Helpers for running test node instances.
|
||||
|
||||
@ -4,7 +4,7 @@ use crate::{
|
||||
args::RollupArgs,
|
||||
engine::OpEngineValidator,
|
||||
txpool::{OpTransactionPool, OpTransactionValidator},
|
||||
OpEngineTypes,
|
||||
OpEngineApiBuilder, OpEngineTypes,
|
||||
};
|
||||
use op_alloy_consensus::OpPooledTransaction;
|
||||
use reth_chainspec::{EthChainSpec, Hardforks};
|
||||
@ -202,7 +202,12 @@ impl NodeTypesWithEngine for OpNode {
|
||||
pub struct OpAddOns<N: FullNodeComponents> {
|
||||
/// Rpc add-ons responsible for launching the RPC servers and instantiating the RPC handlers
|
||||
/// and eth-api.
|
||||
pub rpc_add_ons: RpcAddOns<N, OpEthApi<N>, OpEngineValidatorBuilder>,
|
||||
pub rpc_add_ons: RpcAddOns<
|
||||
N,
|
||||
OpEthApi<N>,
|
||||
OpEngineValidatorBuilder,
|
||||
OpEngineApiBuilder<OpEngineValidatorBuilder>,
|
||||
>,
|
||||
/// Data availability configuration for the OP builder.
|
||||
pub da_config: OpDAConfig,
|
||||
}
|
||||
|
||||
40
crates/optimism/node/src/rpc.rs
Normal file
40
crates/optimism/node/src/rpc.rs
Normal file
@ -0,0 +1,40 @@
|
||||
//! RPC component builder
|
||||
|
||||
pub use reth_optimism_rpc::OpEngineApi;
|
||||
|
||||
use reth_chainspec::EthereumHardforks;
|
||||
use reth_node_api::{
|
||||
AddOnsContext, EngineTypes, ExecutionData, FullNodeComponents, NodeTypes, NodeTypesWithEngine,
|
||||
};
|
||||
use reth_node_builder::rpc::{BasicEngineApiBuilder, EngineApiBuilder, EngineValidatorBuilder};
|
||||
|
||||
/// Builder for basic [`OpEngineApi`] implementation.
|
||||
#[derive(Debug, Default)]
|
||||
pub struct OpEngineApiBuilder<EV> {
|
||||
inner: BasicEngineApiBuilder<EV>,
|
||||
}
|
||||
|
||||
impl<N, EV> EngineApiBuilder<N> for OpEngineApiBuilder<EV>
|
||||
where
|
||||
N: FullNodeComponents<
|
||||
Types: NodeTypesWithEngine<
|
||||
ChainSpec: EthereumHardforks,
|
||||
Engine: EngineTypes<ExecutionData = ExecutionData>,
|
||||
>,
|
||||
>,
|
||||
EV: EngineValidatorBuilder<N>,
|
||||
{
|
||||
type EngineApi = OpEngineApi<
|
||||
N::Provider,
|
||||
<N::Types as NodeTypesWithEngine>::Engine,
|
||||
N::Pool,
|
||||
EV::Validator,
|
||||
<N::Types as NodeTypes>::ChainSpec,
|
||||
>;
|
||||
|
||||
async fn build_engine_api(self, ctx: &AddOnsContext<'_, N>) -> eyre::Result<Self::EngineApi> {
|
||||
let inner = self.inner.build_engine_api(ctx).await?;
|
||||
|
||||
Ok(OpEngineApi::new(inner))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user