启动eth2.0 一段时间后,报如下错误
WARN [05-24|11:39:02.090] Served engine_forkchoiceUpdatedV3 conn=127.0.0.1:53124 reqid=355251 duration="74.273µs" err="Unsupported fork" errdata="{Error:forkchoiceUpdatedV3 must only be called for cancun payloads}"
// ForkchoiceUpdatedV3 is equivalent to V2 with the addition of parent beacon block root
// in the payload attributes. It supports only PayloadAttributesV3.
func (api *ConsensusAPI) ForkchoiceUpdatedV3(update engine.ForkchoiceStateV1, params *engine.PayloadAttributes) (engine.ForkChoiceResponse, error) {
if params != nil {
if params.Withdrawals == nil {
return engine.STATUS_INVALID, engine.InvalidPayloadAttributes.With(errors.New("missing withdrawals"))
}
if params.BeaconRoot == nil {
return engine.STATUS_INVALID, engine.InvalidPayloadAttributes.With(errors.New("missing beacon root"))
}
if api.eth.BlockChain().Config().LatestFork(params.Timestamp) != forks.Cancun { // 关键代码
return engine.STATUS_INVALID, engine.UnsupportedFork.With(errors.New("forkchoiceUpdatedV3 must only be called for cancun payloads"))
}
}
// LatestFork returns the latest time-based fork that would be active for the given time.
func (c *ChainConfig) LatestFork(time uint64) forks.Fork {
// Assume last non-time-based fork has passed.
london := c.LondonBlock
switch {
case c.IsPrague(london, time):
return forks.Prague
case c.IsCancun(london, time):
return forks.Cancun
case c.IsShanghai(london, time):
return forks.Shanghai
default:
return forks.Paris
}
}
当前genesis配置如下
{
"config": {
"chainId": ....,
"homesteadBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0,
"istanbulBlock": 0,
"berlinBlock": 0,
"londonBlock": 0,
"mergeNetsplitBlock": 0,
"terminalTotalDifficulty": 0,
"terminalTotalDifficultyPassed": true,
"shanghaiTime": 0,
"cancunTime": 0,
"pragueTime": 1716532255
},
....
"coinbase": "0x0000000000000000000000000000000000000000",
"difficulty": "0x01",
"extraData": "",
"gasLimit": "0x17d7840",
"nonce": "0x1234",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp": "1715760655"
由于设置了pragueTime,所以LatestFork会返回Prague fork,不会是Cancun,所以ForkchoiceUpdatedV3会报错,至于Prague为什么不支持ForkchoiceUpdatedV3,留个TODO
目前要做的是把最新的fork改为Cancun
- 将genesis.json中的pragueTime删掉
- 停止geth服务
- 重新初始化
./geth --config ./config/config.toml init ./config/genesis.json
- 重启geth服务