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:
garwah
2024-09-17 21:43:31 +10:00
committed by GitHub
parent abd4642d65
commit 2a04b1c100
12 changed files with 203 additions and 317 deletions

View File

@@ -27,10 +27,7 @@ use reth_provider::{
use reth_revm::state_change::post_block_withdrawals_balance_increments;
use reth_tasks::TaskSpawner;
use reth_transaction_pool::TransactionPool;
use revm::{
primitives::{BlockEnv, CfgEnvWithHandlerCfg},
Database, State,
};
use revm::{Database, State};
use std::{
fmt,
future::Future,
@@ -673,10 +670,6 @@ impl Drop for Cancelled {
/// Static config for how to build a payload.
#[derive(Clone, Debug)]
pub struct PayloadConfig<Attributes> {
/// Pre-configured block environment.
pub initialized_block_env: BlockEnv,
/// Configuration for the environment.
pub initialized_cfg: CfgEnvWithHandlerCfg,
/// The parent block.
pub parent_block: Arc<SealedBlock>,
/// Block extra data.
@@ -699,24 +692,13 @@ where
Attributes: PayloadBuilderAttributes,
{
/// Create new payload config.
pub fn new(
pub const fn new(
parent_block: Arc<SealedBlock>,
extra_data: Bytes,
attributes: Attributes,
chain_spec: Arc<ChainSpec>,
) -> Self {
// configure evm env based on parent block
let (initialized_cfg, initialized_block_env) =
attributes.cfg_and_block_env(&chain_spec, &parent_block);
Self {
initialized_block_env,
initialized_cfg,
parent_block,
extra_data,
attributes,
chain_spec,
}
Self { parent_block, extra_data, attributes, chain_spec }
}
/// Returns the payload id.