Skip to content

Commit c2586d7

Browse files
MariusVanDerWijdenshekhirin
authored andcommitted
eth/catalyst: return invalid params instead of invalid payload params (ethereum#26591)
1 parent 5f4e14e commit c2586d7

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

core/beacon/errors.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ var (
8080
UnknownPayload = &EngineAPIError{code: -38001, msg: "Unknown payload"}
8181
InvalidForkChoiceState = &EngineAPIError{code: -38002, msg: "Invalid forkchoice state"}
8282
InvalidPayloadAttributes = &EngineAPIError{code: -38003, msg: "Invalid payload attributes"}
83+
InvalidParams = &EngineAPIError{code: -32602, msg: "Invalid parameters"}
8384

8485
STATUS_INVALID = ForkChoiceResponse{PayloadStatus: PayloadStatusV1{Status: INVALID}, PayloadID: nil}
8586
STATUS_SYNCING = ForkChoiceResponse{PayloadStatus: PayloadStatusV1{Status: SYNCING}, PayloadID: nil}

eth/catalyst/api.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ func NewConsensusAPI(eth *eth.Ethereum) *ConsensusAPI {
168168
// and return its payloadID.
169169
func (api *ConsensusAPI) ForkchoiceUpdatedV1(update beacon.ForkchoiceStateV1, payloadAttributes *beacon.PayloadAttributes) (beacon.ForkChoiceResponse, error) {
170170
if payloadAttributes != nil && payloadAttributes.Withdrawals != nil {
171-
return beacon.STATUS_INVALID, fmt.Errorf("withdrawals not supported in V1")
171+
return beacon.STATUS_INVALID, beacon.InvalidParams.With(fmt.Errorf("withdrawals not supported in V1"))
172172
}
173173
return api.forkchoiceUpdated(update, payloadAttributes)
174174
}
@@ -177,7 +177,7 @@ func (api *ConsensusAPI) ForkchoiceUpdatedV1(update beacon.ForkchoiceStateV1, pa
177177
func (api *ConsensusAPI) ForkchoiceUpdatedV2(update beacon.ForkchoiceStateV1, payloadAttributes *beacon.PayloadAttributes) (beacon.ForkChoiceResponse, error) {
178178
if payloadAttributes != nil {
179179
if err := api.verifyPayloadAttributes(payloadAttributes); err != nil {
180-
return beacon.STATUS_INVALID, beacon.InvalidPayloadAttributes.With(err)
180+
return beacon.STATUS_INVALID, beacon.InvalidParams.With(err)
181181
}
182182
}
183183
return api.forkchoiceUpdated(update, payloadAttributes)

0 commit comments

Comments
 (0)