diff --git a/core/types/block.go b/core/types/block.go index 7c70bd0f700a..bb9d547c75f4 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -366,6 +366,11 @@ func (b *Block) Requests() Requests { return b.requests } func (b *Block) Deposits() Deposits { var deps Deposits + if b.requests != nil { + // If requests is non-nil, it means deposits are available in block and we + // should return an empty slice instead of nil if there are no deposits. + deps = make(Deposits, 0) + } for _, r := range b.requests { if d, ok := r.inner.(*Deposit); ok { deps = append(deps, d) @@ -375,6 +380,11 @@ func (b *Block) Deposits() Deposits { } func (b *Block) WithdrawalRequests() WithdrawalRequests { var wxs WithdrawalRequests + if b.requests != nil { + // If requests is non-nil, it means wx requests are available in block and + // we should return an empty slice instead of nil if there are no wxs. + wxs = make(WithdrawalRequests, 0) + } for _, r := range b.requests { if w, ok := r.inner.(*WithdrawalRequest); ok { wxs = append(wxs, w) diff --git a/eth/catalyst/api.go b/eth/catalyst/api.go index 62c6e5e6d95f..0a674ba27b71 100644 --- a/eth/catalyst/api.go +++ b/eth/catalyst/api.go @@ -553,8 +553,8 @@ func (api *ConsensusAPI) NewPayloadV4(params engine.ExecutableData, versionedHas return engine.PayloadStatusV1{Status: engine.INVALID}, engine.InvalidParams.With(errors.New("nil beaconRoot post-cancun")) } - if api.eth.BlockChain().Config().LatestFork(params.Timestamp) != forks.Cancun { - return engine.PayloadStatusV1{Status: engine.INVALID}, engine.UnsupportedFork.With(errors.New("newPayloadV3 must only be called for cancun payloads")) + if api.eth.BlockChain().Config().LatestFork(params.Timestamp) != forks.Prague { + return engine.PayloadStatusV1{Status: engine.INVALID}, engine.UnsupportedFork.With(errors.New("newPayloadV4 must only be called for prague payloads")) } return api.newPayload(params, versionedHashes, beaconRoot) } diff --git a/eth/catalyst/simulated_beacon.go b/eth/catalyst/simulated_beacon.go index fecd83f2762c..77aeba336af4 100644 --- a/eth/catalyst/simulated_beacon.go +++ b/eth/catalyst/simulated_beacon.go @@ -101,7 +101,7 @@ func NewSimulatedBeacon(period uint64, eth *eth.Ethereum) (*SimulatedBeacon, err // if genesis block, send forkchoiceUpdated to trigger transition to PoS if block.Number.Sign() == 0 { - if _, err := engineAPI.ForkchoiceUpdatedV2(current, nil); err != nil { + if _, err := engineAPI.ForkchoiceUpdatedV3(current, nil); err != nil { return nil, err } } @@ -202,13 +202,13 @@ func (c *SimulatedBeacon) sealBlock(withdrawals []*types.Withdrawal, timestamp u } } // Mark the payload as canon - if _, err = c.engineAPI.NewPayloadV3(*payload, blobHashes, &common.Hash{}); err != nil { + if _, err = c.engineAPI.NewPayloadV4(*payload, blobHashes, &common.Hash{}); err != nil { return err } c.setCurrentState(payload.BlockHash, finalizedHash) // Mark the block containing the payload as canonical - if _, err = c.engineAPI.ForkchoiceUpdatedV2(c.curForkchoiceState, nil); err != nil { + if _, err = c.engineAPI.ForkchoiceUpdatedV3(c.curForkchoiceState, nil); err != nil { return err } c.lastBlockTime = payload.Timestamp