reth_node_ethereum/
payload.rs1use reth_chainspec::{EthChainSpec, EthereumHardforks};
4use reth_ethereum_engine_primitives::{EthBuiltPayload, EthPayloadAttributes};
5use reth_ethereum_payload_builder::EthereumBuilderConfig;
6use reth_ethereum_primitives::EthPrimitives;
7use reth_evm::ConfigureEvm;
8use reth_node_api::{FullNodeTypes, NodeTypes, PrimitivesTy, TxTy};
9use reth_node_builder::{
10 components::PayloadBuilderBuilder, BuilderContext, PayloadBuilderConfig, PayloadTypes,
11};
12use reth_transaction_pool::{PoolTransaction, TransactionPool};
13
14#[derive(Clone, Default, Debug)]
16#[non_exhaustive]
17pub struct EthereumPayloadBuilder;
18
19impl<Types, Node, Pool, Evm> PayloadBuilderBuilder<Node, Pool, Evm> for EthereumPayloadBuilder
20where
21 Types: NodeTypes<ChainSpec: EthereumHardforks, Primitives = EthPrimitives>,
22 Node: FullNodeTypes<Types = Types>,
23 Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TxTy<Node::Types>>>
24 + Unpin
25 + 'static,
26 Evm: ConfigureEvm<
27 Primitives = PrimitivesTy<Types>,
28 NextBlockEnvCtx = reth_evm::NextBlockEnvAttributes,
29 > + 'static,
30 Types::Payload:
31 PayloadTypes<BuiltPayload = EthBuiltPayload, PayloadAttributes = EthPayloadAttributes>,
32{
33 type PayloadBuilder =
34 reth_ethereum_payload_builder::EthereumPayloadBuilder<Pool, Node::Provider, Evm>;
35
36 async fn build_payload_builder(
37 self,
38 ctx: &BuilderContext<Node>,
39 pool: Pool,
40 evm_config: Evm,
41 ) -> eyre::Result<Self::PayloadBuilder> {
42 let conf = ctx.payload_builder_config();
43 let chain = ctx.chain_spec().chain();
44 let gas_limit = conf.gas_limit_for(chain);
45
46 Ok(reth_ethereum_payload_builder::EthereumPayloadBuilder::new(
47 ctx.provider().clone(),
48 pool,
49 evm_config,
50 EthereumBuilderConfig::new()
51 .with_gas_limit(gas_limit)
52 .with_max_blobs_per_block(conf.max_blobs_per_block())
53 .with_extra_data(conf.extra_data()),
54 ))
55 }
56}