Expand description
State variables at a step, read through the compiler’s storage layout.
solc --storage-layout says where every state variable lives; the trace says what
the words there held. Putting the two together answers print counter or print balances[0xabc] without ETHDebug variable information, and does so from
compiler-issued fact only: the slot arithmetic is the language’s own rule, and the
words are what the backend recorded.
A backend records a slot at the SLOAD or SSTORE that touches it, not at every
step, so the value at a step is the most recent record for that slot in the same
storage context. A trace is a complete recording, so that is a lookup on the tape
rather than a guess: StorageTape indexes every record once, keyed by the account
whose storage it belongs to, and a DELEGATECALL writes the caller’s. A frame that
reverted did not keep its writes, so after it a slot holds what it held before the
frame — and if that was never read, it is unknown again.
A slot with no record yet is unknown here, because the trace does not say what is in
it. A frontend that has a node can supply one through ChainStorage, which is read
only for slots the trace never recorded, and the value is then marked as coming from
the chain rather than from the recording. Without one, unknown is reported as unknown
and never as zero: this crate has no chain to ask, and it does not pretend to.
Transient storage is a second tape, StorageTape::transient, where a slot with no
record is zero: the space starts empty in every transaction.
Structs§
- Cached
Chain - A
ChainStoragethat reads each slot once, through a function the frontend gives. - State
Variable - One state variable, or one place inside one, with its value at a step.
- Storage
Tape - Every storage word a trace recorded, by storage context and slot.
- Storage
Words - The storage words known at one step, in one storage context.
Enums§
- State
Source - Where a value came from.
Traits§
- Chain
Storage - A chain a frontend can read storage from, for slots the trace never recorded.
Functions§
- short_
hex 0x-prefixed hex without leading zeros;0x0for zero.- state_
value - The value at a storage path such as
owner,balances[0xabc],items[2], orconfig.limit.Errsays why the path does not name a place in storage. - state_
variables - Every state variable in the layout, with its value at the step.
Type Aliases§
- Chain
Read - The reading a frontend supplies: one storage word of one account, or nothing.