Type Alias MainnetEvm

pub type MainnetEvm<CTX, INSP = ()> = Evm<CTX, INSP, EthInstructions<EthInterpreter, CTX>, EthPrecompiles, EthFrame>;
Expand description

Type alias for a mainnet EVM instance with standard Ethereum components.

Aliased Type§

pub struct MainnetEvm<CTX, INSP = ()> {
    pub ctx: CTX,
    pub inspector: INSP,
    pub instruction: EthInstructions<EthInterpreter, CTX>,
    pub precompiles: EthPrecompiles,
    pub frame_stack: FrameStack<EthFrame>,
}

Fields§

§ctx: CTX

context_interface::ContextTr of the EVM it is used to fetch data from database.

§inspector: INSP

Inspector of the EVM it is used to inspect the EVM. Its trait are defined in revm-inspector crate.

§instruction: EthInstructions<EthInterpreter, CTX>

Instructions provider of the EVM it is used to execute instructions. InstructionProvider trait is defined in revm-handler crate.

§precompiles: EthPrecompiles

Precompile provider of the EVM it is used to execute precompiles. PrecompileProvider trait is defined in revm-handler crate.

§frame_stack: FrameStack<EthFrame>

Frame that is going to be executed.

Layout§

Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.

Implementations

§

impl<CTX, I, P, F> Evm<CTX, (), I, P, F>

pub fn new(ctx: CTX, instruction: I, precompiles: P) -> Evm<CTX, (), I, P, F>

Create a new EVM instance with a given context, instruction set, and precompile provider.

Inspector will be set to ().

§

impl<CTX, I, INSP, P, F> Evm<CTX, INSP, I, P, F>

pub fn new_with_inspector( ctx: CTX, inspector: INSP, instruction: I, precompiles: P, ) -> Evm<CTX, INSP, I, P, F>

Create a new EVM instance with a given context, inspector, instruction set, and precompile provider.

§

impl<CTX, INSP, I, P, F> Evm<CTX, INSP, I, P, F>

pub fn with_inspector<OINSP>(self, inspector: OINSP) -> Evm<CTX, OINSP, I, P, F>

Consumed self and returns new Evm type with given Inspector.

pub fn with_precompiles<OP>(self, precompiles: OP) -> Evm<CTX, INSP, I, OP, F>

Consumes self and returns new Evm type with given Precompiles.

pub fn into_inspector(self) -> INSP

Consumes self and returns inner Inspector.

Trait Implementations

§

impl<CTX, INSP, I, P, F> Clone for Evm<CTX, INSP, I, P, F>
where CTX: Clone, INSP: Clone, I: Clone, P: Clone, F: Clone,

§

fn clone(&self) -> Evm<CTX, INSP, I, P, F>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<CTX, INSP, I, P, F> Debug for Evm<CTX, INSP, I, P, F>
where CTX: Debug, INSP: Debug, I: Debug, P: Debug, F: Debug,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<CTX, INSP, I, P, F> Deref for Evm<CTX, INSP, I, P, F>

§

type Target = CTX

The resulting type after dereferencing.
§

fn deref(&self) -> &<Evm<CTX, INSP, I, P, F> as Deref>::Target

Dereferences the value.
§

impl<CTX, INSP, I, P, F> DerefMut for Evm<CTX, INSP, I, P, F>

§

fn deref_mut(&mut self) -> &mut <Evm<CTX, INSP, I, P, F> as Deref>::Target

Mutably dereferences the value.
§

impl<CTX, INSP, I, P> EvmTr for Evm<CTX, INSP, I, P, EthFrame>
where CTX: ContextTr, I: InstructionProvider<Context = CTX, InterpreterTypes = EthInterpreter>, P: PrecompileProvider<CTX, Output = InterpreterResult>,

§

fn frame_init( &mut self, frame_input: <<Evm<CTX, INSP, I, P, EthFrame> as EvmTr>::Frame as FrameTr>::FrameInit, ) -> Result<ItemOrResult<&mut <Evm<CTX, INSP, I, P, EthFrame> as EvmTr>::Frame, <<Evm<CTX, INSP, I, P, EthFrame> as EvmTr>::Frame as FrameTr>::FrameResult>, ContextError<<<CTX as ContextTr>::Db as Database>::Error>>

Initializes the frame for the given frame input. Frame is pushed to the frame stack.

§

fn frame_run( &mut self, ) -> Result<ItemOrResult<<<Evm<CTX, INSP, I, P, EthFrame> as EvmTr>::Frame as FrameTr>::FrameInit, <<Evm<CTX, INSP, I, P, EthFrame> as EvmTr>::Frame as FrameTr>::FrameResult>, ContextError<<<CTX as ContextTr>::Db as Database>::Error>>

Run the frame from the top of the stack. Returns the frame init or result.

§

fn frame_return_result( &mut self, result: <<Evm<CTX, INSP, I, P, EthFrame> as EvmTr>::Frame as FrameTr>::FrameResult, ) -> Result<Option<<<Evm<CTX, INSP, I, P, EthFrame> as EvmTr>::Frame as FrameTr>::FrameResult>, ContextError<<<<Evm<CTX, INSP, I, P, EthFrame> as EvmTr>::Context as ContextTr>::Db as Database>::Error>>

Returns the result of the frame to the caller. Frame is popped from the frame stack.

§

type Context = CTX

The context type that implements ContextTr to provide access to execution state
§

type Instructions = I

The instruction set type that implements InstructionProvider to define available operations
§

type Precompiles = P

The type containing the available precompiled contracts
§

type Frame = EthFrame

The type containing the frame
§

fn ctx(&mut self) -> &mut <Evm<CTX, INSP, I, P, EthFrame> as EvmTr>::Context

Returns a mutable reference to the execution context
§

fn ctx_ref(&self) -> &<Evm<CTX, INSP, I, P, EthFrame> as EvmTr>::Context

Returns an immutable reference to the execution context
§

fn frame_stack( &mut self, ) -> &mut FrameStack<<Evm<CTX, INSP, I, P, EthFrame> as EvmTr>::Frame>

Returns a mutable reference to the frame stack.
§

fn ctx_instructions( &mut self, ) -> (&mut <Evm<CTX, INSP, I, P, EthFrame> as EvmTr>::Context, &mut <Evm<CTX, INSP, I, P, EthFrame> as EvmTr>::Instructions)

Returns mutable references to both the context and instruction set. This enables atomic access to both components when needed.
§

fn ctx_precompiles( &mut self, ) -> (&mut <Evm<CTX, INSP, I, P, EthFrame> as EvmTr>::Context, &mut <Evm<CTX, INSP, I, P, EthFrame> as EvmTr>::Precompiles)

Returns mutable references to both the context and precompiles. This enables atomic access to both components when needed.
§

fn ctx_mut(&mut self) -> &mut Self::Context

Returns a mutable reference to the execution context
§

impl<CTX, INSP, INST, PRECOMPILES> ExecuteCommitEvm for Evm<CTX, INSP, INST, PRECOMPILES, EthFrame>
where CTX: ContextTr + ContextSetters, <CTX as ContextTr>::Journal: JournalTr<State = HashMap<Address, Account, RandomState>>, <CTX as ContextTr>::Db: DatabaseCommit, INST: InstructionProvider<Context = CTX, InterpreterTypes = EthInterpreter>, PRECOMPILES: PrecompileProvider<CTX, Output = InterpreterResult>,

§

fn commit( &mut self, state: <Evm<CTX, INSP, INST, PRECOMPILES, EthFrame> as ExecuteEvm>::State, )

Commit the state.
§

fn commit_inner(&mut self)

Finalize the state and commit it to the database. Read more
§

fn transact_commit( &mut self, tx: Self::Tx, ) -> Result<Self::ExecutionResult, Self::Error>

Transact the transaction and commit to the state.
§

fn transact_many_commit( &mut self, txs: impl Iterator<Item = Self::Tx>, ) -> Result<Vec<Self::ExecutionResult>, Self::Error>

Transact multiple transactions and commit to the state. Read more
§

fn replay_commit(&mut self) -> Result<Self::ExecutionResult, Self::Error>

Replay the transaction and commit to the state. Read more
§

impl<CTX, INSP, INST, PRECOMPILES> ExecuteEvm for Evm<CTX, INSP, INST, PRECOMPILES, EthFrame>
where CTX: ContextTr + ContextSetters, <CTX as ContextTr>::Journal: JournalTr<State = HashMap<Address, Account, RandomState>>, INST: InstructionProvider<Context = CTX, InterpreterTypes = EthInterpreter>, PRECOMPILES: PrecompileProvider<CTX, Output = InterpreterResult>,

§

type ExecutionResult = ExecutionResult

Output of transaction execution.
§

type State = HashMap<Address, Account, RandomState>

Output state type representing changes after execution.
§

type Error = EVMError<<<CTX as ContextTr>::Db as Database>::Error>

Error type
§

type Tx = <CTX as ContextTr>::Tx

Transaction type.
§

type Block = <CTX as ContextTr>::Block

Block type.
§

fn transact_one( &mut self, tx: <Evm<CTX, INSP, INST, PRECOMPILES, EthFrame> as ExecuteEvm>::Tx, ) -> Result<<Evm<CTX, INSP, INST, PRECOMPILES, EthFrame> as ExecuteEvm>::ExecutionResult, <Evm<CTX, INSP, INST, PRECOMPILES, EthFrame> as ExecuteEvm>::Error>

Execute transaction and store state inside journal. Returns output of transaction execution. Read more
§

fn finalize( &mut self, ) -> <Evm<CTX, INSP, INST, PRECOMPILES, EthFrame> as ExecuteEvm>::State

Finalize execution, clearing the journal and returning the accumulated state changes. Read more
§

fn set_block( &mut self, block: <Evm<CTX, INSP, INST, PRECOMPILES, EthFrame> as ExecuteEvm>::Block, )

Set the block.
§

fn replay( &mut self, ) -> Result<ExecResultAndState<ExecutionResult>, <Evm<CTX, INSP, INST, PRECOMPILES, EthFrame> as ExecuteEvm>::Error>

Execute previous transaction and finalize it.
§

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

Transact the given transaction and finalize in a single operation. Read more
§

fn transact_many( &mut self, txs: impl Iterator<Item = Self::Tx>, ) -> Result<Vec<Self::ExecutionResult>, Self::Error>

Execute multiple transactions without finalizing the state. Read more
§

fn transact_many_finalize( &mut self, txs: impl Iterator<Item = Self::Tx>, ) -> Result<ExecResultAndState<Vec<Self::ExecutionResult>, Self::State>, Self::Error>

Execute multiple transactions and finalize the state in a single operation. Read more
§

impl<CTX, INSP, INST, PRECOMPILES> InspectCommitEvm for Evm<CTX, INSP, INST, PRECOMPILES, EthFrame>
where CTX: ContextSetters + ContextTr, <CTX as ContextTr>::Journal: JournalTr<State = HashMap<Address, Account, RandomState>> + JournalExt, <CTX as ContextTr>::Db: DatabaseCommit, INSP: Inspector<CTX>, INST: InstructionProvider<Context = CTX, InterpreterTypes = EthInterpreter>, PRECOMPILES: PrecompileProvider<CTX, Output = InterpreterResult>,

§

fn inspect_tx_commit( &mut self, tx: Self::Tx, ) -> Result<Self::ExecutionResult, Self::Error>

Inspect the EVM with the current inspector and previous transaction by replaying, similar to InspectEvm::inspect_tx and commit the state diff to the database.
§

fn inspect_commit( &mut self, tx: Self::Tx, inspector: Self::Inspector, ) -> Result<Self::ExecutionResult, Self::Error>

Inspect the EVM with the given transaction and inspector similar to InspectEvm::inspect and commit the state diff to the database.
§

impl<CTX, INSP, INST, PRECOMPILES> InspectEvm for Evm<CTX, INSP, INST, PRECOMPILES, EthFrame>
where CTX: ContextSetters + ContextTr, <CTX as ContextTr>::Journal: JournalTr<State = HashMap<Address, Account, RandomState>> + JournalExt, INSP: Inspector<CTX>, INST: InstructionProvider<Context = CTX, InterpreterTypes = EthInterpreter>, PRECOMPILES: PrecompileProvider<CTX, Output = InterpreterResult>,

§

type Inspector = INSP

The inspector type used for inspecting EVM execution.
§

fn set_inspector( &mut self, inspector: <Evm<CTX, INSP, INST, PRECOMPILES, EthFrame> as InspectEvm>::Inspector, )

Set the inspector for the EVM. Read more
§

fn inspect_one_tx( &mut self, tx: <Evm<CTX, INSP, INST, PRECOMPILES, EthFrame> as ExecuteEvm>::Tx, ) -> Result<<Evm<CTX, INSP, INST, PRECOMPILES, EthFrame> as ExecuteEvm>::ExecutionResult, <Evm<CTX, INSP, INST, PRECOMPILES, EthFrame> as ExecuteEvm>::Error>

Inspect the EVM with the given transaction.
§

fn inspect_tx( &mut self, tx: Self::Tx, ) -> Result<ExecResultAndState<Self::ExecutionResult, Self::State>, Self::Error>

Inspect the EVM and finalize the state.
§

fn inspect( &mut self, tx: Self::Tx, inspector: Self::Inspector, ) -> Result<ExecResultAndState<Self::ExecutionResult, Self::State>, Self::Error>

Inspect the EVM with the given inspector and transaction, and finalize the state.
§

fn inspect_one( &mut self, tx: Self::Tx, inspector: Self::Inspector, ) -> Result<Self::ExecutionResult, Self::Error>

Inspect the EVM with the given inspector and transaction.
§

impl<CTX, INSP, I, P> InspectorEvmTr for Evm<CTX, INSP, I, P, EthFrame>
where CTX: ContextTr + ContextSetters, <CTX as ContextTr>::Journal: JournalExt, I: InstructionProvider<Context = CTX, InterpreterTypes = EthInterpreter>, P: PrecompileProvider<CTX, Output = InterpreterResult>, INSP: Inspector<CTX, <I as InstructionProvider>::InterpreterTypes>,

§

type Inspector = INSP

The inspector type used for EVM execution inspection.
§

fn inspector( &mut self, ) -> &mut <Evm<CTX, INSP, I, P, EthFrame> as InspectorEvmTr>::Inspector

Returns a mutable reference to the inspector.
§

fn ctx_inspector( &mut self, ) -> (&mut <Evm<CTX, INSP, I, P, EthFrame> as EvmTr>::Context, &mut <Evm<CTX, INSP, I, P, EthFrame> as InspectorEvmTr>::Inspector)

Returns a tuple of mutable references to the context and the inspector. Read more
§

fn ctx_inspector_frame( &mut self, ) -> (&mut <Evm<CTX, INSP, I, P, EthFrame> as EvmTr>::Context, &mut <Evm<CTX, INSP, I, P, EthFrame> as InspectorEvmTr>::Inspector, &mut <Evm<CTX, INSP, I, P, EthFrame> as EvmTr>::Frame)

Returns a tuple of mutable references to the context, the inspector and the frame. Read more
§

fn ctx_inspector_frame_instructions( &mut self, ) -> (&mut <Evm<CTX, INSP, I, P, EthFrame> as EvmTr>::Context, &mut <Evm<CTX, INSP, I, P, EthFrame> as InspectorEvmTr>::Inspector, &mut <Evm<CTX, INSP, I, P, EthFrame> as EvmTr>::Frame, &mut <Evm<CTX, INSP, I, P, EthFrame> as EvmTr>::Instructions)

Returns a tuple of mutable references to the context, the inspector, the frame and the instructions.
§

fn inspect_frame_init( &mut self, frame_init: <Self::Frame as FrameTr>::FrameInit, ) -> Result<ItemOrResult<&mut Self::Frame, <Self::Frame as FrameTr>::FrameResult>, ContextError<<<Self::Context as ContextTr>::Db as Database>::Error>>

Initializes the frame for the given frame input. Frame is pushed to the frame stack.
§

fn inspect_frame_run( &mut self, ) -> Result<ItemOrResult<<Self::Frame as FrameTr>::FrameInit, <Self::Frame as FrameTr>::FrameResult>, ContextError<<<Self::Context as ContextTr>::Db as Database>::Error>>

Run the frame from the top of the stack. Returns the frame init or result. Read more
§

impl<CTX, INSP, INST, PRECOMPILES> SystemCallCommitEvm for Evm<CTX, INSP, INST, PRECOMPILES, EthFrame>
where CTX: ContextTr + ContextSetters, <CTX as ContextTr>::Journal: JournalTr<State = HashMap<Address, Account, RandomState>>, <CTX as ContextTr>::Db: DatabaseCommit, <CTX as ContextTr>::Tx: SystemCallTx, INST: InstructionProvider<Context = CTX, InterpreterTypes = EthInterpreter>, PRECOMPILES: PrecompileProvider<CTX, Output = InterpreterResult>,

§

fn transact_system_call_with_caller_commit( &mut self, caller: Address, system_contract_address: Address, data: Bytes, ) -> Result<<Evm<CTX, INSP, INST, PRECOMPILES, EthFrame> as ExecuteEvm>::ExecutionResult, <Evm<CTX, INSP, INST, PRECOMPILES, EthFrame> as ExecuteEvm>::Error>

§

fn transact_system_call_commit( &mut self, system_contract_address: Address, data: Bytes, ) -> Result<Self::ExecutionResult, Self::Error>

Transact the system call and commit to the state.
§

impl<CTX, INSP, INST, PRECOMPILES> SystemCallEvm for Evm<CTX, INSP, INST, PRECOMPILES, EthFrame>
where CTX: ContextTr + ContextSetters, <CTX as ContextTr>::Journal: JournalTr<State = HashMap<Address, Account, RandomState>>, <CTX as ContextTr>::Tx: SystemCallTx, INST: InstructionProvider<Context = CTX, InterpreterTypes = EthInterpreter>, PRECOMPILES: PrecompileProvider<CTX, Output = InterpreterResult>,

§

fn transact_system_call_with_caller( &mut self, caller: Address, system_contract_address: Address, data: Bytes, ) -> Result<<Evm<CTX, INSP, INST, PRECOMPILES, EthFrame> as ExecuteEvm>::ExecutionResult, <Evm<CTX, INSP, INST, PRECOMPILES, EthFrame> as ExecuteEvm>::Error>

System call is a special transaction call that is used to call a system contract. Read more
§

fn transact_system_call( &mut self, system_contract_address: Address, data: Bytes, ) -> Result<Self::ExecutionResult, Self::Error>

§

fn transact_system_call_finalize( &mut self, system_contract_address: Address, data: Bytes, ) -> Result<ExecResultAndState<Self::ExecutionResult, Self::State>, Self::Error>

Transact the system call and finalize. Read more
§

fn transact_system_call_with_caller_finalize( &mut self, caller: Address, system_contract_address: Address, data: Bytes, ) -> Result<ExecResultAndState<Self::ExecutionResult, Self::State>, Self::Error>