mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
Move cfg_env and block_env configuration from PayloadBuilderAttributes into PayloadBuilder (#10510)
Co-authored-by: garwah <garwah@garwah> Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -30,7 +30,6 @@ use reth::{
|
||||
node::{NodeTypes, NodeTypesWithEngine},
|
||||
BuilderContext, FullNodeTypes, Node, NodeBuilder, PayloadBuilderConfig,
|
||||
},
|
||||
primitives::revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg},
|
||||
providers::{CanonStateSubscriptions, StateProviderFactory},
|
||||
tasks::TaskManager,
|
||||
transaction_pool::TransactionPool,
|
||||
@ -56,7 +55,7 @@ use reth_payload_builder::{
|
||||
error::PayloadBuilderError, EthBuiltPayload, EthPayloadBuilderAttributes, PayloadBuilderHandle,
|
||||
PayloadBuilderService,
|
||||
};
|
||||
use reth_primitives::{Address, Header, Withdrawals, B256};
|
||||
use reth_primitives::{Address, Withdrawals, B256};
|
||||
use reth_rpc_types::{
|
||||
engine::{
|
||||
ExecutionPayloadEnvelopeV2, ExecutionPayloadEnvelopeV3, ExecutionPayloadEnvelopeV4,
|
||||
@ -153,14 +152,6 @@ impl PayloadBuilderAttributes for CustomPayloadBuilderAttributes {
|
||||
fn withdrawals(&self) -> &Withdrawals {
|
||||
&self.0.withdrawals
|
||||
}
|
||||
|
||||
fn cfg_and_block_env(
|
||||
&self,
|
||||
chain_spec: &ChainSpec,
|
||||
parent: &Header,
|
||||
) -> (CfgEnvWithHandlerCfg, BlockEnv) {
|
||||
self.0.cfg_and_block_env(chain_spec, parent)
|
||||
}
|
||||
}
|
||||
|
||||
/// Custom engine types - uses a custom payload attributes RPC type, but uses the default
|
||||
@ -294,14 +285,7 @@ where
|
||||
args: BuildArguments<Pool, Client, Self::Attributes, Self::BuiltPayload>,
|
||||
) -> Result<BuildOutcome<Self::BuiltPayload>, PayloadBuilderError> {
|
||||
let BuildArguments { client, pool, cached_reads, config, cancel, best_payload } = args;
|
||||
let PayloadConfig {
|
||||
initialized_block_env,
|
||||
initialized_cfg,
|
||||
parent_block,
|
||||
extra_data,
|
||||
attributes,
|
||||
chain_spec,
|
||||
} = config;
|
||||
let PayloadConfig { parent_block, extra_data, attributes, chain_spec } = config;
|
||||
|
||||
// This reuses the default EthereumPayloadBuilder to build the payload
|
||||
// but any custom logic can be implemented here
|
||||
@ -313,8 +297,6 @@ where
|
||||
pool,
|
||||
cached_reads,
|
||||
config: PayloadConfig {
|
||||
initialized_block_env,
|
||||
initialized_cfg,
|
||||
parent_block,
|
||||
extra_data,
|
||||
attributes: attributes.0,
|
||||
@ -330,16 +312,9 @@ where
|
||||
client: &Client,
|
||||
config: PayloadConfig<Self::Attributes>,
|
||||
) -> Result<Self::BuiltPayload, PayloadBuilderError> {
|
||||
let PayloadConfig {
|
||||
initialized_block_env,
|
||||
initialized_cfg,
|
||||
parent_block,
|
||||
extra_data,
|
||||
attributes,
|
||||
chain_spec,
|
||||
} = config;
|
||||
let PayloadConfig { parent_block, extra_data, attributes, chain_spec } = config;
|
||||
<reth_ethereum_payload_builder::EthereumPayloadBuilder as PayloadBuilder<Pool, Client>>::build_empty_payload(&reth_ethereum_payload_builder::EthereumPayloadBuilder::new(EthEvmConfig::new(chain_spec.clone())),client,
|
||||
PayloadConfig { initialized_block_env, initialized_cfg, parent_block, extra_data, attributes: attributes.0, chain_spec })
|
||||
PayloadConfig { parent_block, extra_data, attributes: attributes.0, chain_spec })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user