mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 19:50:36 +00:00
fix: payload version error return (#6618)
See https://github.com/ethereum/execution-apis/pull/337
This commit is contained in:
parent
3f07c66928
commit
3837d6d26d
@ -46,7 +46,7 @@ const MaxBuilders = 128
|
|||||||
var UnknownPayloadErr = rpc.CustomError{Code: -38001, Message: "Unknown payload"}
|
var UnknownPayloadErr = rpc.CustomError{Code: -38001, Message: "Unknown payload"}
|
||||||
var InvalidForkchoiceStateErr = rpc.CustomError{Code: -38002, Message: "Invalid forkchoice state"}
|
var InvalidForkchoiceStateErr = rpc.CustomError{Code: -38002, Message: "Invalid forkchoice state"}
|
||||||
var InvalidPayloadAttributesErr = rpc.CustomError{Code: -38003, Message: "Invalid payload attributes"}
|
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 {
|
type EthBackendServer struct {
|
||||||
remote.UnimplementedETHBACKENDServer // must be embedded to have forward compatible implementations.
|
remote.UnimplementedETHBACKENDServer // must be embedded to have forward compatible implementations.
|
||||||
@ -315,6 +315,10 @@ func (s *EthBackendServer) engineNewPayload(req *types2.ExecutionPayload, withdr
|
|||||||
header.WithdrawalsHash = &wh
|
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)
|
blockHash := gointerfaces.ConvertH256ToHash(req.BlockHash)
|
||||||
if header.Hash() != blockHash {
|
if header.Hash() != blockHash {
|
||||||
log.Error("[NewPayload] invalid block hash", "stated", libcommon.Hash(blockHash), "actual", header.Hash())
|
log.Error("[NewPayload] invalid block hash", "stated", libcommon.Hash(blockHash), "actual", header.Hash())
|
||||||
@ -646,14 +650,8 @@ func (s *EthBackendServer) engineForkChoiceUpdated(ctx context.Context, reqForkc
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If pre-Shanghai and there are withdrawals, we should error
|
// If pre-Shanghai and there are withdrawals, we should error
|
||||||
if reqWithdrawals != nil && !s.config.IsShanghai(payloadAttributes.Timestamp) {
|
if !s.config.IsShanghai(headHeader.Time) && reqWithdrawals != nil {
|
||||||
return &remote.EngineForkChoiceUpdatedReply{
|
return nil, &InvalidParamsErr
|
||||||
PayloadStatus: &remote.EnginePayloadStatus{
|
|
||||||
Status: remote.EngineStatus_INVALID,
|
|
||||||
LatestValidHash: gointerfaces.ConvertHashToH256(headHash),
|
|
||||||
},
|
|
||||||
PayloadId: s.payloadId,
|
|
||||||
}, &ErrWithdrawalsNotSupported
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initiate payload building
|
// Initiate payload building
|
||||||
|
Loading…
Reference in New Issue
Block a user