Skip to content

Commit

Permalink
chore: add commentes clarifying evm trait (paradigmxyz#6857)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rjected authored and fgimenez committed Feb 29, 2024
1 parent d0784ef commit b0b66ba
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion crates/node-api/src/evm/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down

0 comments on commit b0b66ba

Please sign in to comment.