EIPs Explained

EIP-2515 · Stagnant · Core · 2020-02-10

EIP-2515: Implement Difficulty Freeze

Proposed replacing the exponential proof-of-work difficulty bomb with a predictable 'difficulty freeze' at a fixed block height, after which difficulty only rises by 1% per block.

What problem does it solve?

Proof-of-work Ethereum carried a difficulty bomb (the "ice age"): an exponentially growing term in the difficulty formula that slowly made blocks slower, forcing developers to ship a hard fork to push it back. In practice it was hard to model. It showed up earlier than expected (the Muir Glacier delay, EIP-2384, was an emergency response), and when upgrades slipped for technical reasons it hurt miners and users who had no power to fix it.

EIP-2515 proposes a difficulty freeze instead: a mechanism keyed purely to block height, so everyone knows exactly when it will bite, and whose pain falls mostly on the client developers who are the only ones able to defuse it.

How it works

  • A constant DIFFICULTY_FREEZE_HEIGHT is added.
  • Up to that height, difficulty adjusts normally from the parent block's difficulty and timestamp, using the usual max(1 - Δt // 10, -99) adjustment.
  • After that height, difficulty stops reacting to block times and simply increases by 1% per block, forever.

Because difficulty no longer tracks hash power after the freeze, block times drift and eventually rise, which is the pressure to upgrade. The 1% increase was added after feedback that a pure freeze did not reliably produce the desired incentives.

An optional variant sets the freeze relative to the last fork: LAST_FORK_HEIGHT + DIFFICULTY_FREEZE_DIFFERENCE (the spec's example is 1,800,000 blocks, roughly nine months). Every upgrade would then reset the freeze automatically, at the cost of more complex consensus logic.

Sample code

The core rule from the spec, written as runnable Python:

DIFFICULTY_FREEZE_HEIGHT = 10_000_000  # placeholder; the spec leaves the value open

def calc_difficulty(block_number, parent_diff, block_ts, parent_ts):
    if block_number <= DIFFICULTY_FREEZE_HEIGHT:
        adj = max(1 - (block_ts - parent_ts) // 10, -99)
        return parent_diff + parent_diff // 2048 * adj
    # frozen: ignore block times, grow 1% per block
    return parent_diff + parent_diff // 100

The optional, fork-relative trigger:

def frozen(block_number, last_fork_height, dfd=1_800_000):
    return block_number > last_fork_height + dfd

Things to know

  • Status: Stagnant. It was never adopted. Ethereum kept the original bomb and delayed it repeatedly through hard forks such as EIP-3554 and EIP-4345.
  • The question became moot with the move to proof-of-stake (EIP-3675): there is no proof-of-work difficulty after the Merge.
  • The spec lists three outcomes if a freeze is missed (hash rate up, down or flat), all leading to longer block times, and argues that clients are motivated to avoid this.
  • Test cases and an implementation were never provided ("TBD" in the spec).

#difficulty-bomb #proof-of-work #consensus #core

Details

Authors
James Hancock (@madeoftin)
Status
Stagnant
Type
Standards Track / Core
Created
2020-02-10

Machine-readable: Markdown · JSON