feat(builder): ethereum builder config (#13315)

This commit is contained in:
Roman Krasiuk
2024-12-11 22:26:25 +01:00
committed by GitHub
parent 3d12a4eafa
commit c553b1e86d
14 changed files with 120 additions and 69 deletions

View File

@ -8,6 +8,7 @@ use reth_chainspec::ChainSpec;
use reth_ethereum_engine_primitives::{
EthBuiltPayload, EthPayloadAttributes, EthPayloadBuilderAttributes,
};
use reth_ethereum_payload_builder::EthereumBuilderConfig;
use reth_evm::execute::BasicBlockExecutorProvider;
use reth_evm_ethereum::execute::EthExecutionStrategyFactory;
use reth_network::{EthNetworkPrimitives, NetworkHandle, PeersInfo};
@ -23,6 +24,7 @@ use reth_node_builder::{
rpc::{EngineValidatorBuilder, RpcAddOns},
BuilderContext, Node, NodeAdapter, NodeComponentsBuilder, PayloadBuilderConfig, PayloadTypes,
};
use reth_node_core::version::default_extra_data_bytes;
use reth_payload_builder::{PayloadBuilderHandle, PayloadBuilderService};
use reth_primitives::{EthPrimitives, PooledTransactionsElement};
use reth_provider::{CanonStateSubscriptions, EthStorage};
@ -228,9 +230,24 @@ where
}
/// A basic ethereum payload service.
#[derive(Debug, Default, Clone)]
#[non_exhaustive]
pub struct EthereumPayloadBuilder;
#[derive(Clone, Debug)]
pub struct EthereumPayloadBuilder {
/// Payload builder configuration.
config: EthereumBuilderConfig,
}
impl Default for EthereumPayloadBuilder {
fn default() -> Self {
Self { config: EthereumBuilderConfig::new(default_extra_data_bytes()) }
}
}
impl EthereumPayloadBuilder {
/// Create new ethereum payload builder.
pub const fn new(config: EthereumBuilderConfig) -> Self {
Self { config }
}
}
impl EthereumPayloadBuilder {
/// A helper method initializing [`PayloadBuilderService`] with the given EVM config.
@ -254,7 +271,7 @@ impl EthereumPayloadBuilder {
>,
{
let payload_builder =
reth_ethereum_payload_builder::EthereumPayloadBuilder::new(evm_config);
reth_ethereum_payload_builder::EthereumPayloadBuilder::new(evm_config, self.config);
let conf = ctx.payload_builder_config();
let payload_job_config = BasicPayloadJobGeneratorConfig::default()