Skip to main content

RuntimeExecutor

Trait RuntimeExecutor 

Source
pub trait RuntimeExecutor {
    // Required methods
    fn execute(
        &mut self,
        bytecode_or_hash: BytecodeOrHash,
        ctx: RuntimeContext,
    ) -> ExecutionResult;
    fn resume(
        &mut self,
        call_id: u32,
        return_data: &[u8],
        fuel16_ptr: u32,
        fuel_consumed: u64,
        fuel_refunded: i64,
        exit_code: i32,
    ) -> ExecutionResult;
    fn forget_runtime(&mut self, call_id: u32);
    fn warmup(&mut self, bytecode: RwasmModule, hash: B256, address: Address);
    fn reset_call_id_counter(&mut self);
    fn memory_read(
        &mut self,
        call_id: u32,
        offset: usize,
        buffer: &mut [u8],
    ) -> Result<(), TrapCode>;
}

Required Methods§

Source

fn execute( &mut self, bytecode_or_hash: BytecodeOrHash, ctx: RuntimeContext, ) -> ExecutionResult

Executes the entry function of the module determined by the current execution state.

Returns either a finalized result.

Source

fn resume( &mut self, call_id: u32, return_data: &[u8], fuel16_ptr: u32, fuel_consumed: u64, fuel_refunded: i64, exit_code: i32, ) -> ExecutionResult

Resumes a previously interrupted runtime.

fuel16_ptr optionally points to a 16-byte buffer where fuel consumption and refund are written back.

Source

fn forget_runtime(&mut self, call_id: u32)

Drop a runtime we don’t need to resume anymore

Source

fn warmup(&mut self, bytecode: RwasmModule, hash: B256, address: Address)

Warm up the bytecode

Source

fn reset_call_id_counter(&mut self)

Resets the per-transaction call identifier counter and clears recoverable runtimes.

Intended to be invoked at the beginning of a new transaction.

Source

fn memory_read( &mut self, call_id: u32, offset: usize, buffer: &mut [u8], ) -> Result<(), TrapCode>

Implementors§