Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions eth/catalyst/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,11 @@ func (api *ConsensusAPI) ForkchoiceUpdatedV2(update engine.ForkchoiceStateV1, pa
if params != nil {
switch {
case params.BeaconRoot != nil:
return engine.STATUS_INVALID, attributesErr("unexpected beacon root")
return engine.STATUS_INVALID, paramsErr("unexpected beacon root")
case api.checkFork(params.Timestamp, forks.Paris) && params.Withdrawals != nil:
return engine.STATUS_INVALID, attributesErr("withdrawals before shanghai")
return engine.STATUS_INVALID, paramsErr("withdrawals before shanghai")
case api.checkFork(params.Timestamp, forks.Shanghai) && params.Withdrawals == nil:
return engine.STATUS_INVALID, attributesErr("missing withdrawals")
return engine.STATUS_INVALID, paramsErr("missing withdrawals")
case !api.checkFork(params.Timestamp, forks.Paris, forks.Shanghai):
return engine.STATUS_INVALID, unsupportedForkErr("fcuV2 must only be called with paris or shanghai payloads")
}
Expand Down
7 changes: 7 additions & 0 deletions eth/catalyst/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1205,6 +1205,13 @@ func TestNilWithdrawals(t *testing.T) {
if err == nil {
t.Fatal("wanted error on fcuv2 with invalid withdrawals")
}
var engineErr *engine.EngineAPIError
if !errors.As(err, &engineErr) {
t.Fatalf("expected EngineAPIError, got %T", err)
}
if engineErr.ErrorCode() != -32602 {
t.Fatalf("wrong error code, have %d want %d", engineErr.ErrorCode(), -32602)
}
continue
}
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions eth/catalyst/witness.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ func (api *ConsensusAPI) ForkchoiceUpdatedWithWitnessV2(update engine.Forkchoice
if params != nil {
switch {
case params.BeaconRoot != nil:
return engine.STATUS_INVALID, attributesErr("unexpected beacon root")
return engine.STATUS_INVALID, paramsErr("unexpected beacon root")
case api.checkFork(params.Timestamp, forks.Paris) && params.Withdrawals != nil:
return engine.STATUS_INVALID, attributesErr("withdrawals before shanghai")
return engine.STATUS_INVALID, paramsErr("withdrawals before shanghai")
case api.checkFork(params.Timestamp, forks.Shanghai) && params.Withdrawals == nil:
return engine.STATUS_INVALID, attributesErr("missing withdrawals")
return engine.STATUS_INVALID, paramsErr("missing withdrawals")
case !api.checkFork(params.Timestamp, forks.Paris, forks.Shanghai):
return engine.STATUS_INVALID, unsupportedForkErr("fcuV2 must only be called with paris or shanghai payloads")
}
Expand Down