EIP3554 - 难度炸弹延迟至 2021 年 12 月
# 简单总结
延迟难度炸弹以展示 2021 年 12 月的第一周的影响
# 摘要
从 FORK_BLOCK_NUMBER
开始,客户端将根据一个伪造的区块数计算难度,该数据建议客户端,难度炸弹的调整数量比实际区块数多 970 万个。
# 动机
2021 年 12 月以前进行的上海升级和/或合并。届时可以重新调整炸弹,也可以一起移除。
# 参数
# 用假区块数降低难度
为了 calc_difficulty
,只需将指数冰河时代组件中使用的 block.number
替换为以下公式:
fake_block_number = max(0, block.number - 9_700_000) if block.number >= FORK_BLOCK_NUMBER else block.number
# 基本原理
以下脚本预测: 12 月第一周的区块时间延迟 1 秒,月末延迟 1 秒。这就提供了解决原因,由于以后可以看到影响,但不是非常紧迫,如果需要,我们没有空间来解决。
def predict_diff_bomb_effect(current_blknum, current_difficulty, block_adjustment, months):
'''
Predicts the effect on block time (as a ratio) in a specified amount of months in the future.
Vars used in last prediction:
current_blknum = 12382958
current_difficulty = 7393633000000000
block adjustment = 9700000
months = 6
'''
blocks_per_month = (86400 * 30) // 13.3
future_blknum = current_blknum + blocks_per_month * months
diff_adjustment = 2 ** ((future_blknum - block_adjustment) // 100000 - 2)
diff_adjust_coeff = diff_adjustment / current_difficulty * 2048
return diff_adjust_coeff
diff_adjust_coeff = predict_diff_bomb_effect(12382958,7393633000000000,9700000,6)
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 向后兼容性
无已知向后兼容性问题。
# 注意事项
Misjudging the effects of the difficulty can mean longer blocktimes than anticipated until a hardfork is released. Wild shifts in difficulty can affect this number severely. Also, gradual changes in blocktimes due to longer-term adjustments in difficulty can affect the timing of difficulty bomb epochs. This affects the usability of the network but unlikely to have security ramifications. 错误判断难度的影响,意味着区块时间比预期的更长,直至硬分叉推出。难度的剧烈变化会严重影响这一时间。此外,由于长期调整难度,区块时间逐渐发生变化,将会影响难度炸弹的纪元时间。这会对网络的可用性产生影响,但造成安全后果的可能性很小。
# Copyright
Copyright and related rights waived via CC0 (opens new window).