The tracing of SELFDESTRUCT's presents a challenge. The "account destruction row" requires knowledge of the account in question at the end of the TX including any and all (gas / balance) refunds ... This is required in case the account that SELFDESTRUCT's is the COINBASE or the TO address.
Solution
We will actually have the tools to do this. Indeed @daniellehrner moved the traceEndTx hook to right after the refund of the coinbase address. At this point we are provided with the SELFDESTRUCT set. We must shapshot these accounts before they are removed from the state. These snapshots are what we require in the trace production at the time of SELFDESTRUCT'ing.
Main point
The tracing of SELFDESTRUCT's presents a challenge. The "account destruction row" requires knowledge of the account in question at the end of the TX including any and all (gas / balance) refunds ... This is required in case the account that SELFDESTRUCT's is the COINBASE or the TO address.
Solution
We will actually have the tools to do this. Indeed @daniellehrner moved the
traceEndTx
hook to right after the refund of thecoinbase
address. At this point we are provided with the SELFDESTRUCT set. We must shapshot these accounts before they are removed from the state. These snapshots are what we require in the trace production at the time of SELFDESTRUCT'ing.