mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-04-15 22:28:35 +00:00
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.
|
||
|---|---|---|
| .. | ||
| program | ||
| runtime | ||
| testdata | ||
| analysis_legacy.go | ||
| analysis_legacy_test.go | ||
| common.go | ||
| contract.go | ||
| contracts.go | ||
| contracts_fuzz_test.go | ||
| contracts_test.go | ||
| doc.go | ||
| eip7610.go | ||
| eip7610_test.go | ||
| eips.go | ||
| errors.go | ||
| evm.go | ||
| gas.go | ||
| gas_table.go | ||
| gas_table_test.go | ||
| gascosts.go | ||
| instructions.go | ||
| instructions_test.go | ||
| interface.go | ||
| interpreter.go | ||
| interpreter_test.go | ||
| jump_table.go | ||
| jump_table_export.go | ||
| jump_table_test.go | ||
| jumpdests.go | ||
| memory.go | ||
| memory_table.go | ||
| memory_test.go | ||
| opcodes.go | ||
| operations_acl.go | ||
| operations_verkle.go | ||
| stack.go | ||
| stack_table.go | ||