Skip to content

EIP-6780 selfdestruct tracing behaviour #32376

@s1na

Description

@s1na

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:

if s.hooks.OnBalanceChange != nil && changed && !prev.IsZero() {

This condition seems wrong. Even if changed == false the transfer can take place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions