pub trait EvmState: Debug {
type Word: EvmWord;
type Stack: EvmStack<Word = Self::Word>;
type Memory: EvmMemory<Word = Self::Word>;
type Storage: EvmStorage<Word = Self::Word>;
// Required methods
fn pc(&self) -> usize;
fn stack(&self) -> &Self::Stack;
fn stack_mut(&mut self) -> &mut Self::Stack;
fn memory(&self) -> &Self::Memory;
fn memory_mut(&mut self) -> &mut Self::Memory;
fn storage(&self) -> &Self::Storage;
fn storage_mut(&mut self) -> &mut Self::Storage;
fn skip(&mut self, n: usize);
fn goto(&mut self, pc: usize);
}
Expand description
Describes the state of an EVM at a given point (which could be running or terminated). In essence, this simply packages all the key components (e.g. stack, memory, storage) of the EVM state together.
An EvmState
can be concrete or abstract. For example, a
physically executing EVM operates over concrete states which are
updated after each executed instruction. In contrast, a static
analysis over a sequence of EVM bytecodes produces abstract states
at each point which summarise the set of all possible states at
that point.
Required Associated Types§
sourcetype Word: EvmWord
type Word: EvmWord
Defines what constitutes a word in this EVM. For example, a
concrete evm will use a w256
here whilst an abstract evm
will use something that can, for example, describe unknown
values.
sourcetype Storage: EvmStorage<Word = Self::Word>
type Storage: EvmStorage<Word = Self::Word>
Defines the memory implementation used in this EVM.
Required Methods§
sourcefn stack(&self) -> &Self::Stack
fn stack(&self) -> &Self::Stack
Get read access to the operand stack contained within this state.
sourcefn stack_mut(&mut self) -> &mut Self::Stack
fn stack_mut(&mut self) -> &mut Self::Stack
Get write access to the operand stack contained within this state.
sourcefn memory(&self) -> &Self::Memory
fn memory(&self) -> &Self::Memory
Get read access to the scratch memory contained within this state.
sourcefn memory_mut(&mut self) -> &mut Self::Memory
fn memory_mut(&mut self) -> &mut Self::Memory
Get write access to the scratch memory contained within this state.
sourcefn storage(&self) -> &Self::Storage
fn storage(&self) -> &Self::Storage
Get read access to the persistent storage contained within this state.
sourcefn storage_mut(&mut self) -> &mut Self::Storage
fn storage_mut(&mut self) -> &mut Self::Storage
Get write access to the persistent storage contained within this state.