pub struct StepSnapshot {
pub stack: Vec<Word>,
pub memory: Option<Bytes>,
pub storage: Arc<BTreeMap<String, String>>,
pub storage_diff: BTreeMap<String, StorageChange>,
pub transient_storage: BTreeMap<String, String>,
pub return_data: Option<Arc<str>>,
}Expand description
The machine state one step captured.
memory and storage are shared: a backend building steps hands the previous step’s
value on unchanged, so a trace holds one copy of memory per change rather than one
per step. Reads see plain values through Deref; a step that changes them gets its
own.
Memory is held as bytes. Trace files spell it as one unprefixed lowercase hex string, and serialization writes and reads that spelling, so the bytes are only a change in how a step holds memory, not in what a file says.
Fields§
§stack: Vec<Word>§memory: Option<Bytes>Memory as bytes. A Bytes clone shares the buffer, which is how consecutive
steps hold one copy of unchanged memory.
storage: Arc<BTreeMap<String, String>>§storage_diff: BTreeMap<String, StorageChange>§transient_storage: BTreeMap<String, String>The transient slots this step read or wrote, with their value after it.
return_data: Option<Arc<str>>The return data buffer before this step, as unprefixed hex; None when empty.
Implementations§
Source§impl StepSnapshot
impl StepSnapshot
Sourcepub fn new(
stack: Vec<Word>,
memory: Option<Bytes>,
storage: BTreeMap<String, String>,
storage_diff: BTreeMap<String, StorageChange>,
) -> Self
pub fn new( stack: Vec<Word>, memory: Option<Bytes>, storage: BTreeMap<String, String>, storage_diff: BTreeMap<String, StorageChange>, ) -> Self
A snapshot that owns its values, for a backend or a test building one from parts.
Sourcepub fn with_transient_storage(
self,
transient_storage: BTreeMap<String, String>,
) -> Self
pub fn with_transient_storage( self, transient_storage: BTreeMap<String, String>, ) -> Self
The same snapshot with transient_storage set.
Sourcepub fn with_return_data(self, return_data: Option<String>) -> Self
pub fn with_return_data(self, return_data: Option<String>) -> Self
The same snapshot with return_data set; empty data is stored as None.