EIP-3300 Phasing out gas refunds (Phase out refunds)
No call decision · Fees & gas · EIP status Stagnant · created 2020-02-26
A proposal to gradually reduce the gas refunds granted for SSTORE and SELFDESTRUCT by 1 gas every 100 blocks starting from a given block, eventually bringing them to zero.
Why it is needed
Refunds are the block elasticity factor that lets a block exceed the gas target set by miners by up to 2x. Large refunds discourage miners from raising the gas target. Refunds, including in tokenized form, also hold real value for holders especially during network congestion, so eliminating refunds all at once would deal a major shock to the gas market. This proposal gradually erodes refunds so that they are naturally consumed and cleared from state during congestion, while demand for refunds itself naturally declines as their efficiency drops. The same effect can be achieved without compensation or separate cleanup work, reducing the burden on protocol developers.
What changes
Today
- SELFDESTRUCT receives a refund of 24000 gas, and SSTORE receives a refund of 4900 to 19900 gas depending on the situation.
- Refunds are calculated separately from the block gas usage tally, allowing a block to exceed the gas limit by up to 2x.
- Refunds themselves, including in tokenized form, hold value for holders during periods of congestion.
After EIP-3300
- Starting from the activation block, all refunds decrease by 1 gas every 100 blocks.
- Refunds approach zero in value before falling below the activation cost, rendering them effectively useless.
- It takes about 1.9 million blocks for the SELFDESTRUCT refund to vanish, and about 1 million blocks for the SSTORE refund to vanish.
- The amounts that offset (cancel) refunds also decrease at the same rate, so the refund counter never goes negative.
Who is affected
- Users: Gas price volatility increases, so during congestion the peaks of gas prices can go higher and the troughs lower.
- Wallet & app developers: eth_estimateGas is unaffected, but it should account for the fact that refunds expected from storage deletion or contract self-destruction decrease over time.
- Miners: As the block overshoot caused by refunds shrinks, the burden of raising the gas target changes accordingly.
- Projects that use tokenized refunds: The economic value of held refunds gradually decays over time.
In depth
Calculating REFUND_DECAY
REFUND_DECAY is calculated as REFUND_DECAY_STEP * ceil((block.number + 1 - FORK_BLOCK_NUM) / REFUND_DECAY_FREQUENCY). REFUND_DECAY_STEP is 1 gas and REFUND_DECAY_FREQUENCY is 100 blocks. In other words, every 100 blocks after the activation block (FORK_BLOCK_NUM), REFUND_DECAY increases by 1, and this value is subtracted uniformly from every gas refund.
Refunds to which this applies
Based on EIP-2929, there are four refunds this applies to: SELFDESTRUCT's 24000, SSTORE_RESET_GAS - SLOAD_GAS (5000-100), SSTORE_SET_GAS - SLOAD_GAS (20000-100, applied in two separate cases), and SSTORE_CLEARS_SCHEDULE (15000). For each of these, the current REFUND_DECAY value is subtracted to get the actual refund amount.
Preventing the refund counter from going negative
There are cases where SSTORE_CLEARS_SCHEDULE is removed (offset) from the refund counter. This removal amount is also reduced by REFUND_DECAY so that it converges to 0, preserving the invariant that the refund counter never goes negative.
Time to decay
According to the Rationale, the SELFDESTRUCT refund takes (24000-5000) * 100 = 1,900,000 blocks to decay, and the SSTORE refund takes (15000-5000) * 100 = 1,000,000 blocks. At the time of writing, this corresponds to roughly one year, a design intended to give sufficient grace period for remaining refunds to be consumed.
Relationship to full removal
Refunds are designed so that their real value approaches zero before they fall below the activation cost. The author therefore holds that once the real value of refunds has disappeared, it is fine to fully remove the refund itself in another hard fork without waiting for it to reach zero.
Backwards compatibility and gas estimation
Phasing out refunds affects block elasticity, increasing gas price volatility: during congestion, gas price peaks rise higher and troughs fall lower. However, since the refund counter is separate from the gas counter, changes in per block gas usage do not break the behavior of eth_estimateGas.
Current status
This proposal's status is Stagnant. The provided call records show no decision or discussion on including this EIP in a fork.