Skip to main content

NestedEvm

Trait NestedEvm 

pub trait NestedEvm {
    type Tx;
    type Block;
    type Spec;

    // Required methods
    fn journal_inner_mut(&mut self) -> &mut JournalInner<JournalEntry>;
    fn run_execution(
        &mut self,
        frame: FrameInput,
    ) -> Result<FrameResult, EVMError<DatabaseError>>;
    fn transact(
        &mut self,
        tx: Self::Tx,
    ) -> Result<ExecResultAndState<ExecutionResult>, EVMError<DatabaseError>>;
    fn to_evm_env(&self) -> EvmEnv<Self::Spec, Self::Block>;
}
Expand description

Object-safe trait exposing the operations that cheatcode nested EVM closures need.

This abstracts over the concrete EVM type (FoundryEvm, future TempoEvm, etc.) so that cheatcode impls can build and run nested EVMs without knowing the concrete type.

Required Associated Types§

type Tx

The transaction environment type.

type Block

The block environment type.

type Spec

The EVM spec (hardfork) type.

Required Methods§

fn journal_inner_mut(&mut self) -> &mut JournalInner<JournalEntry>

Returns a mutable reference to the journal inner state (JournaledState).

fn run_execution( &mut self, frame: FrameInput, ) -> Result<FrameResult, EVMError<DatabaseError>>

Runs a single execution frame (create or call) through the EVM handler loop.

fn transact( &mut self, tx: Self::Tx, ) -> Result<ExecResultAndState<ExecutionResult>, EVMError<DatabaseError>>

Executes a full transaction with the given tx env.

fn to_evm_env(&self) -> EvmEnv<Self::Spec, Self::Block>

Returns a snapshot of the current EVM environment (cfg + block).

Implementors§

§

impl<I> NestedEvm for FoundryEvm<'_, I>
where I: EthInspectorExt,

§

type Tx = TxEnv

§

type Block = BlockEnv

§

type Spec = SpecId