mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
eth/catalyst: return -32602 for FCU V2 wrong payloadAttributes version
This commit is contained in:
parent
723aae2b4e
commit
5460a0b647
3 changed files with 13 additions and 6 deletions
|
|
@ -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")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue