refactor: use EvmEnv when setting up Evm (#13800)

This commit is contained in:
Arsenii Kulikov
2025-01-15 20:09:03 +04:00
committed by GitHub
parent f2bf02413f
commit d5978a78b4
16 changed files with 551 additions and 585 deletions

View File

@ -7,7 +7,9 @@ license.workspace = true
[dependencies]
reth.workspace = true
reth-evm.workspace = true
reth-node-ethereum.workspace = true
revm-primitives.workspace = true
alloy-rpc-types-eth.workspace = true
clap = { workspace = true, features = ["derive"] }
futures-util.workspace = true

View File

@ -22,12 +22,15 @@ use reth::{
revm::{
inspector_handle_register,
interpreter::{Interpreter, OpCode},
primitives::{Env, EnvWithHandlerCfg},
Database, Evm, EvmContext, Inspector,
},
rpc::{api::eth::helpers::Call, compat::transaction::transaction_to_call_request},
transaction_pool::TransactionPool,
};
use reth_evm::EvmEnv;
use reth_node_ethereum::node::EthereumNode;
use revm_primitives::CfgEnvWithHandlerCfg;
fn main() {
Cli::<EthereumChainSpecParser, RethCliTxpoolExt>::parse()
@ -61,7 +64,16 @@ fn main() {
call_request,
BlockNumberOrTag::Latest.into(),
EvmOverrides::default(),
move |db, env| {
move |db, evm_env, tx_env| {
let EvmEnv {
cfg_env_with_handler_cfg:
CfgEnvWithHandlerCfg { handler_cfg, cfg_env },
block_env,
} = evm_env;
let env = EnvWithHandlerCfg {
handler_cfg,
env: Env::boxed(cfg_env, block_env, tx_env),
};
let mut dummy_inspector = DummyInspector::default();
{
// configure the evm with the custom inspector