truffle icon indicating copy to clipboard operation
truffle copied to clipboard

Add system for debugger to track storage not accessed in transaction

Open haltman-at opened this issue 5 years ago • 6 comments

Issue

Currently, the debugger can only see the contents of storage slots that have been accessed so far during the transaction being debugged; similarly it can only see mapping keys that have been accessed during the transaction being debugged. This problem came up recently in for instance #2889.

The idea is to allow one to load a transaction in "reconstruct mode", in which all relevant storage will be reconstructed beforehand, so that storage variables will have accurate values even if they haven't been accessed so far during the transaction.

Also, reconstruct mode should allow manual watching of mapping keys. However, note that in order for this to work, one would necessarily have to restart the transaction for watching a mapping key to take effect.

haltman-at avatar Mar 17 '20 20:03 haltman-at

Also, in addition to storage, this mode would track nonces. And, of course, bytecode.

Later versions would probably also add balance tracking, but storage, bytecode, and nonce should suffice for an initial version; balance can come later.

haltman-at avatar Mar 30 '20 23:03 haltman-at

Oh, and the self-destruct list. That would need to go in the initial version too (as part of tracking bytecode).

haltman-at avatar Apr 15 '20 05:04 haltman-at

The idea here has now changed -- instead of a separate mode, this will be the debugger's default operation, and it will be based on debug_storageRangeAt and debug_accountAt. (@gnidan this seems worth re-prioritizing right?)

haltman-at avatar Feb 20 '21 00:02 haltman-at

Btw, also note that, doing things this new way, one would no longer have to restart the transaction for manual watches to take effect!

haltman-at avatar Oct 14 '21 21:10 haltman-at

Be aware though: The behavior of nonces changed back in Spurious Dragon! Before Spurious Dragon, contracts started at 0; now they start at 1.

haltman-at avatar Feb 17 '22 21:02 haltman-at

pull#5286 is merged and made it to the latest release v5.5.22. Not closing since feature is added to library, but not yet the CLI.

cliffoo avatar Jul 15 '22 22:07 cliffoo