feat: add functions for env creation (#12928)

This commit is contained in:
Matthias Seitz
2024-11-27 23:35:23 +01:00
committed by GitHub
parent 8d70e8921b
commit 2179301590
8 changed files with 39 additions and 60 deletions

View File

@ -12,10 +12,8 @@ use reth_primitives::{Receipt, SealedBlockWithSenders, SealedHeader};
use reth_primitives_traits::SignedTransaction;
use reth_provider::{BlockExecutionOutput, ChainSpecProvider, StateProviderFactory};
use reth_revm::{
database::StateProviderDatabase,
db::states::bundle_state::BundleRetention,
primitives::{BlockEnv, CfgEnvWithHandlerCfg, EnvWithHandlerCfg},
DatabaseCommit, StateBuilder,
database::StateProviderDatabase, db::states::bundle_state::BundleRetention,
primitives::EnvWithHandlerCfg, DatabaseCommit, StateBuilder,
};
use reth_rpc_api::DebugApiClient;
use reth_tracing::tracing::warn;
@ -76,9 +74,7 @@ where
.build();
// Setup environment for the execution.
let mut cfg = CfgEnvWithHandlerCfg::new(Default::default(), Default::default());
let mut block_env = BlockEnv::default();
self.evm_config.fill_cfg_and_block_env(&mut cfg, &mut block_env, block.header(), U256::MAX);
let (cfg, block_env) = self.evm_config.cfg_and_block_env(block.header(), U256::MAX);
// Setup EVM
let mut evm = self.evm_config.evm_with_env(

View File

@ -27,9 +27,7 @@ use reth_revm::{
};
use reth_rpc_types_compat::engine::payload::block_to_payload;
use reth_trie::HashedPostState;
use revm_primitives::{
calc_excess_blob_gas, BlockEnv, CfgEnvWithHandlerCfg, EVMError, EnvWithHandlerCfg,
};
use revm_primitives::{calc_excess_blob_gas, EVMError, EnvWithHandlerCfg};
use std::{
collections::VecDeque,
future::Future,
@ -298,9 +296,7 @@ where
.build();
// Configure environments
let mut cfg = CfgEnvWithHandlerCfg::new(Default::default(), Default::default());
let mut block_env = BlockEnv::default();
evm_config.fill_cfg_and_block_env(&mut cfg, &mut block_env, &reorg_target.header, U256::MAX);
let (cfg, block_env) = evm_config.cfg_and_block_env(&reorg_target.header, U256::MAX);
let env = EnvWithHandlerCfg::new_with_cfg_env(cfg, block_env, Default::default());
let mut evm = evm_config.evm_with_env(&mut state, env);