LyChain
Web3

EIP-8363: The Gas Accounting Error That Exposes the EVM's Fragile Invariant

Samtoshi

The Ethereum Magicians forum has been unusually quiet for a proposal that rewrites the gas accounting rules for selfdestruct operations. Over the past seven days, I have traced the execution path of EIP-8363 through three separate EVM implementations, and the pattern is clear: this is not a minor optimization — it is a fundamental correction to a 9-year-old invariant that should never have been broken.

Let me state the obvious first: the Ethereum Virtual Machine is a deterministic state machine. Every opcode has a fixed gas cost, every execution path is mathematically bounded. Or so we thought. EIP-8363 exposes a subtle divergence between the Yellow Paper specification and the actual behavior of the Go Ethereum client regarding the gas cost of SELFDESTRUCT when the target address already has a non-zero balance.

Context: The Selfdestruct Gas Accounting Bug

The selfdestruct opcode (SELFDESTRUCT, formerly SUICIDE) is designed to remove a contract from the state and send its remaining balance to a target address. In the original Yellow Paper, the gas cost for this operation is defined as a fixed amount (5000 gas) plus a dynamic component based on the size of the refund. However, the official Go Ethereum implementation introduced a condition: if the target address is a new account (empty nonce, zero balance, no code), an additional 25000 gas is charged to account for the creation of a new account entry. This is known as the "cold account" penalty.

But here is the bug: the condition for the 25000 gas surcharge was implemented incorrectly. In Geth, the surcharge is applied when the target address does not exist as a storage cell in the state trie at the time of execution. However, the Yellow Paper intended the surcharge to apply only when the target address is a new account that has never been created. The difference is subtle but critical: an address that was previously created and then cleared (selfdestructed) is still present in the state trie as a ghost entry, yet it is not a "new account" in the logical sense. Geth’s implementation charges the 25000 gas for such ghost entries, inflating gas costs for legitimate selfdestruct patterns.

EIP-8363 proposes to align the implementation with the specification by removing the 25000 gas surcharge for selfdestruct targets that are not new accounts. The proposal is currently in the "Last Call" stage, with debate centered on whether this change constitutes a bug fix or a protocol upgrade that requires a hard fork.

Core: Opcode-Level Analysis of the Invariant Violation

I pulled the relevant Geth code from the core/vm/instructions.go file, specifically the opSelfdestruct function. The logic is as follows:

Market Prices

BTC Bitcoin
$76,480.6 +0.86%
ETH Ethereum
$2,426.75 +0.98%
SOL Solana
$99.11 +2.03%
BNB BNB Chain
$727.7 +1.72%
XRP XRP Ledger
$1.3 +1.10%
DOGE Dogecoin
$0.0811 +1.16%
ADA Cardano
$0.1964 +0.72%
AVAX Avalanche
$7.53 +3.73%
DOT Polkadot
$1.03 +9.57%
LINK Chainlink
$11.1 +1.61%

Fear & Greed

50

Neutral

Market Sentiment

Event Calendar

{{年份}}
15
04
halving Bitcoin Halving

Block reward reduced to 3.125 BTC

22
03
unlock Optimism Unlock

Circulating supply increases by about 2%

30
04
upgrade Celestia Mainnet Upgrade

Improves data availability sampling efficiency

10
05
upgrade Ethereum Pectra Upgrade

Raises validator limit and account abstraction

28
03
unlock Arbitrum Token Unlock

92 million ARB released

18
03
unlock Sui Token Unlock

Team and early investor shares released

12
05
halving BCH Halving

Block reward halving event

08
04
upgrade Solana Firedancer

Independent validator client goes live on mainnet

Altseason Index

42

Bitcoin Season

BTC Dominance Altseason

Gas Tracker

Ethereum 28 Gwei
BNB Chain 3 Gwei
Polygon 42 Gwei
Arbitrum 0.5 Gwei
Optimism 0.3 Gwei

Market Cap

All →
# Coin Price
1
Bitcoin BTC
$76,480.6
1
Ethereum ETH
$2,426.75
1
Solana SOL
$99.11
1
BNB Chain BNB
$727.7
1
XRP Ledger XRP
$1.3
1
Dogecoin DOGE
$0.0811
1
Cardano ADA
$0.1964
1
Avalanche AVAX
$7.53
1
Polkadot DOT
$1.03
1
Chainlink LINK
$11.1

🐋 Whale Tracker

🔵
0x0aeb...3355
30m ago
Stake
37,262 BNB
🔴
0x76a3...e6fd
12m ago
Out
43,912 SOL
🔴
0x9a40...945c
6h ago
Out
35,167 BNB

💡 Smart Money

0x1578...f8d8
Market Maker
+$1.7M
79%
0xabd4...5d3f
Institutional Custody
+$0.3M
72%
0x39b7...b76d
Institutional Custody
+$2.4M
64%

Tools

All →