Skip to content
Merged
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
16 changes: 7 additions & 9 deletions ethdb/privateapi/ethbackend.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const MaxBuilders = 128
var UnknownPayloadErr = rpc.CustomError{Code: -38001, Message: "Unknown payload"}
var InvalidForkchoiceStateErr = rpc.CustomError{Code: -38002, Message: "Invalid forkchoice state"}
var InvalidPayloadAttributesErr = rpc.CustomError{Code: -38003, Message: "Invalid payload attributes"}
var ErrWithdrawalsNotSupported = rpc.CustomError{Code: -38004, Message: "Withdrawals not supported"}
var InvalidParamsErr = rpc.CustomError{Code: -32602, Message: "Invalid params"}

type EthBackendServer struct {
remote.UnimplementedETHBACKENDServer // must be embedded to have forward compatible implementations.
Expand Down Expand Up @@ -315,6 +315,10 @@ func (s *EthBackendServer) engineNewPayload(req *types2.ExecutionPayload, withdr
header.WithdrawalsHash = &wh
}

if !s.config.IsShanghai(header.Time) && withdrawals != nil || s.config.IsShanghai(header.Time) && withdrawals == nil {
return nil, &InvalidParamsErr
}

blockHash := gointerfaces.ConvertH256ToHash(req.BlockHash)
if header.Hash() != blockHash {
log.Error("[NewPayload] invalid block hash", "stated", libcommon.Hash(blockHash), "actual", header.Hash())
Expand Down Expand Up @@ -646,14 +650,8 @@ func (s *EthBackendServer) engineForkChoiceUpdated(ctx context.Context, reqForkc
}

// If pre-Shanghai and there are withdrawals, we should error
if reqWithdrawals != nil && !s.config.IsShanghai(payloadAttributes.Timestamp) {
return &remote.EngineForkChoiceUpdatedReply{
PayloadStatus: &remote.EnginePayloadStatus{
Status: remote.EngineStatus_INVALID,
LatestValidHash: gointerfaces.ConvertHashToH256(headHash),
},
PayloadId: s.payloadId,
}, &ErrWithdrawalsNotSupported
if !s.config.IsShanghai(headHeader.Time) && reqWithdrawals != nil {
return nil, &InvalidParamsErr
}

// Initiate payload building
Expand Down