Skip to content

Latest commit

 

History

History
138 lines (93 loc) · 9.72 KB

eip-2515.md

File metadata and controls

138 lines (93 loc) · 9.72 KB
eip title author discussions-to status type category created
2515
Update Difficulty Bomb with a Freezing Mechanism
James Hancock (@madeoftin)
Draft
Standards Track
Core
2020/02/10

Update Difficulty Bomb with a Freezing Mechanism

*Discussion Note

This is an active document to see the most recent version please make comments on https://hackmd.io/pL5JAgN2STSzqV7_ZSoT_Q

Long form discussion is also avaible on the forum: https://ethereum-magicians.org/t/eip-2515-replace-the-difficulty-bomb-with-a-difficulty-freeze/3995

Simple Summary

The Difficulty Freeze is an update to the Difficulty Bomb implemented within the Ethereum protocol's difficulty adjustment algorithm. The difficulty would freeze at a specific block height, determined in advance, and increases through a predictable mechanism. This does not stop the chain, but it keeps the functionality of the original difficulty bomb, while making it simple to predict when it occurs in the future.

Abstract

The difficulty freeze mechanism is easy to predict and model. The client maintainers are also positioned to respond to an incoming Difficulty Freeze because they are the arbiters of client release code. This, combined with the predictability, will lead to more timely diffusion of the bomb.

Motivation

The current difficulty bombs' effect on the Block Time Targeting mechanism is rather complex to model, and it has both appeared when it was not expected (Muir Glacier) and negatively affected users and miners when they are not the target (in the case of delaying forks due to technical difficulties).

  • Users are affected as a function of the usability of the chain is affected by increased block times.
  • Miners are affected by an unplanned reduction in block rewards due to the increase in block time.

Both of these groups are unable on their own to address the difficulty bomb. In the case of the Difficulty Freeze it is more predictiable and so knowing when to make the change is readily apparent at all times to all stakeholders.

Specification

Add variable DIFFICULTY_FREEZE_HEIGHT

The logic of the Difficulty Freeze is defined as follows:

### If before the Freeze adjust the difficulty as normal
if (BLOCK_HEIGHT <= DIFFICULTY_FREEZE_HEIGHT):
   block_diff = parent_diff + parent_diff // 2048 * max(
                1 - (block_timestamp - parent_timestamp) // 10, -99)

### After the difficulty freeze increase the difficulty every block by .01%
else:
 block_diff = parent_diff + parent_diff * 0.0001

Optional Implementation

Add the variable DIFFICULTY_FREEZE_DIFFERENCE and use the LAST_FORK_HEIGHT to calculate when the Difficulty Freeze would occur.

For example we can set the DFD = 1,800,000 blocks or approximately 9 months. The Difficulty Calculation would then be.

if (BLOCK_HEIGHT  <= LAST_FORK_HEIGHT + DIFFICUTLY_FREEZE_DIFFERENCE) :
   block_diff = parent_diff + parent_diff // 2048 * max(
                1 - (block_timestamp - parent_timestamp) // 10, -99)

else:
 block_diff = parent_diff + parent_diff * 0.0001

This approach would have the added benefit that updating the Difficulty Freeze happens automatically at the time of every upgrade. The trade-off is that the logic for checking is more complex and would require further analysis and test cases to ensure no consensus bugs arise.

Rationale

Why use Block Height?

Block height is very easy to predict and evaluate within the system. This removes the unpredictable part of the block time targeting mechanism and when the bomb takes effect will be well known in advance by all parties.

Once a block height is reached there are two approaches that can achieve the goal of "eventual assured obsolescence". I will document each as we have not yet determined, which is the preferred method.

  • Freeze Difficulty Than increase Difficulty at each block.
  • At a certain block height start to increase the target block time.

Freeze Difficulty Than increase Difficulty at each block.

[Todo @madeoftin]

Rationale behind the 0.001% Increase

The algorithm is not purely linear, but slowly increases exponentially every block by .01% of the previous. It still needs to be determined if a pure linear function is preferred, or which value of the scalar if it is exponential.

[Insert Graphs]

At a certain block height start to increase the target block time.

[Todo @madeoftin]

Backwards Compatibility

No backward incompatibilities

Test Cases

TBD

Implementation

TBD

Security Considerations

The effect of missing the Difficulty Freeze has a different impact than missing the Difficulty Bomb. At the point of a Difficulty freeze, the protocol is no longer able to adapt to changes in hash power on the network. This can lead to one of three scenarios.

  • The Hash rate Increases: Block Times would increase on the network for short time until the steady increase in difficulty is too high for the network to add any more miners.
  • The Hash rate decreases: Block times would increase.
  • The Hash rate stays the same: A consistent increase in blocktimes.

Clients are motivated to have their client sync fully to the network and so are very motivated to keep this situation from occurring. Simultaneously delaying the Difficulty Freeze is most easily implemented by client teams. Therefore the group that is most negatively affected is also the group that can most efficiently address it.

Economic Considerations

Under the current Difficult, Bomb issuance of ETH is reduced as the Ice Age takes affect. Under the Difficulty Freeze, it is more likely that issuance would increase for a short time; however, clients are motivated to prevent this and keep clients syncing effectively. This means it is much less likely to occur. However, The steady increase of difficulty after the freeze will shortly reduce blocktimes and also issuance.

It is also easy when the freeze occurs, and stakeholders who are affected (Eth Holders) can keep client developers accountable by observing when the Difficulty Freeze is approaching and yell at them on twitter.

Update History

This chronicles the significant updates to the proposal, and answers "How did the proposal get to where it is today" in an effort to bring readers of the EIP along for the journey.

  • Update from a Freeze to Freeze and Blow up
    • The addition of increasing difficulty after the freeze was added after feedback that the game theory of the mechanism did not reliably result in planned obsolescence of the chain. It was still theoretically possible that a chain could continue in a zombie state with miners self-regulating hashrate to keep the chain at a semi-functional state. While the game theory tended towards miners reaching blocktimes too fast for the network to propagate, the addition of a steady increase in difficulty removes this possibility and is therefore more secure. https://twitter.com/quentinc137/status/1227110578235330562
  • Evaluate whether increasing the difficulty, or increasing the target block time is preferred.
    • The possibility of increasing the target block time was introduced on the AllCoreDevs call. They both need to be evaluated side by side to make the best decision regarding the network.

Copyright

Copyright and related rights waived via CC0.