EIP-3529 · Final · Core · 2021-04-22
EIP-3529: Reduction in refunds
Removed the SELFDESTRUCT gas refund, cut the storage-clearing refund from 15,000 to 4,800 gas and capped refunds at one fifth of gas used, killing GasToken and taming block-size spikes.
What problem does it solve?
Ethereum used to pay gas refunds for clearing a storage slot (SSTORE to zero) and for SELFDESTRUCT, hoping to encourage apps to clean up state. In practice the benefit was small and the side effects were bad:
- GasToken. People filled storage (or deployed throwaway contracts) when gas was cheap and cleared it when gas was expensive to collect refunds, using the state as a "battery". This bloated state and wasted block space.
- Block-size variance. Refunds of up to 50 % of a transaction's gas meant a block could execute nearly twice its nominal gas limit, and refunds could sustain those 2× spikes far longer than EIP-1559's elastic blocks.
EIP-3529 shrinks refunds just enough that no one can get more gas out of a slot than they put in, while keeping cheap patterns such as reentrancy locks.
How it works
Activated in the London upgrade (August 2021):
- No refund for
SELFDESTRUCT(previously 24,000). SSTORE_CLEARS_SCHEDULEdrops from 15,000 to 4,800, defined asSSTORE_RESET_GAS + ACCESS_LIST_STORAGE_KEY_COST(2,900 + 1,900 under EIP-2929/EIP-2930). This is the refund for setting a slot whose original value was non-zero to zero.- Refund cap lowered from
gas_used // 2togas_used // 5(MAX_REFUND_QUOTIENT = 5).
The 4,800 figure comes from a pairing argument: the first time a slot is cleared, it must already have been read and written at a cost of at least 4,800, so the refund can never exceed what was spent on that slot.
The other EIP-2200 refunds are unchanged. A 0 → nonzero → 0 pattern within one transaction still gets most of its cost back and costs on the order of a hundred gas, so reentrancy locks and approve-then-spend flows stay cheap.
Sample code
How a client applies the refund at the end of a transaction (pseudocode):
MAX_REFUND_QUOTIENT = 5 # was 2 before London
def finalize(tx, gas_used, refund_counter):
refund = min(refund_counter, gas_used // MAX_REFUND_QUOTIENT)
charged = gas_used - refund
sender.balance += (tx.gas_limit - charged) * effective_gas_price
return charged
From the spec's test table (warm slot, original value 1):
code ops used refund effective
0x60006000556000600055 1 -> 0 3012 4800 -1788 (before cap)
0x60006000556001600055 1->0->1 3012 2800 212
Things to know
- GasToken-style contracts became worthless after London. Any code that still "mints" or "burns" gas tokens now just wastes gas.
- Refunds are applied only after execution, so they never change how much gas a call has available; no contract breaks, though some become uneconomical.
- Clearing storage still pays a net refund only for slots that were already read in the transaction; there is little incentive to zero data nobody touched.
SELFDESTRUCTwas later restricted further by EIP-6780, which limits it to contracts created in the same transaction.- Earlier proposals that removed refunds entirely (EIP-3298, EIP-3403) were not adopted.