🚧 This EIP had no activity for at least 6 months.

EIP-3300: Phase out refunds Source

AuthorWilliam Morriss
Discussions-Tohttps://ethereum-magicians.org/t/eip-3300-phase-out-refunds/5434
StatusStagnant
TypeStandards Track
CategoryCore
Created2020-02-26

Simple Summary

Phases out the SSTORE and SELFDESTRUCT gas refunds.

Abstract

This EIP would define a block when the SSTORE and SELFDESTRUCT refunds would begin to diminish. The refund would step linearly downward, eroding the implicit value of such refunds at an accelerating pace.

Motivation

Refunds increase block elasticity, so the block gas target can exceed the number established by miners by up to 2x. This can cause hesitancy for miners to increase the block gas target.

Refunds, tokenized or not, are valuable to their holders, especially during congestion. If refunds must be removed, a gradual change in their value would be less-disruptive to the gas market than sudden abolition. Refund consumption would proceed, especially during periods of congestion, and the refunds would be cleaned up from the state. Refund creation, driven by demand, would naturally diminish as the efficiency of the refunds fall. As the refund value approaches the activation cost, the implicit value of the refunds will approach zero, but in periods of congestion they will be cleaned up.

This change is less work for the protocol developers than compensation and cleanup, while likely still achieving cleanup.

Specification

Parameters:

  • FORK_BLOCK_NUM: EIP-3300 activation block
  • REFUND_DECAY_STEP: 1 gas
  • REFUND_DECAY_FREQUENCY: 100 blocks

Computed:

  • REFUND_DECAY: REFUND_DECAY_STEP * ceil((block.number + 1 - FORK_BLOCK_NUM) / REFUND_DECAY_FREQUENCY)

On the block this EIP activates, and again every REFUND_DECAY_FREQUENCY blocks, all gas refunds, including SELFDESTRUCT and SSTORE would diminish by REFUND_DECAY_STEP, until 0. The current difference is called the REFUND_DECAY, which shall be subtracted from each gas refund.

For gas-cost regimes with refund removals that cancel prior refunds, the invariant that the refund counter cannot go negative will be preserved by diminishing the magnitude of those removals by REFUND_DECAY, until 0.

EIP-2929

The refunds as of EIP-2929 are as follows:

  • 24000 for SELFDESTRUCT
  • SSTORE_RESET_GAS - SLOAD_GAS (5000 - 100)
  • SSTORE_SET_GAS - SLOAD_GAS (20000 - 100)
  • SSTORE_SET_GAS - SLOAD_GAS (20000 - 100)
  • SSTORE_CLEARS_SCHEDULE (15000)

Each of these refunds would be decreased by the current REFUND_DECAY.

There is also a case where SSTORE_CLEARS_SCHEDULE is removed from the refund counter. That removal will also diminish by REFUND_DECAY_STEP until 0, maintaining the non-negative refund counter invariant.

Rationale

Persisted refunds would become worthless before they fall below their activation cost. Once the refunds are worthless, they can be removed by another hard fork without waiting for 0. The rate of diminishing specified would currently require (24000-5000) * 100 = 1,900,000 blocks for SELFDESTRUCT and (15000-5000) * 100 = 1,000,000 blocks for SSTORE. This timeframe is currently about a year, which should be enough flexibility for the remaining refunds to be consumed.

Backwards Compatibility

This proposal breaks gas refunds, which contribute to block elasticity. The effect of this will be increased gas price volatility: higher highs and lower lows.

Because the refund counter is separate from the gas counter, the block-to-block gas changes will not break eth_estimateGas.

Copyright and related rights waived via CC0.

Citation

Please cite this document as:

William Morriss, "EIP-3300: Phase out refunds," Ethereum Improvement Proposals, no. 3300, February 2020. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-3300.