-
Notifications
You must be signed in to change notification settings - Fork 21.5k
Closed
Description
As per EIP-6780 a contract is fully selfdestructed if it was created within the same tx-scope. Otherwise it will act as send all, transfering all ether to recipient. The tracing behaviour here needs discussion as pointed out by @nebojsa94. Current behaviour is:
- OnEnter(SELFDESTRUCT, ...) is emitted after trying to selfdestruct, even if contract is "old" and cannot be deleted.
- OnBalanceChange is emitted only if an actual transfer took place (prev balance > 0)
- OnCodeChange is emitted if contract was destroyed
The question is if OnEnter(SELFDESTRUCT) should be emitted even if contract wasn't destroyed due to being "old".
Note: I realized while reviewing the code we have a bug in the OnBalanceChange emitting logic:
go-ethereum/core/state/statedb_hooked.go
Line 245 in c3ef6c7
| if s.hooks.OnBalanceChange != nil && changed && !prev.IsZero() { |
This condition seems wrong. Even if changed == false the transfer can take place.
Metadata
Metadata
Assignees
Labels
No labels