go-ethereum/cmd/geth
rjl493456442 eb67d61933
cmd/geth, core/state, tests: rework EIP7610 check (#34718)
This PR simplifies the implementation of EIP-7610 by eliminating the
need to check storage emptiness during contract deployment.

EIP-7610 specifies that contract creation must be rejected if the
destination account has a non-zero nonce, non-empty runtime code, or 
**non-empty storage**.

After EIP-161, all newly deployed contracts are initialized with a nonce
of one. As a result, such accounts are no longer eligible as deployment 
targets unless they are explicitly cleared.

However, prior to EIP-161, contracts were initialized with a nonce of
zero. This made it possible to end up with accounts that have:

- zero nonce
- empty runtime code
- non-empty storage (created during constructor execution)
- non-zero balance

These edge-case accounts complicate the storage emptiness check.

In practice, contract addresses are derived using one of the following
formulas:
- `Keccak256(rlp({sender, nonce}))[12:]`
- `Keccak256([]byte{0xff}, sender, salt[:], initHash)[12:]`

As such, an existing address is not selected as a deployment target
unless a collision occurs, which is extremely unlikely.

---

Previously, verifying storage emptiness relied on GetStorageRoot.
However, with the transition to the block-based access list (BAL), 
the storage root is no longer available, as computing it would require 
reconstructing the full storage trie from all mutations of preceding 
transactions.

To address this, this PR introduces a simplified approach: it hardcodes
the set of known accounts that have zero nonce, empty runtime code, 
but non-empty storage and non-zero balance. During contract deployment, 
if the destination address belongs to this set, the deployment is
rejected.

This check is applied retroactively back to genesis. Since no address
collision events have occurred in Ethereum’s history, this change does
not
alter existing behavior. Instead, it serves as a safeguard for future
state
transitions.
2026-04-14 15:54:36 +02:00
..
testdata cmd/geth: remove deprecated vulnerability check command (#33498) 2025-12-30 21:04:38 +01:00
accountcmd.go cmd/geth: remove unlock commandline flag (#30737) 2024-11-15 10:15:15 +01:00
accountcmd_test.go cmd/geth: remove unlock commandline flag (#30737) 2024-11-15 10:15:15 +01:00
attach_test.go all: update license comments and AUTHORS (#31133) 2025-02-05 23:01:17 +01:00
bintrie_convert.go cmd/geth: add subcommand for offline binary tree conversion (#33740) 2026-04-09 10:27:19 +02:00
bintrie_convert_test.go cmd/geth: add subcommand for offline binary tree conversion (#33740) 2026-04-09 10:27:19 +02:00
chaincmd.go core/history: refactor pruning configuration (#34036) 2026-03-18 13:54:29 +01:00
chaincmd_test.go cmd/geth: era-download logic fix (#32081) 2025-06-24 15:12:11 +08:00
config.go metrics: allow changing influxdb interval (#33767) 2026-02-23 14:27:25 +01:00
consolecmd.go internal/flags: remove Merge, it's identical to slices.Concat (#30706) 2024-10-31 19:26:02 +02:00
consolecmd_test.go eth/catalyst: implement testing_buildBlockV1 (#33656) 2026-02-23 15:56:31 +01:00
dbcmd.go cmd/geth: correct misleading flag description in removedb command (#33984) 2026-03-11 16:33:10 +08:00
exportcmd_test.go all: simplify tests using t.TempDir() (#30150) 2024-07-15 15:26:58 +02:00
genesis_test.go all: remove TerminalTotalDifficultyPassed (#30609) 2024-10-23 08:26:18 +02:00
logging_test.go .github: run tests with ci.go (#32590) 2025-09-11 20:15:51 +02:00
logtestcmd_active.go all: update license comments and AUTHORS (#31133) 2025-02-05 23:01:17 +01:00
logtestcmd_inactive.go all: update license comments and AUTHORS (#31133) 2025-02-05 23:01:17 +01:00
main.go cmd/geth: add subcommand for offline binary tree conversion (#33740) 2026-04-09 10:27:19 +02:00
misccmd.go cmd/geth: remove deprecated vulnerability check command (#33498) 2025-12-30 21:04:38 +01:00
run_test.go cmd, les, tests: remove light client code (#28586) 2023-11-23 16:28:26 +02:00
snapshot.go cmd/geth, core/state, tests: rework EIP7610 check (#34718) 2026-04-14 15:54:36 +02:00