EIP-4760 The SELFDESTRUCT bomb (SELFDESTRUCT bomb)

No call decision · EVM & execution · EIP status Stagnant · created 2022-02-03

A proposal that doubles the gas cost of the SELFDESTRUCT opcode repeatedly over a period of time, making it effectively unusable, and then renames and reduces it to SENDALL, which sends only the ETH to the caller while leaving code and storage intact.

Why it is needed

Currently, SELFDESTRUCT is an opcode that erases an account's code, storage, and nonce all at once and sends the balance. However, once the way account data is stored switches to Verkle trees in the future, a single account will be split across several separate keys with no clear link back to a root account. Under this structure, implementing an operation like SELFDESTRUCT that erases an entire account at once becomes difficult. So instead of removing SELFDESTRUCT abruptly, this EIP gradually raises its gas cost to give developers time to notice and adapt, then scales the functionality down to ETH transfer only.

What changes

Today

After EIP-4760

Who is affected

In depth

Change to the opcode's name and functionality

This EIP renames SELFDESTRUCT to SENDALL and reduces its functionality. After the transition completes, this opcode only immediately sends all ETH remaining in the account to the caller, and no longer erases the account's code or storage or changes its nonce. Applications that used SELFDESTRUCT solely to recover a balance will continue to work after the transition.

The gradual gas cost increase formula

The constants are OLD_SELFDESTRUCT_COST=5000, HARD_FORK_BLOCK (the Shanghai hard fork block height, marked TBD in the original text), DOUBLING_SLOTS=2^16 (roughly 9 days), and DOUBLINGS_BEFORE_SENDALL=13. From HARD_FORK_BLOCK until HARD_FORK_BLOCK + DOUBLING_SLOTS*DOUBLINGS_BEFORE_SENDALL, SELFDESTRUCT's functionality stays the same while only the gas cost rises according to the formula OLD_SELFDESTRUCT_COST * 2 ** ((slot - HARD_FORK_BLOCK) // DOUBLING_SLOTS).

Behavior after the transition completes

Once slot reaches HARD_FORK_BLOCK + DOUBLING_SLOTS*DOUBLINGS_BEFORE_SENDALL or later, the gas cost returns to OLD_SELFDESTRUCT_COST (5000) and the opcode is renamed to SENDALL, leaving only the behavior of immediately moving ETH to the destination. At this point all gas refunds related to SELFDESTRUCT are also removed.

Why this is needed: conflict with Verkle trees

SELFDESTRUCT is an opcode that erases an account's code and storage, requiring a large change to state. Under the Verkle trees to be introduced in the future, a single account will be split across several different account keys with no clear link back to a root account. Under this structure, the kind of bulk deletion SELFDESTRUCT requires becomes difficult, so this EIP cleans up that functionality in advance.

Backward compatibility and CREATE2 redeployment

This change alters consensus rules and therefore requires a hard fork. The text states that few applications are affected, and the only use case that breaks is redeploying a contract to the same address via CREATE2. It states that applications using this pattern are amenable to code analysis and have ample time to transition to another approach.

Security considerations

There are two use cases that break. First, using SELFDESTRUCT to burn token balances such as ERC20 tokens; the text states it is not aware of such a use case (since sending to a burn address is easier). Second, redeploying a contract to the same spot via CREATE2. Of these, the pattern of using SELFDESTRUCT to block access after a specific task can easily be changed to another approach, but the pattern used for contract upgrades is not supported, and the text explains that a delegate approach must be used instead.

Current status

This EIP's status is Stagnant. No separate decision on fork inclusion is confirmed in the call records.

Original EIP · ← EIPs