evm: wider use of RethEvmBuilder (#9944)

This commit is contained in:
Thomas Coratger
2024-08-21 20:35:17 -07:00
committed by GitHub
parent cdc39a744e
commit 82f41c55a2
2 changed files with 3 additions and 9 deletions

View File

@ -15,7 +15,6 @@ extern crate alloc;
use reth_chainspec::{ChainSpec, Head};
use reth_evm::{ConfigureEvm, ConfigureEvmEnv};
use reth_primitives::{transaction::FillTxEnv, Address, Header, TransactionSigned, U256};
use reth_revm::{Database, EvmBuilder};
use revm_primitives::{AnalysisKind, Bytes, CfgEnvWithHandlerCfg, Env, TxEnv, TxKind};
#[cfg(not(feature = "std"))]
@ -110,13 +109,6 @@ impl ConfigureEvmEnv for EthEvmConfig {
impl ConfigureEvm for EthEvmConfig {
type DefaultExternalContext<'a> = ();
fn evm<DB: Database>(
&self,
db: DB,
) -> reth_revm::Evm<'_, Self::DefaultExternalContext<'_>, DB> {
EvmBuilder::default().with_db(db).build()
}
fn default_external_context<'a>(&self) -> Self::DefaultExternalContext<'a> {}
}

View File

@ -44,7 +44,9 @@ pub trait ConfigureEvm: ConfigureEvmEnv {
/// This does not automatically configure the EVM with [`ConfigureEvmEnv`] methods. It is up to
/// the caller to call an appropriate method to fill the transaction and block environment
/// before executing any transactions using the provided EVM.
fn evm<DB: Database>(&self, db: DB) -> Evm<'_, Self::DefaultExternalContext<'_>, DB>;
fn evm<DB: Database>(&self, db: DB) -> Evm<'_, Self::DefaultExternalContext<'_>, DB> {
RethEvmBuilder::new(db, self.default_external_context()).build()
}
/// Returns a new EVM with the given database configured with the given environment settings,
/// including the spec id.