Trait EvmTr

pub trait EvmTr {
    type Context: ContextTr;
    type Instructions: InstructionProvider;
    type Precompiles: PrecompileProvider<Self::Context>;
    type Frame: FrameTr;

    // Required methods
    fn ctx(&mut self) -> &mut Self::Context;
    fn ctx_ref(&self) -> &Self::Context;
    fn ctx_instructions(
        &mut self,
    ) -> (&mut Self::Context, &mut Self::Instructions);
    fn ctx_precompiles(
        &mut self,
    ) -> (&mut Self::Context, &mut Self::Precompiles);
    fn frame_stack(&mut self) -> &mut FrameStack<Self::Frame>;
    fn frame_init(
        &mut self,
        frame_input: <Self::Frame as FrameTr>::FrameInit,
    ) -> Result<ItemOrResult<&mut Self::Frame, <Self::Frame as FrameTr>::FrameResult>, ContextError<<<Self::Context as ContextTr>::Db as Database>::Error>>;
    fn 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>>;
    fn frame_return_result(
        &mut self,
        result: <Self::Frame as FrameTr>::FrameResult,
    ) -> Result<Option<<Self::Frame as FrameTr>::FrameResult>, ContextError<<<Self::Context as ContextTr>::Db as Database>::Error>>;

    // Provided method
    fn ctx_mut(&mut self) -> &mut Self::Context { ... }
}
Expand description

A trait that integrates context, instruction set, and precompiles to create an EVM struct.

In addition to execution capabilities, this trait provides getter methods for its component fields.

Required Associated Types§

type Context: ContextTr

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

type Instructions: InstructionProvider

The instruction set type that implements InstructionProvider to define available operations

type Precompiles: PrecompileProvider<Self::Context>

The type containing the available precompiled contracts

type Frame: FrameTr

The type containing the frame

Required Methods§

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

Returns a mutable reference to the execution context

fn ctx_ref(&self) -> &Self::Context

Returns an immutable reference to the execution context

fn ctx_instructions(&mut self) -> (&mut Self::Context, &mut Self::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 Self::Context, &mut Self::Precompiles)

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

fn frame_stack(&mut self) -> &mut FrameStack<Self::Frame>

Returns a mutable reference to the frame stack.

fn frame_init( &mut self, frame_input: <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 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.

If frame has returned result it would mark it as finished.

fn frame_return_result( &mut self, result: <Self::Frame as FrameTr>::FrameResult, ) -> Result<Option<<Self::Frame as FrameTr>::FrameResult>, ContextError<<<Self::Context as ContextTr>::Db as Database>::Error>>

Returns the result of the frame to the caller. Frame is popped from the frame stack. Consumes the frame result or returns it if there is more frames to run.

Provided Methods§

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

Returns a mutable reference to the execution context

Implementations on Foreign Types§

§

impl<'a, T> EvmTr for &'a mut T
where T: 'a + EvmTr + ?Sized,

§

type Context = <T as EvmTr>::Context

§

type Instructions = <T as EvmTr>::Instructions

§

type Precompiles = <T as EvmTr>::Precompiles

§

type Frame = <T as EvmTr>::Frame

§

fn ctx(&mut self) -> &mut <&'a mut T as EvmTr>::Context

§

fn ctx_mut(&mut self) -> &mut <&'a mut T as EvmTr>::Context

§

fn ctx_ref(&self) -> &<&'a mut T as EvmTr>::Context

§

fn ctx_instructions( &mut self, ) -> (&mut <&'a mut T as EvmTr>::Context, &mut <&'a mut T as EvmTr>::Instructions)

§

fn ctx_precompiles( &mut self, ) -> (&mut <&'a mut T as EvmTr>::Context, &mut <&'a mut T as EvmTr>::Precompiles)

§

fn frame_stack(&mut self) -> &mut FrameStack<<&'a mut T as EvmTr>::Frame>

§

fn frame_init( &mut self, frame_input: <<&'a mut T as EvmTr>::Frame as FrameTr>::FrameInit, ) -> Result<ItemOrResult<&mut <&'a mut T as EvmTr>::Frame, <<&'a mut T as EvmTr>::Frame as FrameTr>::FrameResult>, ContextError<<<<&'a mut T as EvmTr>::Context as ContextTr>::Db as Database>::Error>>

§

fn frame_run( &mut self, ) -> Result<ItemOrResult<<<&'a mut T as EvmTr>::Frame as FrameTr>::FrameInit, <<&'a mut T as EvmTr>::Frame as FrameTr>::FrameResult>, ContextError<<<<&'a mut T as EvmTr>::Context as ContextTr>::Db as Database>::Error>>

§

fn frame_return_result( &mut self, result: <<&'a mut T as EvmTr>::Frame as FrameTr>::FrameResult, ) -> Result<Option<<<&'a mut T as EvmTr>::Frame as FrameTr>::FrameResult>, ContextError<<<<&'a mut T as EvmTr>::Context as ContextTr>::Db as Database>::Error>>

§

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

§

fn frame_return_result( &mut self, result: <<OpEvm<CTX, INSP, I, P> as EvmTr>::Frame as FrameTr>::FrameResult, ) -> Result<Option<<<OpEvm<CTX, INSP, I, P> as EvmTr>::Frame as FrameTr>::FrameResult>, ContextError<<<<OpEvm<CTX, INSP, I, P> 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. Consumes the frame result or returns it if there is more frames to run.

§

type Context = CTX

§

type Instructions = I

§

type Precompiles = P

§

type Frame = EthFrame

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

impl<T> EvmTr for Box<T>
where T: EvmTr + ?Sized,

§

type Context = <T as EvmTr>::Context

§

type Instructions = <T as EvmTr>::Instructions

§

type Precompiles = <T as EvmTr>::Precompiles

§

type Frame = <T as EvmTr>::Frame

§

fn ctx(&mut self) -> &mut <Box<T> as EvmTr>::Context

§

fn ctx_mut(&mut self) -> &mut <Box<T> as EvmTr>::Context

§

fn ctx_ref(&self) -> &<Box<T> as EvmTr>::Context

§

fn ctx_instructions( &mut self, ) -> (&mut <Box<T> as EvmTr>::Context, &mut <Box<T> as EvmTr>::Instructions)

§

fn ctx_precompiles( &mut self, ) -> (&mut <Box<T> as EvmTr>::Context, &mut <Box<T> as EvmTr>::Precompiles)

§

fn frame_stack(&mut self) -> &mut FrameStack<<Box<T> as EvmTr>::Frame>

§

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

§

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

§

fn frame_return_result( &mut self, result: <<Box<T> as EvmTr>::Frame as FrameTr>::FrameResult, ) -> Result<Option<<<Box<T> as EvmTr>::Frame as FrameTr>::FrameResult>, ContextError<<<<Box<T> as EvmTr>::Context as ContextTr>::Db as Database>::Error>>

Implementors§

§

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>,

§

type Context = CTX

§

type Instructions = I

§

type Precompiles = P

§

type Frame = EthFrame