Skip to main content
Modified key discovery returns the keys for entries in a known Solidity mapping that were written during a transaction. Use ph.changedMappingKeys to enumerate written keys and ph.mappingValueDiff to read each entry’s pre- and post-transaction values.

Status

Supported by the V2 Reshiram assertion specification.
Choose the assertion specification supported by your target Ethereum deployment. Reshiram (V2) helpers require V2 support in the enforcer; a local test passing does not establish deployment compatibility. Earlier Linea-specific restrictions are documented in L2 Platform Notes.

Interface

baseSlot is the mapping’s declared storage slot. Each returned key is the encoded mapping-key preimage used to derive keccak256(key ++ baseSlot). For a mapping whose value is a struct, set fieldOffset to the field’s offset from the derived entry slot.

Example

Behavior and Constraints

  • Discovery is scoped to entries written by the current transaction. It includes same-value SSTORE operations, for which mappingValueDiff returns changed as false.
  • The mapping base slot and any struct field offset must be known.
  • Discovery is best effort. Custom inline assembly or precomputed hashed storage slots can prevent the runtime from recovering a key.
  • Nested mappings are not discoverable from the outer mapping slot because the outer entry hash is used as the inner base slot rather than written to storage.

Uses

  • Validate limits for every balance or position modified by a transaction.
  • Reconcile modified entries against aggregate accounting.
  • Apply field-specific checks to mapping values stored as structs.