Skip to main content

FoundryEvmExt

Trait FoundryEvmExt 

Source
pub trait FoundryEvmExt<Tx>:
    SendableExt
    + Debug
    + Default
    + 'static {
    // Provided methods
    fn for_transaction(&mut self, _tx: &Recovered<Tx>) { ... }
    fn for_block(
        &mut self,
        _grandparent: &[Recovered<Tx>],
        _parent: &[Recovered<Tx>],
        _current: &[Recovered<Tx>],
        _index: usize,
    ) { ... }
    fn replace_while_executing(&mut self, ext: Self) { ... }
    fn is_protocol_transaction(_tx: &Recovered<Tx>) -> bool { ... }
    fn set_preserve_transaction_state(&mut self, _preserve: bool) { ... }
    fn set_protocol_replay(&mut self, _enabled: bool) { ... }
    fn for_next_transaction(&mut self, tx: &Recovered<Tx>) { ... }
    fn adopt_cursor(&mut self, _cursor: &Self) { ... }
    fn resume_context(&mut self, ext: Self) { ... }
}
Expand description

Per-EVM network state, such as OP L1 block info or Monad’s reserve-balance context.

Provided Methods§

Source

fn for_transaction(&mut self, _tx: &Recovered<Tx>)

Prepares the state for a standalone synthetic transaction.

Source

fn for_block( &mut self, _grandparent: &[Recovered<Tx>], _parent: &[Recovered<Tx>], _current: &[Recovered<Tx>], _index: usize, )

Prepares the state for the transaction at index of current, a block whose parent and grandparent blocks contained parent and grandparent, such as when replaying a block.

Source

fn replace_while_executing(&mut self, ext: Self)

Replaces the state of an EVM that may be executing with ext, such as one restored by a snapshot revert, keeping the state of the frames still executing.

Source

fn is_protocol_transaction(_tx: &Recovered<Tx>) -> bool

Returns whether tx is a canonical protocol transaction of the network, such as a Monad staking syscall, which only executes with Self::set_protocol_replay enabled.

Source

fn set_preserve_transaction_state(&mut self, _preserve: bool)

Sets whether the next transaction continues the transaction state derived so far, such as Monad’s reserve-balance tracker, instead of starting its own. Isolated calls continue the running transaction’s.

Source

fn set_protocol_replay(&mut self, _enabled: bool)

Sets whether transactions from the network’s protocol sender execute as protocol transactions.

Enable it only to replay trusted canonical chain history, after preparing the transaction with Self::for_transaction or Self::for_block, which disable it.

Source

fn for_next_transaction(&mut self, tx: &Recovered<Tx>)

Prepares the state for a synthetic transaction appended at the retained block cursor, such as a test call or vm.executeTransaction.

Networks without block-position state treat it as standalone (see Self::for_transaction). The retained cursor itself does not move: only canonical replays advance it, through Self::adopt_cursor.

Source

fn adopt_cursor(&mut self, _cursor: &Self)

Moves the retained block cursor to cursor’s, keeping the running transaction’s own position at the new cursor and every other state.

Source

fn resume_context(&mut self, ext: Self)

Switches an EVM that may be executing to the parked context state ext, such as on a fork switch.

Networks whose context state is only a block cursor, such as Monad, keep the running transaction’s own state and adopt the context’s cursor.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl FoundryEvmExt<BaseTxEnvelope> for BaseEvmExt

Available on crate feature base only.
Source§

fn replace_while_executing(&mut self, ext: Self)

Source§

impl FoundryEvmExt<OpTxEnvelope> for OpEvmExt

Available on crate feature optimism only.
Source§

fn replace_while_executing(&mut self, ext: Self)

Source§

impl FoundryEvmExt<TempoTxEnv> for TempoEvmExt

Source§

fn resume_context(&mut self, _ext: Self)

Source§

impl FoundryEvmExt<TxEnvelope> for MonadEvmExt

Available on crate feature monad only.
Source§

fn for_transaction(&mut self, tx: &Recovered<TxEnvelope>)

Source§

fn for_block( &mut self, grandparent: &[Recovered<TxEnvelope>], parent: &[Recovered<TxEnvelope>], current: &[Recovered<TxEnvelope>], index: usize, )

Source§

fn replace_while_executing(&mut self, ext: Self)

Source§

fn is_protocol_transaction(tx: &Recovered<TxEnvelope>) -> bool

Source§

fn set_protocol_replay(&mut self, enabled: bool)

Source§

fn set_preserve_transaction_state(&mut self, preserve: bool)

Source§

fn for_next_transaction(&mut self, tx: &Recovered<TxEnvelope>)

Source§

fn adopt_cursor(&mut self, cursor: &Self)

Source§

fn resume_context(&mut self, ext: Self)

Source§

impl<Tx> FoundryEvmExt<Tx> for ()

Implementors§