mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-30 03:01:58 -04:00
feat: Support custom EvmConfig for ethereumpayload builder (#10117)
This commit is contained in:
@@ -17,7 +17,7 @@ use reth_node_builder::{
|
||||
PayloadServiceBuilder, PoolBuilder,
|
||||
},
|
||||
node::{FullNodeTypes, NodeTypes},
|
||||
BuilderContext, Node, PayloadBuilderConfig, PayloadTypes,
|
||||
BuilderContext, ConfigureEvm, Node, PayloadBuilderConfig, PayloadTypes,
|
||||
};
|
||||
use reth_payload_builder::{PayloadBuilderHandle, PayloadBuilderService};
|
||||
use reth_provider::CanonStateSubscriptions;
|
||||
@@ -56,7 +56,7 @@ impl EthereumNode {
|
||||
ComponentsBuilder::default()
|
||||
.node_types::<Node>()
|
||||
.pool(EthereumPoolBuilder::default())
|
||||
.payload(EthereumPayloadBuilder::default())
|
||||
.payload(EthereumPayloadBuilder::new(EthEvmConfig::default()))
|
||||
.network(EthereumNetworkBuilder::default())
|
||||
.executor(EthereumExecutorBuilder::default())
|
||||
.consensus(EthereumConsensusBuilder::default())
|
||||
@@ -196,12 +196,23 @@ where
|
||||
/// A basic ethereum payload service.
|
||||
#[derive(Debug, Default, Clone)]
|
||||
#[non_exhaustive]
|
||||
pub struct EthereumPayloadBuilder;
|
||||
pub struct EthereumPayloadBuilder<Evm = EthEvmConfig> {
|
||||
/// The EVM configuration to use for the payload builder.
|
||||
pub evm_config: Evm,
|
||||
}
|
||||
|
||||
impl<Node, Pool> PayloadServiceBuilder<Node, Pool> for EthereumPayloadBuilder
|
||||
impl<EVM> EthereumPayloadBuilder<EVM> {
|
||||
/// Create a new instance with the given evm config.
|
||||
pub const fn new(evm_config: EVM) -> Self {
|
||||
Self { evm_config }
|
||||
}
|
||||
}
|
||||
|
||||
impl<Node, Evm, Pool> PayloadServiceBuilder<Node, Pool> for EthereumPayloadBuilder<Evm>
|
||||
where
|
||||
Pool: TransactionPool + Unpin + 'static,
|
||||
Node: FullNodeTypes,
|
||||
Evm: ConfigureEvm,
|
||||
Pool: TransactionPool + Unpin + 'static,
|
||||
<Node as NodeTypes>::Engine: PayloadTypes<
|
||||
BuiltPayload = EthBuiltPayload,
|
||||
PayloadAttributes = EthPayloadAttributes,
|
||||
@@ -213,7 +224,8 @@ where
|
||||
ctx: &BuilderContext<Node>,
|
||||
pool: Pool,
|
||||
) -> eyre::Result<PayloadBuilderHandle<Node::Engine>> {
|
||||
let payload_builder = reth_ethereum_payload_builder::EthereumPayloadBuilder::default();
|
||||
let payload_builder =
|
||||
reth_ethereum_payload_builder::EthereumPayloadBuilder::new(self.evm_config);
|
||||
let conf = ctx.payload_builder_config();
|
||||
|
||||
let payload_job_config = BasicPayloadJobGeneratorConfig::default()
|
||||
|
||||
@@ -22,7 +22,10 @@ use reth_chainspec::{Chain, ChainSpec, Head};
|
||||
use reth_evm_ethereum::EthEvmConfig;
|
||||
use reth_node_api::{ConfigureEvm, ConfigureEvmEnv, FullNodeTypes};
|
||||
use reth_node_core::{args::RpcServerArgs, node_config::NodeConfig};
|
||||
use reth_node_ethereum::{node::EthereumAddOns, EthExecutorProvider, EthereumNode};
|
||||
use reth_node_ethereum::{
|
||||
node::{EthereumAddOns, EthereumPayloadBuilder},
|
||||
EthExecutorProvider, EthereumNode,
|
||||
};
|
||||
use reth_primitives::{
|
||||
revm_primitives::{AnalysisKind, CfgEnvWithHandlerCfg, TxEnv},
|
||||
Address, Header, TransactionSigned, U256,
|
||||
@@ -181,7 +184,11 @@ async fn main() -> eyre::Result<()> {
|
||||
// configure the node with regular ethereum types
|
||||
.with_types::<EthereumNode>()
|
||||
// use default ethereum components but with our executor
|
||||
.with_components(EthereumNode::components().executor(MyExecutorBuilder::default()))
|
||||
.with_components(
|
||||
EthereumNode::components()
|
||||
.executor(MyExecutorBuilder::default())
|
||||
.payload(EthereumPayloadBuilder::new(MyEvmConfig::default())),
|
||||
)
|
||||
.with_add_ons::<EthereumAddOns>()
|
||||
.launch()
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user