chore: add commentes clarifying evm trait (#6857)

This commit is contained in:
Dan Cline
2024-02-28 16:47:15 -05:00
committed by GitHub
parent 3519270c69
commit 2aa5f5ddcd

View File

@@ -5,11 +5,19 @@ use revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg, SpecId, TxEnv};
/// Trait for configuring the EVM for executing full blocks.
pub trait ConfigureEvm: ConfigureEvmEnv {
/// Returns new EVM with the given database
///
/// 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<'a, DB: Database + 'a>(&self, db: DB) -> Evm<'a, (), DB> {
EvmBuilder::default().with_db(db).build()
}
/// Returns a new EVM with the given inspector
/// Returns a new EVM with the given inspector.
///
/// 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_with_inspector<'a, DB: Database + 'a, I>(&self, db: DB, inspector: I) -> Evm<'a, I, DB> {
EvmBuilder::default().with_db(db).with_external_context(inspector).build()
}