EIP-3529: killing the gas-refund loophole
Freeing storage used to hand you a big gas refund — a nice idea that got gamed. Contracts hoarded refunds as 'gas tokens,' and refunds let a block do nearly twice the real work its gas limit implied. EIP-3529 doesn't abolish refunds; it shrinks them and caps them, so cleaning up state still pays a little but the exploit dies — and blocks stay predictable for the new fee market.
- gas & storage (SSTORE)
- the EIP-1559 fee market
London, August 2021. The famous change that day was EIP-1559, but it shipped with a quieter companion that made 1559 actually work. Ethereum had long offered a gas refund for freeing storage: set a slot back to zero, or SELFDESTRUCT a contract, and you got gas back. The intent was benign — reward people for shrinking the state everyone stores. But a refund is money, and money invites gaming. By 2021 the refund had become a small industry and a real headache for block accounting. EIP-3529 is the fix, and it’s a nice case of adjusting an incentive rather than deleting it. Let’s derive it.
The problem: refunds became a tradeable asset
Clearing a storage slot refunded up to ~15000 gas; SELFDESTRUCT refunded 24000. That created a perverse trade. When gas is cheap, a contract can SSTORE a pile of slots to non-zero; later, when gas is expensive, it clears them and collects the refunds — effectively buying gas at the low price and spending it at the high price. These contracts were gas token A contract (e.g. GST2, CHI) that hoards gas by writing storage slots when gas is cheap and clearing them for a refund when gas is dear — storing value in otherwise-useless state to arbitrage the gas price. , and they did nothing useful except bloat the state and arbitrage the fee market.
There’s a second, subtler harm. A refund reduces the gas a transaction is charged, so more transactions fit under the block’s gas limit than the limit’s worth of actual work. A block could therefore do up to 2× the real computation its gas limit implied — terrible for predictable block sizes, and especially bad for EIP-1559, whose whole controller depends on gasUsed reflecting genuine load.
→ Step 2: turn the dial down, don’t rip it out.
EIP-3529: smaller refunds, tighter cap
The fix is calibration, not abolition. EIP-3529 makes three changes: it removes the SELFDESTRUCT refund entirely, cuts the SSTORE-clear refund from 15000 to 4800, and tightens the refund cap A ceiling on how much of a transaction's gas can be returned as a refund, as a fraction of gas used. EIP-3529 lowered it from gasUsed/2 to gasUsed/5 — so at most one-fifth of a transaction's gas can come back. from gasUsed / 2 to gasUsed / 5. A modest reward for genuinely freeing state survives, but it’s now far too small to make gas tokens or the 2× block trick worthwhile.
- 1 at most a fifth of a tx's gas can be refunded — down from a half
- 2 the old cap let refunds offset up to half, enabling the 2× block
→ Step 3: the payoff, and a thread to pull later.
The payoff: predictable blocks — and a nudge toward transient storage
With refunds capped at a fifth, a block’s real work is bounded back near its gas limit instead of drifting toward twice it. That predictability is precisely what EIP-1559’s fee controller needs to read demand honestly, which is why the two shipped together.