Skip to content

Commit dbd6c13

Browse files
eth/catalyst: return error if withdrawals are nil post-shanghai (#26691)
Spec: https://github.com/ethereum/execution-apis/blob/main/src/engine/shanghai.md#request
1 parent 101587b commit dbd6c13

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

eth/catalyst/api.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,13 +410,20 @@ func (api *ConsensusAPI) getPayload(payloadID engine.PayloadID) (*engine.Executi
410410
// NewPayloadV1 creates an Eth1 block, inserts it in the chain, and returns the status of the chain.
411411
func (api *ConsensusAPI) NewPayloadV1(params engine.ExecutableData) (engine.PayloadStatusV1, error) {
412412
if params.Withdrawals != nil {
413-
return engine.PayloadStatusV1{Status: engine.INVALID}, fmt.Errorf("withdrawals not supported in V1")
413+
return engine.PayloadStatusV1{Status: engine.INVALID}, engine.InvalidParams.With(fmt.Errorf("withdrawals not supported in V1"))
414414
}
415415
return api.newPayload(params)
416416
}
417417

418418
// NewPayloadV2 creates an Eth1 block, inserts it in the chain, and returns the status of the chain.
419419
func (api *ConsensusAPI) NewPayloadV2(params engine.ExecutableData) (engine.PayloadStatusV1, error) {
420+
if api.eth.BlockChain().Config().IsShanghai(params.Timestamp) {
421+
if params.Withdrawals == nil {
422+
return engine.PayloadStatusV1{Status: engine.INVALID}, engine.InvalidParams.With(fmt.Errorf("nil withdrawals post-shanghai"))
423+
}
424+
} else if params.Withdrawals != nil {
425+
return engine.PayloadStatusV1{Status: engine.INVALID}, engine.InvalidParams.With(fmt.Errorf("non-nil withdrawals pre-shanghai"))
426+
}
420427
return api.newPayload(params)
421428
}
422429

0 commit comments

Comments
 (0)