pub trait Evm {
type EvmTypes: EvmTypes<Tx = Self::Transaction>;
type Transaction;
Show 13 methods
// Required methods
fn transact(
&mut self,
transaction: &Recovered<Self::Transaction>,
) -> Result<TxResultWithState<Self::EvmTypes>, BlockExecutionError>;
fn transact_commit(
&mut self,
transaction: &Recovered<Self::Transaction>,
) -> Result<TxResult<Self::EvmTypes>, BlockExecutionError>;
fn transact_result(
&mut self,
transaction: &Recovered<Self::Transaction>,
) -> Result<TxResult<Self::EvmTypes>, BlockExecutionError>;
fn transact_with_inspector<I>(
&mut self,
transaction: &Recovered<Self::Transaction>,
inspector: I,
) -> Result<(I, TxResultWithState<Self::EvmTypes>), BlockExecutionError>
where I: Inspector<Self::EvmTypes> + 'static;
fn set_inspector<I>(&mut self, inspector: I)
where I: Inspector<Self::EvmTypes> + 'static;
fn state_db_mut(&mut self) -> &mut dyn DynDatabase;
fn commit_state(&mut self, state: &PendingState);
fn take_state_cache(&mut self) -> Cache;
fn precompile_ids(&self) -> Vec<(Address, PrecompileId)>;
fn has_precompile(&self, address: &Address) -> bool;
fn account_info(
&mut self,
address: &Address,
) -> Result<Option<AccountInfo>, BlockExecutionError>;
fn move_precompiles(
&mut self,
moves: impl IntoIterator<Item = (Address, Address)>,
) -> Result<(), MovePrecompileError>;
fn transact_and_discard<R>(
&mut self,
transaction: &Recovered<Self::Transaction>,
observe: impl FnOnce(&ExecutedTx<'_, '_, Self::EvmTypes>) -> R,
) -> Result<R, BlockExecutionError>;
}Expand description
A configured EVM instance.
Required Associated Types§
Sourcetype EvmTypes: EvmTypes<Tx = Self::Transaction>
type EvmTypes: EvmTypes<Tx = Self::Transaction>
Runtime EVM type family.
Sourcetype Transaction
type Transaction
Transaction environment consumed by this EVM.
Required Methods§
Sourcefn transact(
&mut self,
transaction: &Recovered<Self::Transaction>,
) -> Result<TxResultWithState<Self::EvmTypes>, BlockExecutionError>
fn transact( &mut self, transaction: &Recovered<Self::Transaction>, ) -> Result<TxResultWithState<Self::EvmTypes>, BlockExecutionError>
Executes a transaction without committing its state changes.
Sourcefn transact_commit(
&mut self,
transaction: &Recovered<Self::Transaction>,
) -> Result<TxResult<Self::EvmTypes>, BlockExecutionError>
fn transact_commit( &mut self, transaction: &Recovered<Self::Transaction>, ) -> Result<TxResult<Self::EvmTypes>, BlockExecutionError>
Executes and accepts writes in the EVM’s block-scoped state without detaching them.
Sourcefn transact_result(
&mut self,
transaction: &Recovered<Self::Transaction>,
) -> Result<TxResult<Self::EvmTypes>, BlockExecutionError>
fn transact_result( &mut self, transaction: &Recovered<Self::Transaction>, ) -> Result<TxResult<Self::EvmTypes>, BlockExecutionError>
Executes a transaction and discards writes without materializing detached state.
Sourcefn transact_with_inspector<I>(
&mut self,
transaction: &Recovered<Self::Transaction>,
inspector: I,
) -> Result<(I, TxResultWithState<Self::EvmTypes>), BlockExecutionError>where
I: Inspector<Self::EvmTypes> + 'static,
fn transact_with_inspector<I>(
&mut self,
transaction: &Recovered<Self::Transaction>,
inspector: I,
) -> Result<(I, TxResultWithState<Self::EvmTypes>), BlockExecutionError>where
I: Inspector<Self::EvmTypes> + 'static,
Executes a transaction with an inspector without committing its state changes.
Sourcefn set_inspector<I>(&mut self, inspector: I)where
I: Inspector<Self::EvmTypes> + 'static,
fn set_inspector<I>(&mut self, inspector: I)where
I: Inspector<Self::EvmTypes> + 'static,
Sets the inspector used by subsequent transactions.
Sourcefn state_db_mut(&mut self) -> &mut dyn DynDatabase
fn state_db_mut(&mut self) -> &mut dyn DynDatabase
Returns the accepted state overlay, including earlier committed transactions.
Sourcefn commit_state(&mut self, state: &PendingState)
fn commit_state(&mut self, state: &PendingState)
Accepts detached changes after a tracing callback has consumed the pre-state.
Sourcefn take_state_cache(&mut self) -> Cache
fn take_state_cache(&mut self) -> Cache
Takes cached reads and accepted writes for a caller that continues using its database.
Sourcefn precompile_ids(&self) -> Vec<(Address, PrecompileId)>
fn precompile_ids(&self) -> Vec<(Address, PrecompileId)>
Returns active precompile addresses and identifiers.
Sourcefn has_precompile(&self, address: &Address) -> bool
fn has_precompile(&self, address: &Address) -> bool
Returns whether an address is an active precompile.
Sourcefn account_info(
&mut self,
address: &Address,
) -> Result<Option<AccountInfo>, BlockExecutionError>
fn account_info( &mut self, address: &Address, ) -> Result<Option<AccountInfo>, BlockExecutionError>
Returns account information visible through the accepted state overlay.
Sourcefn move_precompiles(
&mut self,
moves: impl IntoIterator<Item = (Address, Address)>,
) -> Result<(), MovePrecompileError>
fn move_precompiles( &mut self, moves: impl IntoIterator<Item = (Address, Address)>, ) -> Result<(), MovePrecompileError>
Applies precompile address moves to the active precompile set.
Sourcefn transact_and_discard<R>(
&mut self,
transaction: &Recovered<Self::Transaction>,
observe: impl FnOnce(&ExecutedTx<'_, '_, Self::EvmTypes>) -> R,
) -> Result<R, BlockExecutionError>
fn transact_and_discard<R>( &mut self, transaction: &Recovered<Self::Transaction>, observe: impl FnOnce(&ExecutedTx<'_, '_, Self::EvmTypes>) -> R, ) -> Result<R, BlockExecutionError>
Executes a transaction, lets observe inspect the executed transaction and its state
changes, then discards its writes.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".