Status
- Supported
- Partially Supported
- Not Supported Yet
Implementation Details
Required Cheatcodes
getStateChanges(address aa, bytes32 slot)
Example Implementation
Protocol:Implementation Notes
-
Storage access helpers:
- The
getStateChangesTYPE()helper functions return the changes for the given slot cast to the respective type - Storage layout packing has to be handled by the user
- The
-
State change ordering:
- The
getStateChanges()function returns the changes in order of changes being made - To access values of a mapping, the slot has to be calculated manually
- The pre-execution value is not included in the state changes
- The
Example Use Cases
-
Make sure that a variable never changes its value:
- Implementation slot of a proxy
- Owner of a contract
-
Make sure assigned values meet certain criteria:
- Price oracle increases/decreases max by x%
- Address changed to a whitelisted value
Implementation Considerations
-
Slot granularity
- Request state changes at the slot level
- Use the target contract’s storage layout to select the right slot
- Shift or mask values when the relevant variable occupies only part of a packed slot
-
Slot Coupling
- Treat arrays of state changes for different slots as independent observations
- Align values across slots only when your assertion explicitly establishes that relationship
- Use protocol-specific knowledge of write order when timing relationships matter
- Treat arrays of state changes for different slots as independent observations
Future Improvements
- Provide variable level access
- Allow masking/shifting for correct bits of the slot in helper functions
- Allow coupling of variables
- stateChanges provide snapshots of the requested slots

