本文分析了Besu代码库中由于遗漏Holesky和Sepolia网络的DEPOSIT_CONTRACT_ADDRESS配置而导致的问题。Holesky主网因此发生了supermajority链分裂,文章探讨了潜在的影响因素,包括测试网与主网配置差异、EIP-6110规范的不足以及Besu特定的默认行为。提出了改进建议,如尽早失败、采用eth_config共享配置等,并回顾了相关事件的时间线。
对规范变更以及导致 Holesky 和 Sepolia 遗漏 DEPOSIT_CONTRACT_ADDRESS
的 Besu 代码库演变的分析。
这最终导致了 Holesky 上的超多数链分裂,因为 Geth 和 Nethermind 也有类似的错误:https://github.com/ethereum/pm/blob/master/Pectra/holesky-postmortem.md
本次事后分析的目的不是为了指责,而是为了帮助我们理解如何避免未来出现类似的问题。
DEPOSIT_CONTRACT_ADDRESS
使用不同的值depositContractAddress
depositContractAddress
;不包含在 besu.json 或 chainspec.json 中eth_config
https://hackmd.io/@shemnon/eth_config
eth_config
无论如何都可以缓解这个问题)
https://eth2book.info/capella/part2/deposits-withdrawals/contract/
存款合约于 2020 年 10 月 14 日 UTC 时间 09:22:52 部署到以太坊地址
0x00000000219ab540356cbb839cbe05303d7705fa
。
https://github.com/eth-clients/sepolia/
Sepolia 启动(没有存款合约)
Sepolia 存款合约于 Jun-09-2022 02:58:14 PM UTC
部署到 0x7f02C3E3c98b133055B8B348B2Ac625669Ed295D
https://github.com/ethereum/EIPs/pull/6110
初始规范仅包含主网 DEPOSIT_CONTRACT_ADDRESS
此时 Sepolia 存款合约已存在,但 Holesky 网络不存在。
在撰写本文时(2025 年 3 月),规范仍仅包含主网 DEPOSIT_CONTRACT_ADDRESS
https://github.com/hyperledger/besu/pull/5295 (EIP-6110:添加存款验证和 API)
DEFAULT_DEPOSIT_CONTRACT_ADDRESS
: public static final Address DEFAULT_DEPOSIT_CONTRACT_ADDRESS =
Address.fromHexString("0x00000000219ab540356cbb839cbe05303d7705fa");
final Address depositContractAddress =
genesisConfigOptions.getDepositContractAddress().orElse(DEFAULT_DEPOSIT_CONTRACT_ADDRESS);
https://github.com/eth-clients/holesky
Holesky 启动,DEPOSIT_CONTRACT_ADDRESS
在 genesis 中预部署到
0x4242424242424242424242424242424242424242
Besu 没有将 depositContractAddress
添加到 EIP-6110 将使用的 Holesky 配置中(主网、Sepolia 或 Goerli 也没有)。
http://github.com/hyperledger/besu/pull/6783 (添加 engine_getPayloadV4 和 engine_newPayloadV4)
DEFAULT_DEPOSIT_CONTRACT_ADDRESS
final Address depositContractAddress =
genesisConfigOptions.getDepositContractAddress().orElse(DEFAULT_DEPOSIT_CONTRACT_ADDRESS);
各种人通过各种 PR(实现各种规范更改)重构了 DEFAULT_DEPOSIT_CONTRACT_ADDRESS
的位置和连接/加载代码。
这些重构对根本原因没有重大影响,但可能会削弱对系统的知识和理解。
https://github.com/hyperledger/besu/pull/7068 (EIP-7685 通用执行层请求)
https://github.com/hyperledger/besu/pull/7647 (在 jsonGenesisConfig 中添加 consolidationRequestContract)
https://github.com/hyperledger/besu/pull/7771 (更改请求以使用平面编码)
- 原文链接: hackmd.io/@siladu/H1qydm...
- 登链社区 AI 助手,为大家转译优秀英文文章,如有翻译不通的地方,还请包涵~
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!