mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 10:50:44 +00:00
eth/catalyst: return -32602 for FCU V2 wrong payloadAttributes version
This commit is contained in:
parent
723aae2b4e
commit
c50e7dd240
3 changed files with 13 additions and 6 deletions
|
|
@ -180,11 +180,11 @@ func (api *ConsensusAPI) ForkchoiceUpdatedV2(update engine.ForkchoiceStateV1, pa
|
||||||
if params != nil {
|
if params != nil {
|
||||||
switch {
|
switch {
|
||||||
case params.BeaconRoot != nil:
|
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:
|
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:
|
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):
|
case !api.checkFork(params.Timestamp, forks.Paris, forks.Shanghai):
|
||||||
return engine.STATUS_INVALID, unsupportedForkErr("fcuV2 must only be called with paris or shanghai payloads")
|
return engine.STATUS_INVALID, unsupportedForkErr("fcuV2 must only be called with paris or shanghai payloads")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1205,6 +1205,13 @@ func TestNilWithdrawals(t *testing.T) {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatal("wanted error on fcuv2 with invalid withdrawals")
|
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 have, want := engineErr.ErrorCode(), -32602; have != want {
|
||||||
|
t.Fatalf("wrong error code, have %d want %d", have, want)
|
||||||
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -53,11 +53,11 @@ func (api *ConsensusAPI) ForkchoiceUpdatedWithWitnessV2(update engine.Forkchoice
|
||||||
if params != nil {
|
if params != nil {
|
||||||
switch {
|
switch {
|
||||||
case params.BeaconRoot != nil:
|
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:
|
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:
|
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):
|
case !api.checkFork(params.Timestamp, forks.Paris, forks.Shanghai):
|
||||||
return engine.STATUS_INVALID, unsupportedForkErr("fcuV2 must only be called with paris or shanghai payloads")
|
return engine.STATUS_INVALID, unsupportedForkErr("fcuV2 must only be called with paris or shanghai payloads")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue