pub struct StepTable { /* private fields */ }Expand description
The steps of a trace, in columns. See the module docs.
Implementations§
Source§impl StepTable
impl StepTable
pub fn new() -> Self
Sourcepub fn with_capacity(steps: usize) -> Self
pub fn with_capacity(steps: usize) -> Self
An empty table that holds steps steps without allocating its columns again.
Sourcepub fn try_from_steps(
steps: impl IntoIterator<Item = TraceStep>,
) -> Result<Self, StepError>
pub fn try_from_steps( steps: impl IntoIterator<Item = TraceStep>, ) -> Result<Self, StepError>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn get(&self, index: usize) -> Option<StepView<'_>>
pub fn first(&self) -> Option<StepView<'_>>
pub fn last(&self) -> Option<StepView<'_>>
pub fn iter(&self) -> Steps<'_> ⓘ
Sourcepub fn push(&mut self, step: TraceStep)
pub fn push(&mut self, step: TraceStep)
Appends a step built the way every backend builds one, sharing what did not change since the step before: its stack words, memory, storage and return data.
§Panics
When a stack word is not hex. A producer reading words from untrusted input, a node
or a file, appends with StepTable::try_push instead.
Sourcepub fn try_push(&mut self, step: TraceStep) -> Result<(), StepError>
pub fn try_push(&mut self, step: TraceStep) -> Result<(), StepError>
StepTable::push for a step whose stack words may not be hex.
§Errors
Returns a StepError when a stack word is not hex. Nothing is appended then.
Sourcepub fn append(
&mut self,
record: StepRecord,
stack: impl IntoIterator<Item = EvmWord>,
)
pub fn append( &mut self, record: StepRecord, stack: impl IntoIterator<Item = EvmWord>, )
Appends a step whose whole stack is stack, bottom first. The words the previous
step’s stack starts with are kept rather than stored again.
Sourcepub fn append_kept(
&mut self,
record: StepRecord,
kept: usize,
words: impl IntoIterator<Item = EvmWord>,
)
pub fn append_kept( &mut self, record: StepRecord, kept: usize, words: impl IntoIterator<Item = EvmWord>, )
Appends a step whose stack is the bottom kept words of the previous step’s with
words on top, for a producer that knows how much of the stack an instruction left
alone and so never copies the rest.
§Panics
When kept is more than the previous step’s stack holds.
Sourcepub fn start_memory_frame(&mut self)
pub fn start_memory_frame(&mut self)
Starts recording the memory of a new frame, empty, as a call or a creation starts
one: the steps appended from now on have it, as written with
StepTable::write_memory.
Sourcepub fn end_memory_frame(&mut self)
pub fn end_memory_frame(&mut self)
Stops recording the innermost frame’s memory, as its call returns; the steps appended from now on have its caller’s again.
Sourcepub fn write_memory(
&mut self,
offset: u64,
data: &[u8],
size: u64,
) -> Result<(), MemoryWriteError>
pub fn write_memory( &mut self, offset: u64, data: &[u8], size: u64, ) -> Result<(), MemoryWriteError>
Records that the step appended last wrote data at offset of its frame’s
memory, which is size bytes long afterwards; a write without data records memory
growing. The steps appended after it see the write: a step’s memory is the memory
it starts with.
§Errors
Returns a MemoryWriteError when the write ends past size or size is smaller
than the memory was. Nothing is recorded then.
Sourcepub fn storage_diffs(
&self,
) -> impl DoubleEndedIterator<Item = (usize, &BTreeMap<String, StorageChange>)>
pub fn storage_diffs( &self, ) -> impl DoubleEndedIterator<Item = (usize, &BTreeMap<String, StorageChange>)>
The steps that changed storage, with the slots they changed, in order.
Sourcepub fn transient_storage(
&self,
) -> impl DoubleEndedIterator<Item = (usize, &BTreeMap<String, String>)>
pub fn transient_storage( &self, ) -> impl DoubleEndedIterator<Item = (usize, &BTreeMap<String, String>)>
The steps that read or wrote transient storage, with the slots, in order.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for StepTable
impl<'de> Deserialize<'de> for StepTable
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Reads steps as written by any version, appending each as it is read so that a
file’s steps are never all resident as TraceSteps.
impl Eq for StepTable
Source§impl Extend<TraceStep> for StepTable
impl Extend<TraceStep> for StepTable
Source§fn extend<I: IntoIterator<Item = TraceStep>>(&mut self, steps: I)
fn extend<I: IntoIterator<Item = TraceStep>>(&mut self, steps: I)
§Panics
As StepTable::push.
Source§fn extend_one(&mut self, item: T)
fn extend_one(&mut self, item: T)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl FromIterator<TraceStep> for StepTable
impl FromIterator<TraceStep> for StepTable
Source§fn from_iter<I: IntoIterator<Item = TraceStep>>(steps: I) -> Self
fn from_iter<I: IntoIterator<Item = TraceStep>>(steps: I) -> Self
§Panics
As StepTable::push.