HomeEIPs
EIPsEIP-3300
EIP-3300

Phase out refunds

StagnantStandards Track: Core
Created: 2020-02-26
William Morriss (@wjmelements)
DiscussionsOriginal linkEdit
1 min read

EIP-3300 proposes to phase out refunds in Ethereum. Refunds are currently given to users when they execute certain operations that free up storage space on the blockchain. However, this creates inefficiencies and can lead to abuse. The proposal suggests that instead of refunds, gas costs should be reduced for these operations. This would simplify the gas cost model and reduce the risk of abuse. The proposal also suggests that clients should not perform storage writes if the new value is the same as the original value, as this is an unnecessary operation. Overall, the proposal aims to improve the efficiency and security of the Ethereum blockchain.

Video
Anyone may contribute to propose contents.
Go propose
Original

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.

Further reading
Anyone may contribute to propose contents.
Go propose
Adopted by projects
Anyone may contribute to propose contents.
Go propose

Not miss a beat of EIPs' update?

Subscribe EIPs Fun to receive the latest updates of EIPs Good for Buidlers to follow up.

View all
Serve EIP builders, scale Ethereum.
Resources
GitHub
Supported by