|
|
@ -20,6 +20,7 @@ package catalyst |
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"errors" |
|
|
|
"errors" |
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
|
|
|
|
"math/big" |
|
|
|
"sync" |
|
|
|
"sync" |
|
|
|
"time" |
|
|
|
"time" |
|
|
|
|
|
|
|
|
|
|
@ -167,7 +168,7 @@ func (api *ConsensusAPI) ForkchoiceUpdatedV1(update engine.ForkchoiceStateV1, pa |
|
|
|
if payloadAttributes.Withdrawals != nil { |
|
|
|
if payloadAttributes.Withdrawals != nil { |
|
|
|
return engine.STATUS_INVALID, engine.InvalidParams.With(fmt.Errorf("withdrawals not supported in V1")) |
|
|
|
return engine.STATUS_INVALID, engine.InvalidParams.With(fmt.Errorf("withdrawals not supported in V1")) |
|
|
|
} |
|
|
|
} |
|
|
|
if api.eth.BlockChain().Config().IsShanghai(payloadAttributes.Timestamp) { |
|
|
|
if api.eth.BlockChain().Config().IsShanghai(api.eth.BlockChain().Config().LondonBlock, payloadAttributes.Timestamp) { |
|
|
|
return engine.STATUS_INVALID, engine.InvalidParams.With(fmt.Errorf("forkChoiceUpdateV1 called post-shanghai")) |
|
|
|
return engine.STATUS_INVALID, engine.InvalidParams.With(fmt.Errorf("forkChoiceUpdateV1 called post-shanghai")) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -185,7 +186,7 @@ func (api *ConsensusAPI) ForkchoiceUpdatedV2(update engine.ForkchoiceStateV1, pa |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (api *ConsensusAPI) verifyPayloadAttributes(attr *engine.PayloadAttributes) error { |
|
|
|
func (api *ConsensusAPI) verifyPayloadAttributes(attr *engine.PayloadAttributes) error { |
|
|
|
if !api.eth.BlockChain().Config().IsShanghai(attr.Timestamp) { |
|
|
|
if !api.eth.BlockChain().Config().IsShanghai(api.eth.BlockChain().Config().LondonBlock, attr.Timestamp) { |
|
|
|
// Reject payload attributes with withdrawals before shanghai
|
|
|
|
// Reject payload attributes with withdrawals before shanghai
|
|
|
|
if attr.Withdrawals != nil { |
|
|
|
if attr.Withdrawals != nil { |
|
|
|
return errors.New("withdrawals before shanghai") |
|
|
|
return errors.New("withdrawals before shanghai") |
|
|
@ -423,7 +424,7 @@ func (api *ConsensusAPI) NewPayloadV1(params engine.ExecutableData) (engine.Payl |
|
|
|
|
|
|
|
|
|
|
|
// NewPayloadV2 creates an Eth1 block, inserts it in the chain, and returns the status of the chain.
|
|
|
|
// NewPayloadV2 creates an Eth1 block, inserts it in the chain, and returns the status of the chain.
|
|
|
|
func (api *ConsensusAPI) NewPayloadV2(params engine.ExecutableData) (engine.PayloadStatusV1, error) { |
|
|
|
func (api *ConsensusAPI) NewPayloadV2(params engine.ExecutableData) (engine.PayloadStatusV1, error) { |
|
|
|
if api.eth.BlockChain().Config().IsShanghai(params.Timestamp) { |
|
|
|
if api.eth.BlockChain().Config().IsShanghai(new(big.Int).SetUint64(params.Number), params.Timestamp) { |
|
|
|
if params.Withdrawals == nil { |
|
|
|
if params.Withdrawals == nil { |
|
|
|
return engine.PayloadStatusV1{Status: engine.INVALID}, engine.InvalidParams.With(fmt.Errorf("nil withdrawals post-shanghai")) |
|
|
|
return engine.PayloadStatusV1{Status: engine.INVALID}, engine.InvalidParams.With(fmt.Errorf("nil withdrawals post-shanghai")) |
|
|
|
} |
|
|
|
} |
|
|
|