Trait StateInterface

Source
pub trait StateInterface {
Show 22 methods // Required methods fn read_register(&self, register: u8) -> (U256, bool); fn set_register(&mut self, register: u8, value: U256, is_pointer: bool); fn current_frame(&mut self) -> impl CallframeInterface + '_; fn number_of_callframes(&self) -> usize; fn callframe(&mut self, n: usize) -> impl CallframeInterface + '_; fn read_heap_byte(&self, heap: HeapId, offset: u32) -> u8; fn read_heap_u256(&self, heap: HeapId, offset: u32) -> U256; fn write_heap_u256(&mut self, heap: HeapId, offset: u32, value: U256); fn flags(&self) -> Flags; fn set_flags(&mut self, flags: Flags); fn transaction_number(&self) -> u16; fn set_transaction_number(&mut self, value: u16); fn context_u128_register(&self) -> u128; fn set_context_u128_register(&mut self, value: u128); fn get_storage_state(&self) -> impl Iterator<Item = ((H160, U256), U256)>; fn get_transient_storage_state( &self, ) -> impl Iterator<Item = ((H160, U256), U256)>; fn get_transient_storage(&self, address: H160, slot: U256) -> U256; fn write_transient_storage( &mut self, address: H160, slot: U256, value: U256, ); fn events(&self) -> impl Iterator<Item = Event>; fn l2_to_l1_logs(&self) -> impl Iterator<Item = L2ToL1Log>; fn pubdata(&self) -> i32; fn set_pubdata(&mut self, value: i32);
}
Expand description

Public interface of the VM state. Encompasses both read and write methods.

Required Methods§

Source

fn read_register(&self, register: u8) -> (U256, bool)

Reads a register with the specified zero-based index. Returns a value together with a pointer flag.

Source

fn set_register(&mut self, register: u8, value: U256, is_pointer: bool)

Sets a register with the specified zero-based index

Source

fn current_frame(&mut self) -> impl CallframeInterface + '_

Returns a mutable handle to the current call frame.

Source

fn number_of_callframes(&self) -> usize

Returns the total number of call frames.

Source

fn callframe(&mut self, n: usize) -> impl CallframeInterface + '_

Returns a mutable handle to a call frame with the specified index, where zero is the current frame, one is the frame before that etc.

Source

fn read_heap_byte(&self, heap: HeapId, offset: u32) -> u8

Reads a single byte from the specified heap at the specified 0-based offset.

Source

fn read_heap_u256(&self, heap: HeapId, offset: u32) -> U256

Reads an entire U256 word in the big-endian order from the specified heap / offset (which is the index of the most significant byte of the read value).

Source

fn write_heap_u256(&mut self, heap: HeapId, offset: u32, value: U256)

Writes an entire U256 word in the big-endian order to the specified heap at the specified offset (which is the index of the most significant byte of the written value).

Source

fn flags(&self) -> Flags

Returns current execution flags.

Source

fn set_flags(&mut self, flags: Flags)

Sets current execution flags.

Source

fn transaction_number(&self) -> u16

Returns the currently set 0-based transaction number.

Source

fn set_transaction_number(&mut self, value: u16)

Sets the current transaction number.

Source

fn context_u128_register(&self) -> u128

Returns the value of the context register.

Source

fn set_context_u128_register(&mut self, value: u128)

Sets the value of the context register.

Source

fn get_storage_state(&self) -> impl Iterator<Item = ((H160, U256), U256)>

Iterates over storage slots read or written during VM execution.

Source

fn get_transient_storage_state( &self, ) -> impl Iterator<Item = ((H160, U256), U256)>

Iterates over all transient storage slots set during VM execution.

Source

fn get_transient_storage(&self, address: H160, slot: U256) -> U256

Gets value of the specified transient storage slot.

Source

fn write_transient_storage(&mut self, address: H160, slot: U256, value: U256)

Sets value of the specified transient storage slot.

Source

fn events(&self) -> impl Iterator<Item = Event>

Iterates over events emitted during VM execution.

Source

fn l2_to_l1_logs(&self) -> impl Iterator<Item = L2ToL1Log>

Iterates over L2-to-L1 logs emitted during VM execution.

Source

fn pubdata(&self) -> i32

Gets the current amount of published pubdata.

Source

fn set_pubdata(&mut self, value: i32)

Sets the current amount of published pubdata.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§