diff --git a/eth/catalyst/api.go b/eth/catalyst/api.go index c8bee5c8a4..aa5fb02ef2 100644 --- a/eth/catalyst/api.go +++ b/eth/catalyst/api.go @@ -245,8 +245,9 @@ func (api *ConsensusAPI) ForkchoiceUpdatedV3(update engine.ForkchoiceStateV1, pa 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 && api.eth.BlockChain().Config().LatestFork(params.Timestamp) != forks.Prague { - return engine.STATUS_INVALID, engine.UnsupportedFork.With(errors.New("forkchoiceUpdatedV3 must only be called for cancun payloads")) + latestFork := api.eth.BlockChain().Config().LatestFork(params.Timestamp) + if latestFork != forks.Cancun && latestFork != forks.Prague && latestFork != forks.Osaka { + return engine.STATUS_INVALID, engine.UnsupportedFork.With(errors.New("forkchoiceUpdatedV3 must only be called for cancun, prague and osaka payloads")) } } // TODO(matt): the spec requires that fcu is applied when called on a valid @@ -303,8 +304,9 @@ func (api *ConsensusAPI) ForkchoiceUpdatedWithWitnessV3(update engine.Forkchoice 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 && api.eth.BlockChain().Config().LatestFork(params.Timestamp) != forks.Prague { - return engine.STATUS_INVALID, engine.UnsupportedFork.With(errors.New("forkchoiceUpdatedV3 must only be called for cancun payloads")) + latestFork := api.eth.BlockChain().Config().LatestFork(params.Timestamp) + if latestFork != forks.Cancun && latestFork != forks.Prague && latestFork != forks.Osaka { + return engine.STATUS_INVALID, engine.UnsupportedFork.With(errors.New("forkchoiceUpdatedV3 must only be called for cancun, prague and osaka payloads")) } } // TODO(matt): the spec requires that fcu is applied when called on a valid @@ -666,8 +668,9 @@ func (api *ConsensusAPI) NewPayloadV4(params engine.ExecutableData, versionedHas return engine.PayloadStatusV1{Status: engine.INVALID}, engine.InvalidParams.With(errors.New("nil executionRequests post-prague")) } - if api.eth.BlockChain().Config().LatestFork(params.Timestamp) != forks.Prague { - return engine.PayloadStatusV1{Status: engine.INVALID}, engine.UnsupportedFork.With(errors.New("newPayloadV4 must only be called for prague payloads")) + latestFork := api.eth.BlockChain().Config().LatestFork(params.Timestamp) + if latestFork != forks.Prague && latestFork != forks.Osaka { + return engine.PayloadStatusV1{Status: engine.INVALID}, engine.UnsupportedFork.With(errors.New("newPayloadV4 must only be called for prague or osaka payloads")) } requests := convertRequests(executionRequests) if err := validateRequests(requests); err != nil { @@ -788,8 +791,9 @@ func (api *ConsensusAPI) NewPayloadWithWitnessV4(params engine.ExecutableData, v return engine.PayloadStatusV1{Status: engine.INVALID}, engine.InvalidParams.With(errors.New("nil executionRequests post-prague")) } - if api.eth.BlockChain().Config().LatestFork(params.Timestamp) != forks.Prague { - return engine.PayloadStatusV1{Status: engine.INVALID}, engine.UnsupportedFork.With(errors.New("newPayloadWithWitnessV4 must only be called for prague payloads")) + latestFork := api.eth.BlockChain().Config().LatestFork(params.Timestamp) + if latestFork != forks.Prague && latestFork != forks.Osaka { + return engine.PayloadStatusV1{Status: engine.INVALID}, engine.UnsupportedFork.With(errors.New("newPayloadWithWitnessV4 must only be called for prague or osaka payloads")) } requests := convertRequests(executionRequests) if err := validateRequests(requests); err != nil {