Locate the Source of a State Variable Write

Trace a final storage difference back to every SSTORE, trace index, and code location that produced it.

Case objective

Determine how many times a target storage slot changed, which trace produced each write, and which write formed the final value.

Example transaction and context

This case uses an Ethereum transaction from block 17806056:

0xa84aa065ce61dbb1eb50ab6ae67fc31a9da50dd2c74eefd561661bfce2f1620c

Open the transaction in Skylens

The target is slot 8 of the Curve pETH-ETH-f pool proxy at 0x9848482da3Ee3076165ce6497eDA906E66bB85C5. During this transaction, code from implementation 0x6326DEbBAa15bCFE603d831e7D75f4fc10d9B43E writes the proxy's state several times.

Questions to answer

  1. What are the before and after values of slot 8?
  2. How many intermediate writes occurred?
  3. Why do the code and state addresses differ?

Investigation steps

  1. In State Changes, expand the proxy and record the raw Before and After values for slot 8.
  2. Open the slot's Variable History and inspect every write in trace order.
  3. Jump to Execution Trace, enable the SSTORE filter, and verify the executing contract, Program Counter, and parent call.
  4. Use Set Breakpoints to group all five writes, then compare their Call Stack and variable context in Source Debugger.
  5. Treat the implementation as the source of code and storage layout while keeping the proxy as the state address.

Key evidence

The current layout does not decode the variable reliably, so this case uses the proxy address, slot, and raw value as stable identifiers.

TracePCBeforeAfter
6910460x14f4ef71451a6d379970x9c797cba0428105ecc1
8771900x9c797cba0428105ecc10x283517e49e6b3069518
10510460x283517e49e6b30695180xafba082befb269343e8
14471900xafba082befb269343e80xec4ae2b62e2a888e17
19431500xec4ae2b62e2a888e170x3f3278e0363aaefcf

The full final difference in State Changes is:

Address: 0x9848482da3Ee3076165ce6497eDA906E66bB85C5
Slot:    0x0000000000000000000000000000000000000000000000000000000000000008
Before:  0x00000000000000000000000000000000000000000000014f4ef71451a6d37997
After:   0x00000000000000000000000000000000000000000000003f3278e0363aaefcf

The first and last SSTORE values match State Changes exactly, showing that the intermediate history is complete.

Conclusion

Slot 8 on the proxy was written five times in one transaction. Trace 69 starts from the pre-transaction value and trace 194 produces the final value. The implementation supplied the executing code, but the state remained owned by the proxy.

Caveats

  • Do not assign a variable name to a raw slot until the storage layout is verified.
  • Mapping and dynamic-array slots are commonly derived with KECCAK256.
  • Intermediate writes can be overwritten or reverted with a child call.
  • Source shown for an implementation during DELEGATECALL does not mean the implementation owns the state.