Trait InstanceState

Source
pub trait InstanceState {
    // Required methods
    fn get_points_used(&mut self) -> Result<u64, ExecutorError>;
    fn set_points_used(&mut self, points: u64) -> Result<(), ExecutorError>;
    fn memory_load_to_slice(
        &self,
        mem_ptr: MemPtr,
        dest: &mut [u8],
    ) -> Result<(), ExecutorError>;
    fn memory_load_owned(
        &self,
        mem_ptr: MemPtr,
        mem_length: MemLength,
    ) -> Result<Vec<u8>, ExecutorError>;
    fn memory_store(
        &self,
        mem_ptr: MemPtr,
        data: &[u8],
    ) -> Result<(), ExecutorError>;
}
Expand description

The interface through which VM hooks update the instance state.

Required Methods§

Source

fn get_points_used(&mut self) -> Result<u64, ExecutorError>

Returns the number of points(gas) used by the given instance.

Source

fn set_points_used(&mut self, points: u64) -> Result<(), ExecutorError>

Sets the number of points(gas) for the given instance.

Source

fn memory_load_to_slice( &self, mem_ptr: MemPtr, dest: &mut [u8], ) -> Result<(), ExecutorError>

Copies data to new owned buffer.

Source

fn memory_load_owned( &self, mem_ptr: MemPtr, mem_length: MemLength, ) -> Result<Vec<u8>, ExecutorError>

Copies data to new owned buffer.

Source

fn memory_store( &self, mem_ptr: MemPtr, data: &[u8], ) -> Result<(), ExecutorError>

Loads data to given slice. In certain cases

Implementors§