go-ethereum/core
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
..
filtermaps core/filtermaps: remove dead condition check (#34695) 2026-04-10 17:41:59 +02:00
forkid params: set osaka and BPO1 & BPO2 mainnet dates (#33063) 2025-11-03 17:41:22 +01:00
history cmd/geth: add Prague pruning points for hoodi (#34714) 2026-04-14 14:58:27 +02:00
overlay core/overlay: fix incorrect debug log key/value in LoadTransitionState (#32637) 2025-12-14 21:51:13 +01:00
rawdb core/rawdb: BAL storage layer (#34064) 2026-03-31 15:05:31 +08:00
state cmd/geth, core/state, tests: rework EIP7610 check (#34718) 2026-04-14 15:54:36 +02:00
stateless core/stateless: fix parsing an empty witness (#34683) 2026-04-09 09:19:54 +08:00
tracing core/tracing: fix NonceChangeAuthorization comment (#34085) 2026-03-25 09:16:09 +01:00
txpool core/txpool/legacypool: use types.Sender instead of signer.Sender (#34059) 2026-03-28 11:46:09 +01:00
types core/types: add accessList to WithSeal and WithBody (#34651) 2026-04-07 22:04:07 +08:00
vm cmd/geth, core/state, tests: rework EIP7610 check (#34718) 2026-04-14 15:54:36 +02:00
.gitignore Renamed chain => core 2014-12-04 10:28:02 +01:00
bench_test.go core: using testing.B.Loop (#32662) 2025-09-19 17:06:27 -06:00
bintrie_witness_test.go cmd/evm/internal/t8ntool, trie: support for verkle-at-genesis, use UBT, and move the transition tree to its own package (#32445) 2025-11-14 15:25:30 +01:00
block_validator.go core,miner: implement EIP-7934 - RLP Execution Block Size Limit (#31990) 2025-07-09 11:24:44 +02:00
block_validator_test.go eth/catalyst: add initial OpenTelemetry tracing for newPayload (#33521) 2026-02-17 17:08:57 +01:00
blockchain.go core, miner, trie: relocate witness stats (#34106) 2026-03-27 17:06:46 +01:00
blockchain_insert.go core: remove unused peek function in insertIterator (#33155) 2025-11-12 15:30:16 +08:00
blockchain_reader.go core, eth, ethclient, triedb: report trienode index progress (#34633) 2026-04-04 21:00:07 +08:00
blockchain_repair_test.go core: consolidate BlockChain constructor options (#31925) 2025-06-19 12:21:15 +02:00
blockchain_sethead_test.go core, miner, tests: introduce codedb and simplify cachingDB (#33816) 2026-03-10 08:29:21 +01:00
blockchain_snapshot_test.go triedb/pathdb, eth: use double-buffer mechanism in pathdb (#30464) 2025-06-22 20:40:54 +08:00
blockchain_stats.go core, miner, tests: introduce codedb and simplify cachingDB (#33816) 2026-03-10 08:29:21 +01:00
blockchain_test.go core/history: refactor pruning configuration (#34036) 2026-03-18 13:54:29 +01:00
chain_makers.go miner: add OpenTelemetry spans for block building path (#33773) 2026-03-16 19:24:41 +01:00
chain_makers_test.go core: consolidate BlockChain constructor options (#31925) 2025-06-19 12:21:15 +02:00
dao_test.go core: consolidate BlockChain constructor options (#31925) 2025-06-19 12:21:15 +02:00
error.go core, internal/ethapi: fix incorrect max-initcode RPC error mapping (#34067) 2026-03-23 22:10:32 +08:00
eth_transfer_logs_test.go core, core/vm: implement EIP-7708 (#33645) 2026-03-23 22:29:53 +08:00
events.go ethstats: report newPayload processing time to stats server (#33395) 2026-01-05 17:49:30 +01:00
evm.go core, core/vm: implement EIP-7708 (#33645) 2026-03-23 22:29:53 +08:00
gaspool.go core: implement eip-7778: block gas accounting without refunds (#33593) 2026-03-04 18:18:18 +08:00
gen_genesis.go core/vm: implement eip-7843: SLOTNUM (#33589) 2026-02-26 13:53:46 +01:00
genesis.go core/vm: implement eip-7843: SLOTNUM (#33589) 2026-02-26 13:53:46 +01:00
genesis_alloc.go params: add hoodi testnet definition (#31406) 2025-03-18 12:07:49 +01:00
genesis_test.go trie/bintrie: spec change, big endian hashing of slot key (#34670) 2026-04-13 09:42:37 +02:00
headerchain.go core/rawdb: reduce allocations in rawdb.ReadHeaderNumber (#31913) 2025-07-15 15:48:36 +02:00
headerchain_test.go core/state, core/tracing: new state update hook (#33490) 2026-01-08 11:07:19 +08:00
mkalloc.go accounts, cmd/geth, core: close opened files (#29598) 2024-04-30 15:47:21 +02:00
rlp_test.go crypto/keccak: vendor in golang.org/x/crypto/sha3 (#33323) 2026-02-03 14:55:27 -07:00
sender_cacher.go core: use sync.Once for SenderCacher initialization (#31029) 2025-01-16 14:36:45 +01:00
state_prefetcher.go core: implement eip-7778: block gas accounting without refunds (#33593) 2026-03-04 18:18:18 +08:00
state_processor.go core: merge access events for all system calls (#34637) 2026-04-07 21:55:09 +02:00
state_processor_test.go core/vm: implement eip-7843: SLOTNUM (#33589) 2026-02-26 13:53:46 +01:00
state_transition.go core/state: fix tracer hook for EIP-7708 burn logs (#34688) 2026-04-09 09:12:35 +08:00
stateless.go core: fix code database initialization in stateless mode (#34011) 2026-03-16 09:45:26 +01:00
txindexer.go core/rawdb: reduce allocations in rawdb.ReadHeaderNumber (#31913) 2025-07-15 15:48:36 +02:00
txindexer_test.go core/rawdb: integrate eradb backend for RPC (#31604) 2025-06-03 10:47:38 +02:00
types.go eth/catalyst: add initial OpenTelemetry tracing for newPayload (#33521) 2026-02-17 17:08:57 +01:00