refactor: introduce BasicPayloadServiceBuilder (#14700)

This commit is contained in:
Arsenii Kulikov
2025-02-26 03:45:07 +04:00
committed by GitHub
parent 75ca54b790
commit 77aa17fb57
22 changed files with 142 additions and 162 deletions

View File

@@ -15,7 +15,8 @@ use reth_network::{EthNetworkPrimitives, NetworkHandle, PeersInfo};
use reth_node_api::{AddOnsContext, FullNodeComponents, NodeAddOns, TxTy};
use reth_node_builder::{
components::{
ComponentsBuilder, ConsensusBuilder, ExecutorBuilder, NetworkBuilder, PoolBuilder,
BasicPayloadServiceBuilder, ComponentsBuilder, ConsensusBuilder, ExecutorBuilder,
NetworkBuilder, PoolBuilder,
},
node::{FullNodeTypes, NodeTypes, NodeTypesWithEngine},
rpc::{EngineValidatorAddOn, EngineValidatorBuilder, RethRpcAddOns, RpcAddOns, RpcHandle},
@@ -46,7 +47,7 @@ impl EthereumNode {
pub fn components<Node>() -> ComponentsBuilder<
Node,
EthereumPoolBuilder,
EthereumPayloadBuilder,
BasicPayloadServiceBuilder<EthereumPayloadBuilder>,
EthereumNetworkBuilder,
EthereumExecutorBuilder,
EthereumConsensusBuilder,
@@ -62,7 +63,7 @@ impl EthereumNode {
ComponentsBuilder::default()
.node_types::<Node>()
.pool(EthereumPoolBuilder::default())
.payload(EthereumPayloadBuilder::default())
.payload(BasicPayloadServiceBuilder::default())
.network(EthereumNetworkBuilder::default())
.executor(EthereumExecutorBuilder::default())
.consensus(EthereumConsensusBuilder::default())
@@ -210,7 +211,7 @@ where
type ComponentsBuilder = ComponentsBuilder<
N,
EthereumPoolBuilder,
EthereumPayloadBuilder,
BasicPayloadServiceBuilder<EthereumPayloadBuilder>,
EthereumNetworkBuilder,
EthereumExecutorBuilder,
EthereumConsensusBuilder,

View File

@@ -10,7 +10,7 @@ use reth_evm::ConfigureEvmFor;
use reth_evm_ethereum::EthEvmConfig;
use reth_node_api::{FullNodeTypes, NodeTypesWithEngine, PrimitivesTy, TxTy};
use reth_node_builder::{
components::PayloadServiceBuilder, BuilderContext, PayloadBuilderConfig, PayloadTypes,
components::PayloadBuilderBuilder, BuilderContext, PayloadBuilderConfig, PayloadTypes,
};
use reth_transaction_pool::{PoolTransaction, TransactionPool};
@@ -23,7 +23,7 @@ impl EthereumPayloadBuilder {
/// A helper method initializing [`reth_ethereum_payload_builder::EthereumPayloadBuilder`] with
/// the given EVM config.
pub fn build<Types, Node, Evm, Pool>(
&self,
self,
evm_config: Evm,
ctx: &BuilderContext<Node>,
pool: Pool,
@@ -53,7 +53,7 @@ impl EthereumPayloadBuilder {
}
}
impl<Types, Node, Pool> PayloadServiceBuilder<Node, Pool> for EthereumPayloadBuilder
impl<Types, Node, Pool> PayloadBuilderBuilder<Node, Pool> for EthereumPayloadBuilder
where
Types: NodeTypesWithEngine<ChainSpec = ChainSpec, Primitives = EthPrimitives>,
Node: FullNodeTypes<Types = Types>,
@@ -70,7 +70,7 @@ where
reth_ethereum_payload_builder::EthereumPayloadBuilder<Pool, Node::Provider, EthEvmConfig>;
async fn build_payload_builder(
&self,
self,
ctx: &BuilderContext<Node>,
pool: Pool,
) -> eyre::Result<Self::PayloadBuilder> {

View File

@@ -30,6 +30,7 @@ reth-revm.workspace = true
reth-stages-api.workspace = true
reth-tasks.workspace = true
reth-tracing.workspace = true
reth-payload-builder.workspace = true
# alloy
alloy-consensus.workspace = true

View File

@@ -1,8 +1,11 @@
use crate::{ExExContextDyn, ExExEvent, ExExNotifications, ExExNotificationsStream};
use alloy_eips::BlockNumHash;
use reth_exex_types::ExExHead;
use reth_node_api::{FullNodeComponents, NodePrimitives, NodeTypes, PrimitivesTy};
use reth_node_api::{
FullNodeComponents, NodePrimitives, NodeTypes, NodeTypesWithEngine, PrimitivesTy,
};
use reth_node_core::node_config::NodeConfig;
use reth_payload_builder::PayloadBuilderHandle;
use reth_provider::BlockReader;
use reth_tasks::TaskExecutor;
use std::fmt::Debug;
@@ -100,8 +103,10 @@ where
}
/// Returns the handle to the payload builder service.
pub fn payload_builder(&self) -> &Node::PayloadBuilder {
self.components.payload_builder()
pub fn payload_builder_handle(
&self,
) -> &PayloadBuilderHandle<<Node::Types as NodeTypesWithEngine>::Engine> {
self.components.payload_builder_handle()
}
/// Returns the task executor.
@@ -159,7 +164,7 @@ mod tests {
self.ctx.block_executor();
self.ctx.provider();
self.ctx.network();
self.ctx.payload_builder();
self.ctx.payload_builder_handle();
self.ctx.task_executor();
self.ctx.set_notifications_without_head();
self.ctx.set_notifications_with_head(ExExHead { block: Default::default() });

View File

@@ -32,7 +32,6 @@ reth-provider = { workspace = true, features = ["test-utils"] }
reth-tasks.workspace = true
reth-transaction-pool = { workspace = true, features = ["test-utils"] }
reth-trie-db.workspace = true
reth-ethereum-payload-builder.workspace = true
## alloy
alloy-eips.workspace = true

View File

@@ -24,7 +24,6 @@ use reth_db::{
DatabaseEnv,
};
use reth_db_common::init::init_genesis;
use reth_ethereum_payload_builder::EthereumBuilderConfig;
use reth_evm::test_utils::MockExecutorProvider;
use reth_execution_types::Chain;
use reth_exex::{ExExContext, ExExEvent, ExExNotification, ExExNotifications, Wal};
@@ -35,8 +34,8 @@ use reth_node_api::{
};
use reth_node_builder::{
components::{
Components, ComponentsBuilder, ConsensusBuilder, ExecutorBuilder, NodeComponentsBuilder,
PoolBuilder,
BasicPayloadServiceBuilder, Components, ComponentsBuilder, ConsensusBuilder,
ExecutorBuilder, NodeComponentsBuilder, PoolBuilder,
},
BuilderContext, Node, NodeAdapter, RethFullAdapter,
};
@@ -143,7 +142,7 @@ where
type ComponentsBuilder = ComponentsBuilder<
N,
TestPoolBuilder,
EthereumPayloadBuilder,
BasicPayloadServiceBuilder<EthereumPayloadBuilder>,
EthereumNetworkBuilder,
TestExecutorBuilder,
TestConsensusBuilder,
@@ -156,7 +155,7 @@ where
ComponentsBuilder::default()
.node_types::<N>()
.pool(TestPoolBuilder::default())
.payload(EthereumPayloadBuilder::default())
.payload(BasicPayloadServiceBuilder::default())
.network(EthereumNetworkBuilder::default())
.executor(TestExecutorBuilder::default())
.consensus(TestConsensusBuilder::default())
@@ -288,13 +287,6 @@ pub async fn test_exex_context_with_chain_spec(
let task_executor = tasks.executor();
tasks.executor().spawn(network_manager);
let payload_builder = reth_ethereum_payload_builder::EthereumPayloadBuilder::new(
provider.clone(),
transaction_pool.clone(),
evm_config.clone(),
EthereumBuilderConfig::new(Default::default()),
);
let (_, payload_builder_handle) = NoopPayloadBuilderService::<EthEngineTypes>::new();
let components = NodeAdapter::<FullNodeTypesAdapter<_, _, _>, _> {
@@ -304,7 +296,6 @@ pub async fn test_exex_context_with_chain_spec(
executor,
consensus,
network,
payload_builder,
payload_builder_handle,
},
task_executor,

View File

@@ -82,9 +82,6 @@ pub trait FullNodeComponents: FullNodeTypes + Clone + 'static {
/// Network API.
type Network: FullNetwork;
/// Builds new blocks.
type PayloadBuilder: PayloadBuilderFor<Self::Types>;
/// Returns the transaction pool of the node.
fn pool(&self) -> &Self::Pool;
@@ -100,9 +97,6 @@ pub trait FullNodeComponents: FullNodeTypes + Clone + 'static {
/// Returns the handle to the network
fn network(&self) -> &Self::Network;
/// Returns the configured payload builder.
fn payload_builder(&self) -> &Self::PayloadBuilder;
/// Returns the handle to the payload builder service handling payload building requests from
/// the engine.
fn payload_builder_handle(

View File

@@ -93,7 +93,6 @@ impl<T: FullNodeTypes, C: NodeComponents<T>> FullNodeComponents for NodeAdapter<
type Executor = C::Executor;
type Consensus = C::Consensus;
type Network = C::Network;
type PayloadBuilder = C::PayloadBuilder;
fn pool(&self) -> &Self::Pool {
self.components.pool()
@@ -115,10 +114,6 @@ impl<T: FullNodeTypes, C: NodeComponents<T>> FullNodeComponents for NodeAdapter<
self.components.network()
}
fn payload_builder(&self) -> &Self::PayloadBuilder {
self.components.payload_builder()
}
fn payload_builder_handle(
&self,
) -> &reth_payload_builder::PayloadBuilderHandle<

View File

@@ -14,8 +14,6 @@ use reth_node_api::{BlockTy, BodyTy, HeaderTy, PrimitivesTy, TxTy};
use reth_transaction_pool::{PoolTransaction, TransactionPool};
use std::{future::Future, marker::PhantomData};
use super::PayloadBuilderFor;
/// A generic, general purpose and customizable [`NodeComponentsBuilder`] implementation.
///
/// This type is stateful and captures the configuration of the node's components.
@@ -325,7 +323,6 @@ where
ExecB::EVM,
ExecB::Executor,
ConsB::Consensus,
PayloadB::PayloadBuilder,
>;
async fn build_components(
@@ -334,7 +331,7 @@ where
) -> eyre::Result<Self::Components> {
let Self {
pool_builder,
payload_builder: payload_builder_builder,
payload_builder,
network_builder,
executor_builder: evm_builder,
consensus_builder,
@@ -344,17 +341,14 @@ where
let (evm_config, executor) = evm_builder.build_evm(context).await?;
let pool = pool_builder.build_pool(context).await?;
let network = network_builder.build_network(context, pool.clone()).await?;
let payload_builder =
payload_builder_builder.build_payload_builder(context, pool.clone()).await?;
let payload_builder_handle = payload_builder_builder
.spawn_payload_builder_service(context, payload_builder.clone())?;
let payload_builder_handle =
payload_builder.spawn_payload_builder_service(context, pool.clone()).await?;
let consensus = consensus_builder.build_consensus(context).await?;
Ok(Components {
transaction_pool: pool,
evm_config,
network,
payload_builder,
payload_builder_handle,
executor,
consensus,
@@ -395,7 +389,7 @@ pub trait NodeComponentsBuilder<Node: FullNodeTypes>: Send {
) -> impl Future<Output = eyre::Result<Self::Components>> + Send;
}
impl<Node, N, F, Fut, Pool, EVM, Executor, Cons, Payload> NodeComponentsBuilder<Node> for F
impl<Node, N, F, Fut, Pool, EVM, Executor, Cons> NodeComponentsBuilder<Node> for F
where
N: NetworkPrimitives<
BlockHeader = HeaderTy<Node::Types>,
@@ -404,8 +398,7 @@ where
>,
Node: FullNodeTypes,
F: FnOnce(&BuilderContext<Node>) -> Fut + Send,
Fut: Future<Output = eyre::Result<Components<Node, N, Pool, EVM, Executor, Cons, Payload>>>
+ Send,
Fut: Future<Output = eyre::Result<Components<Node, N, Pool, EVM, Executor, Cons>>> + Send,
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TxTy<Node::Types>>>
+ Unpin
+ 'static,
@@ -413,9 +406,8 @@ where
Executor: BlockExecutorProvider<Primitives = PrimitivesTy<Node::Types>>,
Cons:
FullConsensus<PrimitivesTy<Node::Types>, Error = ConsensusError> + Clone + Unpin + 'static,
Payload: PayloadBuilderFor<Node::Types> + Unpin + 'static,
{
type Components = Components<Node, N, Pool, EVM, Executor, Cons, Payload>;
type Components = Components<Node, N, Pool, EVM, Executor, Cons>;
fn build_components(
self,

View File

@@ -29,8 +29,7 @@ use reth_evm::execute::{BlockExecutionStrategyFactory, BlockExecutorProvider};
use reth_network::{NetworkHandle, NetworkPrimitives};
use reth_network_api::FullNetwork;
use reth_node_api::{
BlockTy, BodyTy, HeaderTy, NodeTypes, NodeTypesWithEngine, PayloadBuilderFor, PrimitivesTy,
TxTy,
BlockTy, BodyTy, HeaderTy, NodeTypes, NodeTypesWithEngine, PrimitivesTy, TxTy,
};
use reth_transaction_pool::{PoolTransaction, TransactionPool};
@@ -58,9 +57,6 @@ pub trait NodeComponents<T: FullNodeTypes>: Clone + Unpin + Send + Sync + 'stati
/// Network API.
type Network: FullNetwork<Client: BlockClient<Block = BlockTy<T::Types>>>;
/// Builds new blocks.
type PayloadBuilder: PayloadBuilderFor<T::Types> + Clone + Unpin + 'static;
/// Returns the transaction pool of the node.
fn pool(&self) -> &Self::Pool;
@@ -76,9 +72,6 @@ pub trait NodeComponents<T: FullNodeTypes>: Clone + Unpin + Send + Sync + 'stati
/// Returns the handle to the network
fn network(&self) -> &Self::Network;
/// Returns the payload builder that knows how to build blocks.
fn payload_builder(&self) -> &Self::PayloadBuilder;
/// Returns the handle to the payload builder service handling payload building requests from
/// the engine.
fn payload_builder_handle(
@@ -90,15 +83,7 @@ pub trait NodeComponents<T: FullNodeTypes>: Clone + Unpin + Send + Sync + 'stati
///
/// This provides access to all the components of the node.
#[derive(Debug)]
pub struct Components<
Node: FullNodeTypes,
N: NetworkPrimitives,
Pool,
EVM,
Executor,
Consensus,
Payload,
> {
pub struct Components<Node: FullNodeTypes, N: NetworkPrimitives, Pool, EVM, Executor, Consensus> {
/// The transaction pool of the node.
pub transaction_pool: Pool,
/// The node's EVM configuration, defining settings for the Ethereum Virtual Machine.
@@ -109,14 +94,12 @@ pub struct Components<
pub consensus: Consensus,
/// The network implementation of the node.
pub network: NetworkHandle<N>,
/// The payload builder.
pub payload_builder: Payload,
/// The handle to the payload builder service.
pub payload_builder_handle: PayloadBuilderHandle<<Node::Types as NodeTypesWithEngine>::Engine>,
}
impl<Node, Pool, EVM, Executor, Cons, N, Payload> NodeComponents<Node>
for Components<Node, N, Pool, EVM, Executor, Cons, Payload>
impl<Node, Pool, EVM, Executor, Cons, N> NodeComponents<Node>
for Components<Node, N, Pool, EVM, Executor, Cons>
where
Node: FullNodeTypes,
N: NetworkPrimitives<
@@ -131,14 +114,12 @@ where
Executor: BlockExecutorProvider<Primitives = PrimitivesTy<Node::Types>>,
Cons:
FullConsensus<PrimitivesTy<Node::Types>, Error = ConsensusError> + Clone + Unpin + 'static,
Payload: PayloadBuilderFor<Node::Types> + Clone + Unpin + 'static,
{
type Pool = Pool;
type Evm = EVM;
type Executor = Executor;
type Consensus = Cons;
type Network = NetworkHandle<N>;
type PayloadBuilder = Payload;
fn pool(&self) -> &Self::Pool {
&self.transaction_pool
@@ -160,10 +141,6 @@ where
&self.network
}
fn payload_builder(&self) -> &Self::PayloadBuilder {
&self.payload_builder
}
fn payload_builder_handle(
&self,
) -> &PayloadBuilderHandle<<Node::Types as NodeTypesWithEngine>::Engine> {
@@ -171,8 +148,7 @@ where
}
}
impl<Node, N, Pool, EVM, Executor, Cons, Payload> Clone
for Components<Node, N, Pool, EVM, Executor, Cons, Payload>
impl<Node, N, Pool, EVM, Executor, Cons> Clone for Components<Node, N, Pool, EVM, Executor, Cons>
where
N: NetworkPrimitives,
Node: FullNodeTypes,
@@ -180,7 +156,6 @@ where
EVM: ConfigureEvm,
Executor: BlockExecutorProvider,
Cons: Clone,
Payload: Clone,
{
fn clone(&self) -> Self {
Self {
@@ -189,7 +164,6 @@ where
executor: self.executor.clone(),
consensus: self.consensus.clone(),
network: self.network.clone(),
payload_builder: self.payload_builder.clone(),
payload_builder_handle: self.payload_builder_handle.clone(),
}
}

View File

@@ -10,18 +10,6 @@ use std::future::Future;
/// A type that knows how to spawn the payload service.
pub trait PayloadServiceBuilder<Node: FullNodeTypes, Pool: TransactionPool>: Send + Sized {
/// Payload builder implementation.
type PayloadBuilder: PayloadBuilderFor<Node::Types> + Unpin + 'static;
/// Spawns the payload service and returns the handle to it.
///
/// The [`BuilderContext`] is provided to allow access to the node's configuration.
fn build_payload_builder(
&self,
ctx: &BuilderContext<Node>,
pool: Pool,
) -> impl Future<Output = eyre::Result<Self::PayloadBuilder>> + Send;
/// Spawns the [`PayloadBuilderService`] and returns the handle to it for use by the engine.
///
/// We provide default implementation via [`BasicPayloadJobGenerator`] but it can be overridden
@@ -29,8 +17,73 @@ pub trait PayloadServiceBuilder<Node: FullNodeTypes, Pool: TransactionPool>: Sen
fn spawn_payload_builder_service(
self,
ctx: &BuilderContext<Node>,
payload_builder: Self::PayloadBuilder,
pool: Pool,
) -> impl Future<
Output = eyre::Result<PayloadBuilderHandle<<Node::Types as NodeTypesWithEngine>::Engine>>,
> + Send;
}
impl<Node, F, Fut, Pool> PayloadServiceBuilder<Node, Pool> for F
where
Node: FullNodeTypes,
Pool: TransactionPool,
F: Fn(&BuilderContext<Node>, Pool) -> Fut + Send,
Fut: Future<
Output = eyre::Result<
PayloadBuilderHandle<<Node::Types as NodeTypesWithEngine>::Engine>,
>,
> + Send,
{
fn spawn_payload_builder_service(
self,
ctx: &BuilderContext<Node>,
pool: Pool,
) -> impl Future<
Output = eyre::Result<PayloadBuilderHandle<<Node::Types as NodeTypesWithEngine>::Engine>>,
> {
self(ctx, pool)
}
}
/// A type that knows how to build a payload builder to plug into [`BasicPayloadServiceBuilder`].
pub trait PayloadBuilderBuilder<Node: FullNodeTypes, Pool: TransactionPool>: Send + Sized {
/// Payload builder implementation.
type PayloadBuilder: PayloadBuilderFor<Node::Types> + Unpin + 'static;
/// Spawns the payload service and returns the handle to it.
///
/// The [`BuilderContext`] is provided to allow access to the node's configuration.
fn build_payload_builder(
self,
ctx: &BuilderContext<Node>,
pool: Pool,
) -> impl Future<Output = eyre::Result<Self::PayloadBuilder>> + Send;
}
/// Basic payload service builder that spawns a [`BasicPayloadJobGenerator`]
#[derive(Debug, Default, Clone)]
pub struct BasicPayloadServiceBuilder<PB>(PB);
impl<PB> BasicPayloadServiceBuilder<PB> {
/// Create a new [`BasicPayloadServiceBuilder`].
pub fn new(payload_builder_builder: PB) -> Self {
Self(payload_builder_builder)
}
}
impl<Node, Pool, PB> PayloadServiceBuilder<Node, Pool> for BasicPayloadServiceBuilder<PB>
where
Node: FullNodeTypes,
Pool: TransactionPool,
PB: PayloadBuilderBuilder<Node, Pool>,
{
async fn spawn_payload_builder_service(
self,
ctx: &BuilderContext<Node>,
pool: Pool,
) -> eyre::Result<PayloadBuilderHandle<<Node::Types as NodeTypesWithEngine>::Engine>> {
let payload_builder = self.0.build_payload_builder(ctx, pool).await?;
let conf = ctx.config().builder.clone();
let payload_job_config = BasicPayloadJobGeneratorConfig::default()
@@ -52,22 +105,3 @@ pub trait PayloadServiceBuilder<Node: FullNodeTypes, Pool: TransactionPool>: Sen
Ok(payload_service_handle)
}
}
impl<Node, F, Fut, Pool, Builder> PayloadServiceBuilder<Node, Pool> for F
where
Node: FullNodeTypes,
Pool: TransactionPool,
F: Fn(&BuilderContext<Node>, Pool) -> Fut + Send,
Fut: Future<Output = eyre::Result<Builder>> + Send,
Builder: PayloadBuilderFor<Node::Types> + Unpin + 'static,
{
type PayloadBuilder = Builder;
fn build_payload_builder(
&self,
ctx: &BuilderContext<Node>,
pool: Pool,
) -> impl Future<Output = eyre::Result<Self::PayloadBuilder>> + Send {
self(ctx, pool)
}
}

View File

@@ -411,7 +411,6 @@ where
pool: ctx.components().pool().clone(),
network: ctx.components().network().clone(),
provider: ctx.node_adapter().provider.clone(),
payload_builder: ctx.components().payload_builder().clone(),
payload_builder_handle: ctx.components().payload_builder_handle().clone(),
task_executor: ctx.task_executor().clone(),
config: ctx.node_config().clone(),

View File

@@ -117,8 +117,6 @@ pub struct FullNode<Node: FullNodeComponents, AddOns: NodeAddOns<Node>> {
pub network: Node::Network,
/// Provider to interact with the node's database
pub provider: Node::Provider,
/// Node's configured payload builder.
pub payload_builder: Node::PayloadBuilder,
/// Handle to the node's payload builder service.
pub payload_builder_handle: PayloadBuilderHandle<<Node::Types as NodeTypesWithEngine>::Engine>,
/// Task executor for the node.
@@ -139,7 +137,6 @@ impl<Node: FullNodeComponents, AddOns: NodeAddOns<Node>> Clone for FullNode<Node
pool: self.pool.clone(),
network: self.network.clone(),
provider: self.provider.clone(),
payload_builder: self.payload_builder.clone(),
payload_builder_handle: self.payload_builder_handle.clone(),
task_executor: self.task_executor.clone(),
config: self.config.clone(),

View File

@@ -18,7 +18,7 @@ use reth_node_core::{
node_config::NodeConfig,
version::{CARGO_PKG_VERSION, CLIENT_CODE, NAME_CLIENT, VERGEN_GIT_SHA},
};
use reth_payload_builder::PayloadStore;
use reth_payload_builder::{PayloadBuilderHandle, PayloadStore};
use reth_provider::ChainSpecProvider;
use reth_rpc::{
eth::{EthApiTypes, FullEthApiServer},
@@ -293,8 +293,10 @@ where
}
/// Returns the handle to the payload builder service
pub fn payload_builder(&self) -> &Node::PayloadBuilder {
self.node.payload_builder()
pub fn payload_builder_handle(
&self,
) -> &PayloadBuilderHandle<<Node::Types as NodeTypesWithEngine>::Engine> {
self.node.payload_builder_handle()
}
}

View File

@@ -17,8 +17,8 @@ use reth_node_api::{
};
use reth_node_builder::{
components::{
ComponentsBuilder, ConsensusBuilder, ExecutorBuilder, NetworkBuilder,
PayloadServiceBuilder, PoolBuilder, PoolBuilderConfigOverrides,
BasicPayloadServiceBuilder, ComponentsBuilder, ConsensusBuilder, ExecutorBuilder,
NetworkBuilder, PayloadBuilderBuilder, PoolBuilder, PoolBuilderConfigOverrides,
},
node::{FullNodeTypes, NodeTypes, NodeTypesWithEngine},
rpc::{EngineValidatorAddOn, EngineValidatorBuilder, RethRpcAddOns, RpcAddOns, RpcHandle},
@@ -89,7 +89,7 @@ impl OpNode {
) -> ComponentsBuilder<
Node,
OpPoolBuilder,
OpPayloadBuilder,
BasicPayloadServiceBuilder<OpPayloadBuilder>,
OpNetworkBuilder,
OpExecutorBuilder,
OpConsensusBuilder,
@@ -111,9 +111,9 @@ impl OpNode {
OpPoolBuilder::default()
.with_enable_tx_conditional(self.args.enable_tx_conditional),
)
.payload(
.payload(BasicPayloadServiceBuilder::new(
OpPayloadBuilder::new(compute_pending_block).with_da_config(self.da_config.clone()),
)
))
.network(OpNetworkBuilder {
disable_txpool_gossip,
disable_discovery_v4: !discovery_v4,
@@ -171,7 +171,7 @@ where
type ComponentsBuilder = ComponentsBuilder<
N,
OpPoolBuilder,
OpPayloadBuilder,
BasicPayloadServiceBuilder<OpPayloadBuilder>,
OpNetworkBuilder,
OpExecutorBuilder,
OpConsensusBuilder,
@@ -592,7 +592,7 @@ impl<Txs> OpPayloadBuilder<Txs> {
/// given EVM config.
#[expect(clippy::type_complexity)]
pub fn build<Node, Evm, Pool>(
&self,
self,
evm_config: Evm,
ctx: &BuilderContext<Node>,
pool: Pool,
@@ -632,7 +632,7 @@ impl<Txs> OpPayloadBuilder<Txs> {
}
}
impl<Node, Pool, Txs> PayloadServiceBuilder<Node, Pool> for OpPayloadBuilder<Txs>
impl<Node, Pool, Txs> PayloadBuilderBuilder<Node, Pool> for OpPayloadBuilder<Txs>
where
Node: FullNodeTypes<
Types: NodeTypesWithEngine<
@@ -655,7 +655,7 @@ where
>;
async fn build_payload_builder(
&self,
self,
ctx: &BuilderContext<Node>,
pool: Pool,
) -> eyre::Result<Self::PayloadBuilder> {

View File

@@ -12,7 +12,8 @@ use reth_e2e_test_utils::{
};
use reth_node_api::{FullNodeTypes, NodeTypesWithEngine};
use reth_node_builder::{
components::ComponentsBuilder, EngineNodeLauncher, NodeBuilder, NodeConfig,
components::{BasicPayloadServiceBuilder, ComponentsBuilder},
EngineNodeLauncher, NodeBuilder, NodeConfig,
};
use reth_node_core::args::DatadirArgs;
use reth_optimism_chainspec::{OpChainSpec, OpChainSpecBuilder};
@@ -93,7 +94,7 @@ fn build_components<Node>(
) -> ComponentsBuilder<
Node,
OpPoolBuilder,
OpPayloadBuilder<CustomTxPriority>,
BasicPayloadServiceBuilder<OpPayloadBuilder<CustomTxPriority>>,
OpNetworkBuilder,
OpExecutorBuilder,
OpConsensusBuilder,
@@ -112,10 +113,10 @@ where
ComponentsBuilder::default()
.node_types::<Node>()
.pool(OpPoolBuilder::default())
.payload(
.payload(BasicPayloadServiceBuilder::new(
OpPayloadBuilder::new(compute_pending_block)
.with_transactions(CustomTxPriority { chain_id }),
)
))
.network(OpNetworkBuilder { disable_txpool_gossip, disable_discovery_v4: !discovery_v4 })
.executor(OpExecutorBuilder::default())
.consensus(OpConsensusBuilder::default())

View File

@@ -31,6 +31,7 @@ reth-rpc-server-types.workspace = true
reth-network-api.workspace = true
reth-node-api.workspace = true
reth-trie-common = { workspace = true, features = ["eip1186"] }
reth-payload-builder.workspace = true
# ethereum
alloy-rlp.workspace = true

View File

@@ -1,6 +1,7 @@
//! Helper trait for interfacing with [`FullNodeComponents`].
use reth_node_api::FullNodeComponents;
use reth_node_api::{FullNodeComponents, NodeTypesWithEngine};
use reth_payload_builder::PayloadBuilderHandle;
use reth_provider::{BlockReader, ProviderBlock, ProviderReceipt};
use reth_rpc_eth_types::EthStateCache;
@@ -47,7 +48,7 @@ where
type Pool = T::Pool;
type Evm = <T as FullNodeComponents>::Evm;
type Network = <T as FullNodeComponents>::Network;
type PayloadBuilder = <T as FullNodeComponents>::PayloadBuilder;
type PayloadBuilder = PayloadBuilderHandle<<T::Types as NodeTypesWithEngine>::Engine>;
#[inline]
fn pool(&self) -> &Self::Pool {
@@ -66,7 +67,7 @@ where
#[inline]
fn payload_builder(&self) -> &Self::PayloadBuilder {
FullNodeComponents::payload_builder(self)
FullNodeComponents::payload_builder_handle(self)
}
#[inline]