diff --git a/turbo/engineapi/engine_server.go b/turbo/engineapi/engine_server.go index 2565162ea5d..c302139d91c 100644 --- a/turbo/engineapi/engine_server.go +++ b/turbo/engineapi/engine_server.go @@ -452,25 +452,20 @@ func (s *EngineServer) forkchoiceUpdated(ctx context.Context, forkchoiceState *e } if payloadAttributes != nil { + if version < clparams.DenebVersion && payloadAttributes.ParentBeaconBlockRoot != nil { + return nil, &engine_helpers.InvalidPayloadAttributesErr // Unexpected Beacon Root + } + if version >= clparams.DenebVersion && payloadAttributes.ParentBeaconBlockRoot == nil { + return nil, &engine_helpers.InvalidPayloadAttributesErr // Beacon Root missing + } + timestamp := uint64(payloadAttributes.Timestamp) if !s.config.IsCancun(timestamp) && version >= clparams.DenebVersion { // V3 before cancun - if payloadAttributes.ParentBeaconBlockRoot == nil { - return nil, &rpc.InvalidParamsError{Message: "Beacon Root missing"} - } return nil, &rpc.UnsupportedForkError{Message: "Unsupported fork"} } if s.config.IsCancun(timestamp) && version < clparams.DenebVersion { // Not V3 after cancun - if payloadAttributes.ParentBeaconBlockRoot != nil { - return nil, &rpc.InvalidParamsError{Message: "Unexpected Beacon Root"} - } return nil, &rpc.UnsupportedForkError{Message: "Unsupported fork"} } - - if s.config.IsCancun(timestamp) && version >= clparams.DenebVersion { - if payloadAttributes.ParentBeaconBlockRoot == nil { - return nil, &rpc.InvalidParamsError{Message: "Beacon Root missing"} - } - } } // No need for payload building @@ -484,19 +479,6 @@ func (s *EngineServer) forkchoiceUpdated(ctx context.Context, forkchoiceState *e headHeader := s.chainRW.GetHeaderByHash(forkchoiceState.HeadHash) - if headHeader.Hash() != forkchoiceState.HeadHash { - // Per Item 2 of https://github.com/ethereum/execution-apis/blob/v1.0.0-alpha.9/src/engine/specification.md#specification-1: - // Client software MAY skip an update of the forkchoice state and - // MUST NOT begin a payload build process if forkchoiceState.headBlockHash doesn't reference a leaf of the block tree. - // That is, the block referenced by forkchoiceState.headBlockHash is neither the head of the canonical chain nor a block at the tip of any other chain. - // In the case of such an event, client software MUST return - // {payloadStatus: {status: VALID, latestValidHash: forkchoiceState.headBlockHash, validationError: null}, payloadId: null}. - - s.logger.Warn("Skipping payload building because forkchoiceState.headBlockHash is not the head of the canonical chain", - "forkChoice.HeadBlockHash", forkchoiceState.HeadHash, "headHeader.Hash", headHeader.Hash()) - return &engine_types.ForkChoiceUpdatedResponse{PayloadStatus: status}, nil - } - timestamp := uint64(payloadAttributes.Timestamp) if headHeader.Time >= timestamp { return nil, &engine_helpers.InvalidPayloadAttributesErr