DCIPs/EIPS/eip-4747.md

15 KiB

eip title description author discussions-to status type category created requires
4747 Simplify EIP-161 Simplify EIP-161 and retroactively deprecate unused aspects of it Peter Davies (@petertdavies) https://ethereum-magicians.org/t/eip-4747-simplify-eip-161/8246 Stagnant Standards Track Core 2022-02-02 161

Abstract

Simplify the definition of EIP-161, removing the requirement for implementors to support edge cases that are impossible on Ethereum Mainnet.

Motivation

EIP-161 is overly complex and has a number of edge cases that are poorly documented and tested. This EIP takes advantage of the complete removal of all remaining empty accounts in block 14049881 (tx 0xf955834bfa097458a9cf6b719705a443d32e7f43f20b9b0294098c205b4bcc3d) to clarify it, and allows implementors to not implement various edge cases that never occurred and are not possible in the future.

In particular, this EIP permits implementors who do not wish to support historical blocks to not implement state clearing at all.

Specification

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.

Retroactively replace EIP-161, starting from its introduction in block 2675000, with the following rules:

a. When creating an account, set it's nonce to 1 prior to executing initcode.

b. When performing EVM execution treat all empty accounts as if they do not exist. Any operation that would create an empty account instead leaves it non-existent.

c. If one of the following events happens to an empty account X, it is deleted:

  1. X receives a zero value CALL.
  2. X is the recipient of a zero value transaction.
  3. X is the beneficiary of a SELFDESTRUCT with zero value.

If the transaction, CALL or SELFDESTRUCT is reverted, then the state clearing is also reverted. As a special case on Ethereum Mainnet, in block 2675119 (tx 0xcf416c536ec1a19ed1fb89e4ec7ffb3cf73aa413b3aa9b77d60e4fd81a4296ba), an empty call is made to an empty account at RIPEMD160 (precompile 0x3), the call fails out of gas, but the empty account is removed anyway.

The deletion MAY happen immediately or be processed at the end of the transaction. A client may assume that STATICCALLs to empty accounts never occur and that CALLs to empty accounts in STATICCALL contexts never occur.

On Ethereum Mainnet, the only state clearing events after the start of Byzantium are the two listed below. Clients MAY implement post Byzantium state clearing by hardcoding those events.

  • In block 4457731 (tx 0x63791f962e13e6b01ec13d38a8ab66c87c2f5a1768276f866300d900cca808fe), 0xd29DFe5aE95B5C067a91F472Dac0d9be6700A4A9 receives a zero value SELFDESTRUCT and is cleared.

  • In block 14049881 (tx 0xf955834bfa097458a9cf6b719705a443d32e7f43f20b9b0294098c205b4bcc3d), the following accounts receive zero value calls and are cleared.

    Accounts cleared
    0x01a3dd7d158e3b4c9d8d2af0ddcf3df0f5e14463
    0x0366c731dd7c095dc08896806765a649c6c0885a
    0x056c68da52395f1d42c5ba15c4fb956146a4f2c1
    0x070ba92497cd4b88a8a9a60795ca7d7f7de0faa3
    0x07a1648ce2bed6721a5d25de3c228a296d03fd52
    0x07b14ba68f474529cc0bd6a9bffee2bc4090d185
    0x07ea32232e37d44134a3071319d228bdab249a60
    0x096b7382500fa11c22c54c0422c5e38899a2e933
    0x09f3200441bd60522bcf28f3666f8e8dbd19fb62
    0x0ad0f3c60696adece09367a9a11c968fb88560bb
    0x0af6181e1db22071f38fc162e1610e29d288de04
    0x0cdc7fef8f8d0ee77360060930aada1263b26ff7
    0x0dac3d571eb5b884a2550db2791d5ac1efca306b
    0x0ec857faba49392080b68dd5074d85f34724d04a
    0x0f5054f9c674b37d15915ca8925f231edb3afa8c
    0x0f78d535e1faad9a982dca2a76d16da4649f7021
    0x104c5b235166f26df54f52666d5e77d9e03e353e
    0x106b47175965b6d607008544267c91490672a54f
    0x1223d5c03b4d52ebed43f781251098c9138c3dd7
    0x1251d13cde439378349f039379e83c2641b6269f
    0x12c814cebee6bb08a5d1b9d009332bf8b536d645
    0x150c63df3da35e590a6d2f7accf2e6f241ea5f1a
    0x15ddf20e4eb8b53b823bc45c9bad2670aad907dd
    0x1712b1c428f89bc695b1871abfff6b5097350150
    0x178df2e27b781f024e90ab0abe9cff7e2f66a5fc
    0x1c2bd83dc29095173c4bcc14927811f5141c1373
    0x1d12f2fad3603ea871fcb13ac3e30674f9ad903f
    0x1f7391b6881b6f025aef25cff737ff3fcb9d7660
    0x219a3d724f596a4b75656e9b1569289c71782804
    0x21a7fd9228c46ec72f926978f791fc8bfcd277fa
    0x23acb760cebd01fe7c92361274a4077d37b59f4c
    0x23b249eeeeedd86bc40349f8bb8e2df34bd28f78
    0x28d006b1a2309e957005ee575f422af8034f93df
    0x28ef72d5614b2833d645aecf8ef7add075eb21e2
    0x292966802ffedb6f34f2c8c59df35c9d8f612c24
    0x2c2661ddd320017138075aba06999440a902695f
    0x2c632be2dc2f47affd07bfce91bd4a27c02f4563
    0x2f86de22ced85a7dd0d680fc4266929a72775e27
    0x2fa04f15123025ab487dce71668f5265649d0598
    0x30f78fd12c17855453e0db166fecf684bb239b8c
    0x31534e95353323209cd18ad35c22c2528db6d164
    0x336e0e1a14e0136c02bf8dcf0a9a3fe408548262
    0x340399588bba5b843883d1ad7afd771a3651447a
    0x341d2b82d0924ef42d75ce053654295d34839459
    0x34c2b8975b47e13818f496cf80b40566798cf968
    0x370e67f45db9c18d6551000e6c0918bc8d346ebf
    0x37149dae898296173d309f1de6981922ec1dc495
    0x377cb0d3427af7f06df47d2ab420458834bed1fc
    0x3d473af3e6ce45183c781b414e8a9edcb8b26f72
    0x42794c1d807079e16735e47e193825cec80ee28c
    0x45603aa97b67965b42b38ddc8884373edbcf2d56
    0x465cb9df2f6d3c8a1c1ce3f2338823f0638fefa5
    0x49fbe69c2897bce0340b5983a0f719213a8c6e6f
    0x4a84cbd3ef642e301aa59bedf4fa4d28e24e6204
    0x4d4d551bd6244b854e732572902f19f4ccaa6996
    0x4f62af4ec150ea121859b3368e6a61fb7bcf9002
    0x4fd1c530f73ddfff5c609a4a8b25af6ca489d1fd
    0x50010a4f0e429b398c66876dea7694d5f8b1a639
    0x522c9f65bc77ad9eed6bcdc3ec220236451c9583
    0x52b30ca3c2f8656e2c022e896bef7fad9a0449ca
    0x537a7030ecd9d159e8231ce31b0c2e83b4f9ed75
    0x5483a4c5583d5ba3db23676a3db346f47ba357e1
    0x55ec1a78a1187428dc0c67cbb77ae9fbdd61cc2a
    0x56cc1c0aadc2b8beb71f1ac61f03645483abe165
    0x58bea8cea61fad5c453731aaeed377f3d77a04cc
    0x58f632327fbc4f449bda3bd51e13f590e67a8627
    0x59d122afcbd68c731de85c2597004c6ddafbc7ed
    0x5da0228024cc084b9475470a7b7ae1d478d51bb7
    0x5e51d6621883afcbd4e999b93180a96909bdc766
    0x5e9a0a1bdfdd868706f4554aae21bb2c46da32c2
    0x5f3f0d3215db85faa693d99acfb03cca66556671
    0x5f6aa25f22edb2347b464312e2508cbc4c6e0162
    0x6006f79e4104850ab7c9b0f75918c1e2cf6311df
    0x60f5da58bccb716f58b5759a06fc2167fe237c26
    0x62d3a444d0af59f9de79f8abeb5c942fcfbfbef5
    0x630ea66c8c5dc205d45a978573fa86df5af1fe7a
    0x6464f0f96a29934087a955c67a6b53d5ed852e49
    0x6653cedb0b7f51c4b0c44079eb45c514df24ecfd
    0x66d69ac12b573299f36b108792be75a1e2ccdfdc
    0x690ed837d25b46dbf46727fcda7392d997c2bc97
    0x696eecbc97189c5b2a8245a8e32517db9960c171
    0x69aaff0b7babe85e0a95adfc540e689399db7f24
    0x6b71d2ceab5678b607aa1e69b6781f5c7abc9aaf
    0x6e03d9cce9d60f3e9f2597e13cd4c54c55330cfd
    0x6e278cfecfe96fa5e6d5411ba6eeb765dff4f118
    0x6e557f01c9dcb573b03909c9a5b3528aec263472
    0x6ec268f8bef9c685d7e04d5cdb61fbb544869a9f
    0x6f2ba051b3ce06a90705c22e0241c2b7e32c1af0
    0x7063732ced55cfa08aea520f3fe200c39b3df0f5
    0x7073a17a0172dfb1e46a62f054d11a775aeac32e
    0x71d3718cfa0f9ee8173688fe52bb499e1f36534b
    0x74e20aec156674945894d404f8dea602570e62f5
    0x783e45c2989e675ffc9d067914d7de3ff68aee58
    0x7a5f843f884bb15d070806e1ff59b6c6f74bbe2d
    0x7c6b1706c86ea76a0e232324f249e1508ca2dfda
    0x7d23a23584c83c1f6636124255cfd8e9cfc0e529
    0x7e8b5df0dec9168741c93d52d7045aca7ea632d3
    0x7ec5da0f1036750688084252b802befe41551205
    0x82c9fcef4dd2d374b000063d4899a38a7219cdc7
    0x82fa2ab30a566ceeac987eb5510485be9382f130
    0x83d927aca3266f94e8163eaa32700c70e9b76e6e
    0x8476f7e193c930f21e88dae84888e0d8bfaf3ed8
    0x85ec166cb81f5010b4a8d365821473dac0c0aa88
    0x8883c55943d5caf06b6484de9c1d73da8307cd82
    0x8c07456cffd4254c89aaaa9d4e95c8b3e36c2a3b
    0x8fef965e5db6f7f1a165008499e8b7901cd766b2
    0x9018e2967c15e1faed9b5d6439522f075535a683
    0x903f1d8a086c6af1afe24648b6409aade83c4340
    0x9127c398827d8db6b6d5f17b71f5db69d06e8b74
    0x917b5be6e3acd96d40a33c13e6748e4a88576c6d
    0x91edfd05112f0bc9d6cd43b65361713a50e9eb7f
    0x93026a2c4a0bc69de31515070bf086e0c1f789e5
    0x94863bbbc12ec5be148f60a7020fd49236fc1937
    0x94befc001e203f141462f16bde60873bcefae401
    0x94c408cf5934f241d4fdd55ff3825131635c6af2
    0x94cfdec548de92301735dc0b82d8e1f79404ff94
    0x96527f3311f44340887c926acc16f0997eb3b955
    0x974117faf194885c01513e8d87b38a2291083ed5
    0x993424827a5fb2fa97818814ea4027e28150f187
    0x9a6f30a5cb46840076edd780da2dbb4bc7c39f24
    0x9a74a096b0bb82adfd28494107f2c07f4545723e
    0x9af82ec46185641c0ea44679aac8a7e7570be202
    0x9e2287a60ed85f6bd80c62c1b7b4130ea1b521dd
    0x9fee5b81ee0cbf34c18c52061f1b257d4ccb2702
    0xa017226377e775af8e56450301cc035ae72267f8
    0xa1b423e024daf925f25296ea2efcf009cc328873
    0xa23c0cbfe59e8650277ffa635c59f287cece9087
    0xa340b7625eec76b372f2c317fe08a7733f05d09c
    0xa4cb6be13c2eace6c0f1157553e3c446f7b38b10
    0xa54326267784fae3ffd6800af38099753bb7f470
    0xa580086125d040fddd3af9d563285bd0ec4d13e3
    0xa88fc7a34ca36b952aa45d94c1e13155042b5e7d
    0xac8f4ce2e4eff39c738bf1941350b3b57e8eec4f
    0xacb17dca110db022b1aceb5399acba1e9bf577e3
    0xae0b03c8d8bf9cf71eda758e9e8b59c70a3b4580
    0xae365ff4b0c64413baf6f7dfdb5cd3fb65ad1376
    0xaf7e60d02b425b54730b7281a97d1640233704b0
    0xaf9846f8098656e7c2f0e53e9ff7d38ec7b7f679
    0xb2784c0a95e9b6b865aca13556fb32e2f37cb775
    0xb385fa211cd08326ff84b0d4f37cc8c3735aa3aa
    0xb3fb883cbbccb0551daf1507f87426fd38da087e
    0xb6515cfb82fa877fbadae5a87006a8d3deeeb7c9
    0xb78c4f0b8c9ec0b3058724eca65292d0d65586b9
    0xba25f341e16ee81ab80ea246d45bdead7cc339e5
    0xbab14024437285c2e3b3c521abff96b0ef2e919f
    0xbaf0996297cc70fca1bee30162eabcd892f0574a
    0xbb01ea95321a94242c89479995b7e3f264cb46a0
    0xc1b37a3b7f76947e24cc2470e0e948aab0181346
    0xc24431c1a1147456414355b1f1769de450e524da
    0xc467b893e29277f9b62b4ed6c9ba054bd8225bff
    0xc4bc101a168ea2228973a65564a7d40a68528dd2
    0xc784626571c2c25cd2cfe24192a149cad86d40d8
    0xc7acf90a9f442855b8f291288bb5fb612536ed9b
    0xc9956593dbfb46cfd24686a365b34051a55abce6
    0xca2eb2af7dd7a90777c8c6456efcc00fe56dbd6f
    0xcb4bb078edaae9393c8da27b809aa9c0f4c920b7
    0xcc8f68e8e2d8196e2ecd0caf2f35b1611739a21f
    0xcd67903318a805d63fe79bf9b8401c1b79c6babf
    0xcd7a2fe9cb80c95b03950daf5b6d476bec9ac24d
    0xd09476f5ee7979becca8ffe6dc22a72565fc3cea
    0xd1c4bd2b583f445354d1b644ea4b8353f2d23048
    0xd32bb8bceafc89ff59ba43ce8b6cd65bb06dd7b0
    0xd49e9fa792db9d9398c57eabf94ba1b2c709ace7
    0xd6b862cf0d009bde0f020ab9d8f96e475069c5c6
    0xd747c05d9c8057db608ef7aedabf07e4db0bbe97
    0xdb9b40d1b691ced3680e539261b6bc195388b3c0
    0xdbcc502093cadd0feb709708c633e2427aeb9c2d
    0xdc53001181ddc6a279deea6419443ea0ac0aec9c
    0xde3b38cb1050e7b5db39b4cbb2b2b63a1e32cbf6
    0xdf1b687a99216ad4ebf9176983bf165be7b25bbe
    0xe000662c02a02d8b40aabfcd661594312992311d
    0xe30c59e4dc19d7c9ed6eb10d734d4d7ef28403ac
    0xe415114089b4b4933e542a5c79af4b6e6cd7abc9
    0xe47f0a0e93241d390fe9b99de852682522e847bc
    0xe54abbd51e324bf8cf349b6b31c01b043d1ee0e4
    0xe57838f777b11fdc428d9e7e67f1187d6251ba1f
    0xe5e4b26325d0fbf551367f2cf3b5d01caed6abcf
    0xe6655208bd812d833238b560e847014b0aab3b51
    0xe6e16a1023af4a8fe54669f3fce7c406801bb333
    0xe727bba699fbe82a731dad9476b5234d0038cfa1
    0xec361d34a55e24e2f77de7121ae2b7bf11ed0d65
    0xed3bf94976eb11d55b955d1369a478620872b57c
    0xee93ad447fe6a0e2bbac4952e651b21c0175acad
    0xefc5d9cabc0bda8124e1b821e8c86c7e7bf1e4bc
    0xf272f72a00f166f491d994642c8243099b72d2cd
    0xf45f642034bbce869e31b05d1da919125c7331ee
    0xf4883b21724405b19e240f3309a64d16dd89adc7
    0xf5cb2a87ff1095f6d93e7b4bfc1bc47542380550
    0xf6ddd386c4f7f0b460032c8055d7f9c3503d7140
    0xf72093096c81b3e9e991f5b737baec9570a56927
    0xf7412232a7a731bca2e5554c8ee051274373c17c
    0xfc2321dc32c2e6e96a0e41c911fb73a7b278d5c8
    0xfc4dc782bf7e81a2ed5cc0519f80de36e7931bd9
    0xfcde1c261eb257e14491b4e7cb1949a7623c00c5
    0xfd17a22fd80075f2716e93268aa01bcdd7d70b22
    

Rationale

EIP-161 provides that empty accounts (accounts that have zero nonce, zero balance and no code, but that might have storage) can no longer be created and provides mechanism to remove old empty accounts. The last empty accounts were removed in block 14049881 (tx 0xf955834bfa097458a9cf6b719705a443d32e7f43f20b9b0294098c205b4bcc3d).

The complete removal of all empty accounts ensures that certain edgecases of EIP-161 can never occur on Ethereum Mainnet. Continuing to define and test those cases as part of the Ethereum Specification burdens future client implementors with unnecessary technical debt. This EIP declares those cases undefined and leaves clients free to assume they will not occur.

Backwards Compatibility

This EIP is identical to EIP-161 except for the following differences, none of which affect Ethereum Mainnet. The differences are:

"Potentially state-changing operations"

EIP-161 specifies 11 "potentially state-changing operations" that trigger state clearing. All but the 3 listed in this EIP are irrelevant, for the following reasons:

Impossible

  • Receiving zero value mining reward/fees (this would become possible after the merge).

Cannot happen to an empty account

  • Being the source of a CREATE.
  • Being the source of a CALL.
  • Being refunded by a SELFDESTRUCT

Causes the account to become non-empty

  • Being the sender of a message call transaction.
  • Being the sender of a contract creation transaction.
  • Being created by a CREATE.
  • Being created by a contract creation transaction.

Interaction with STATICCALL

The interaction between STATICCALL and account clearing has never been specified in an EIP. The Ethereum currently testsuite requires that STATICCALL triggers state clearing.

This EIP formally undefines all interactions between STATICCALL and state clearing as it has never happened on Ethereum Mainnet and cannot happen in future.

"At the end of the transaction"

This only makes a difference if an account is deleted and later recreated in the same transaction. This never happens on Ethereum Mainnet.

Test Cases

All test cases involving empty accounts in the Ethereum execution layer test suite shall be removed unless they relate to the Spurious Dragon Hardfork. If a Spurious Dragon test relates involved deprecated edgecase the test must be removed or reworked.

Other networks

Ropsten had empty accounts seeded at genesis. They appear to have been cleared early in Ropsten's history before the Byzantium hardfork. Ropsten has never been checked for edgecases occurring. All other Ethereum testnets have had EIP-161 from genesis.

As a security precaution all empty accounts on Ethereum Classic have been cleared, but no checks for edgecases occurring have been done. Due to EIP-161's age the vast majority of EVM compatible networks have supported it from genesis.

Security considerations

This EIP is only equivalent to EIP-161 on Ethereum Mainnet if the following facts are true:

  1. No empty accounts are ever touched and then reinstated in the same transaction.
  2. The transactions in the Appendix are the only state clearing transactions on Ethereum Mainnet after block 4370000 (start of Byzantium).
  3. All empty accounts have been removed on Ethereum Mainnet.

Copyright and related rights waived via CC0.