fix: Geth trace inconsistence with self-destruct #173
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The inconsistent problem in getting the Geth Debug trace result of a transaction
which includes a
suicide
/selfdestruct
call type.Reproducible Example
With the latest version reth v1.0.3, using
debug_traceTransaction()
andcallTracer
to tracethe transaction
0x47e9962fec372e5c34e650cbd094e396fe6278cd7b0ee5d34bccfe2739809e9c
From Reth
which is a two-layer nested structure, and
the
from
field ofSELFDESTRUCT
call is0x322237f0f8d0cf75c413d76fbbbb658cd2edf7c1
From Etherscan and QuickNode
which is a three-layer nested structure, and
the
from
field ofSELFDESTRUCT
call is0x480641f98eaeb20a12e7c7fa29e4dc7649245cfb
More Examples
0xc71cea6fa00d11e98f6733ee8740f239cb37b11dec29e7cf85d7a4077977fa65
0x9610e6727b31f207d169013c470c3a7b2964ff67b3f0f169c272e99a6c0694ce
0x1cc935268fe1a77d130574a44abe2f44d427c3f9bb3e035dd6438dd8a898b67a
Solution
The
selfdestruct
call trace should not be added as an additionalCallFrame
object to the parent of the call trace where it is derived from, such that it is in the same level of the call trace where it is derived from.It should be added as the first child of the call trace where it is derived from.
The
from
field in itsCallFrame
object should beself.trace.address
rather thanself.trace.caller