Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

evm: wider use of RethEvmBuilder #9944

Merged
merged 15 commits into from
Aug 22, 2024
8 changes: 0 additions & 8 deletions crates/ethereum/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))]
Expand Down Expand Up @@ -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> {}
}

Expand Down
4 changes: 3 additions & 1 deletion crates/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading