Trait LocalContextTr

Source
pub trait LocalContextTr {
    // Required methods
    fn insert_initcodes(&mut self, initcodes: &[Bytes]);
    fn get_validated_initcode(&mut self, hash: B256) -> Option<Bytes>;
    fn shared_memory_buffer(&self) -> &Rc<RefCell<Vec<u8>>>;
    fn clear(&mut self);

    // Provided method
    fn shared_memory_buffer_slice(
        &self,
        range: Range<usize>,
    ) -> Option<Ref<'_, [u8]>> { ... }
}
Expand description

Local context used for caching initcode from Initcode transactions.

Required Methods§

Source

fn insert_initcodes(&mut self, initcodes: &[Bytes])

Get the local context

Source

fn get_validated_initcode(&mut self, hash: B256) -> Option<Bytes>

Get validated initcode by hash. if initcode is not validated it is assumed that validation is going to be performed inside this function.

Source

fn shared_memory_buffer(&self) -> &Rc<RefCell<Vec<u8>>>

Interpreter shared memory buffer. A reused memory buffer for calls.

Source

fn clear(&mut self)

Clear the local context.

Provided Methods§

Source

fn shared_memory_buffer_slice( &self, range: Range<usize>, ) -> Option<Ref<'_, [u8]>>

Slice of the shared memory buffer returns None if range is not valid or buffer can’t be borrowed.

Implementors§