EIP-4747 Simplification of EIP-161 Rules (Simplify EIP-161)

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

This retroactively removes from the specification the exception cases in the empty account handling rules defined by EIP-161 that have never actually occurred on Ethereum mainnet and cannot occur in the future, simplifying implementation.

Why it is needed

EIP-161 prevents the creation of empty accounts (accounts with no balance, no code, and a nonce of 0) and includes state-clearing rules that remove any remaining empty accounts. However, the original text lists 11 operations that can trigger state clearing, forcing clients to implement and test cases that never actually occur. Since all empty accounts remaining on mainnet were removed at block 14049881 in February 2022, continuing to keep these impossible cases in the specification and tests places an unnecessary burden on future client implementers. This EIP declares those cases undefined so implementers can omit them.

What changes

Today

After EIP-4747

Who is affected

In depth

Narrowing the originally 11 state-change triggers down to 3

The original EIP-161 text listed 11 operations that could affect empty accounts. Among these, receiving a zero-value mining reward or fee was impossible before the Merge, and being the subject of a CREATE, being the subject of a CALL, or receiving a refund via SELFDESTRUCT cannot happen to an empty account. Becoming the sender of a message call transaction or contract creation transaction, or being created via CREATE or a transaction, makes the account non-empty. So the only cases that actually clear an empty account are receiving a zero-value CALL, being the recipient of a zero-value transaction, or being the beneficiary of a zero-value SELFDESTRUCT: 3 cases.

The three remaining rules and the initial nonce value

This EIP retroactively applies three rules starting from block 2675000 (when EIP-161 was introduced). When creating an account, the nonce is set to 1 before initcode execution. During EVM execution, empty accounts are treated as if they do not exist, so operations that would create an empty account instead leave the account as nonexistent. And an empty account X is deleted if it receives a zero-value CALL, becomes the recipient of a zero-value transaction, or becomes the beneficiary of a zero-value SELFDESTRUCT. If the transaction, CALL, or SELFDESTRUCT is reverted, this state clearing is reverted along with it.

The interaction with STATICCALL is undefined

Although no EIP has ever clearly specified how STATICCALL and account clearing interact, the existing Ethereum test suite required STATICCALL to trigger state clearing. This EIP holds that a CALL in a STATICCALL context, or STATICCALL itself, triggering state clearing of an empty account has never happened on mainnet and cannot happen in the future, and officially declares this entire interaction undefined. Clients may assume that STATICCALL never occurs against an empty account, nor does a CALL to an empty account occur within a STATICCALL context.

Two hardcodable state-clearing events after Byzantium

Only two state-clearing events have occurred on mainnet since the Byzantium hard fork. At block 4457731 (transaction 0x6379...), address 0xd29DFe5aE95B5C067a91F472Dac0d9be6700A4A9 was cleared after receiving a zero-value SELFDESTRUCT, and at block 14049881 (transaction 0xf955...), multiple accounts were cleared at once after receiving zero-value calls, which was the last removal of empty accounts on mainnet. Clients may implement post-Byzantium state clearing by hardcoding these two events.

Implementations that do not support historical blocks do not need to implement state clearing

Since all empty accounts remaining on mainnet were removed at block 14049881, implementers who do not need to replay historical blocks do not need to implement state-clearing logic at all. This is intended to reduce the technical debt of EIP-161 containing many complex, poorly documented and poorly tested edge cases that future client implementers would otherwise have to keep worrying about, even though these cases neither occur now nor can occur in the future.

Differences on other networks

Ropsten had empty accounts planted in its genesis, but they appear to have been cleared early, before Byzantium, and it has never been confirmed whether edge cases occurred. Other Ethereum testnets applied EIP-161 from genesis. Ethereum Classic cleared all empty accounts as a security measure, but whether edge cases occurred was likewise never checked. Since EIP-161 is an old rule, most EVM-compatible networks have supported it since genesis.

Premises that must hold for this simplification to be valid

For this EIP to be equivalent to EIP-161 on mainnet, three things must be true. An empty account must never be deleted and then recreated within the same transaction, the transactions listed in the appendix must be the only state-clearing transactions that occurred on mainnet since Byzantium (block 4370000), and all empty accounts on mainnet must have actually been removed. The status of this EIP is Stagnant.

Original EIP · ← EIPs