Skip to main content

Status

  • Supported
  • Partially Supported
  • Not Supported Yet

Implementation Details

Required Cheatcodes

  • getCallInputs(address aa, bytes4 signature) - Gets call inputs with unique IDs
  • forkPreCall(uint256 id) - Forks to state at the start of a specific call
  • forkPostCall(uint256 id) - Forks to state after a specific call execution

Example Implementation

Protocol:
Assertion:

Implementation Notes

  • Call frame isolation:
    • Use getCallInputs() to retrieve all calls with their unique IDs
    • Each call has an id field that can be used with forkPreCall() and forkPostCall()
    • This allows validation at the individual function call level, not just transaction level
  • Benefits over transaction-level assertions:
    • Provides more precise state validation at the individual function call level
    • Allows validation of intermediate states within a transaction
    • Makes complex, multi-function transactions easier to validate
    • Can catch issues that would be masked by transaction-level checks
  • When to use call frame context vs transaction context:
    • Use forkPreCall()/forkPostCall() when you need to validate individual calls within a transaction
    • Use forkPreTx()/forkPostTx() when you only need to compare overall transaction state
    • Call frame context is especially useful for batch operations, multi-step protocols, or when validating intermediate states

Example Use Cases

  • Batch operations: Validate each individual operation within a batch transaction
  • Multi-step protocols: Check state at each step of a complex transaction
  • Oracle price updates: Verify each price update doesn’t exceed deviation limits (see Intra-TX Oracle Deviation)
  • Rate provider validation: Check rate changes before and after swaps (see Balancer V2 Stable Rate Exploit)

Known Limitations

  • Recursive function calls: Recursive calls will compound state changes similar to transaction-level execution. Users should ensure no recursive function calls are possible if precise call frame tracking is required.