Skip to content

Commit

Permalink
eth/catalyst: return invalid params instead of invalid payload params (
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusVanDerWijden authored and shekhirin committed Jun 6, 2023
1 parent 5f4e14e commit c2586d7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions core/beacon/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ var (
UnknownPayload = &EngineAPIError{code: -38001, msg: "Unknown payload"}
InvalidForkChoiceState = &EngineAPIError{code: -38002, msg: "Invalid forkchoice state"}
InvalidPayloadAttributes = &EngineAPIError{code: -38003, msg: "Invalid payload attributes"}
InvalidParams = &EngineAPIError{code: -32602, msg: "Invalid parameters"}

STATUS_INVALID = ForkChoiceResponse{PayloadStatus: PayloadStatusV1{Status: INVALID}, PayloadID: nil}
STATUS_SYNCING = ForkChoiceResponse{PayloadStatus: PayloadStatusV1{Status: SYNCING}, PayloadID: nil}
Expand Down
4 changes: 2 additions & 2 deletions eth/catalyst/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func NewConsensusAPI(eth *eth.Ethereum) *ConsensusAPI {
// and return its payloadID.
func (api *ConsensusAPI) ForkchoiceUpdatedV1(update beacon.ForkchoiceStateV1, payloadAttributes *beacon.PayloadAttributes) (beacon.ForkChoiceResponse, error) {
if payloadAttributes != nil && payloadAttributes.Withdrawals != nil {
return beacon.STATUS_INVALID, fmt.Errorf("withdrawals not supported in V1")
return beacon.STATUS_INVALID, beacon.InvalidParams.With(fmt.Errorf("withdrawals not supported in V1"))
}
return api.forkchoiceUpdated(update, payloadAttributes)
}
Expand All @@ -177,7 +177,7 @@ func (api *ConsensusAPI) ForkchoiceUpdatedV1(update beacon.ForkchoiceStateV1, pa
func (api *ConsensusAPI) ForkchoiceUpdatedV2(update beacon.ForkchoiceStateV1, payloadAttributes *beacon.PayloadAttributes) (beacon.ForkChoiceResponse, error) {
if payloadAttributes != nil {
if err := api.verifyPayloadAttributes(payloadAttributes); err != nil {
return beacon.STATUS_INVALID, beacon.InvalidPayloadAttributes.With(err)
return beacon.STATUS_INVALID, beacon.InvalidParams.With(err)
}
}
return api.forkchoiceUpdated(update, payloadAttributes)
Expand Down

0 comments on commit c2586d7

Please sign in to comment.