From 4cc0f14c90a55ee79e06b47807cadaf0bd5075b2 Mon Sep 17 00:00:00 2001 From: Sina Mahmoodi Date: Thu, 22 Feb 2024 18:35:36 +0100 Subject: [PATCH] fix beacon root and payload version --- eth/catalyst/simulated_beacon.go | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/eth/catalyst/simulated_beacon.go b/eth/catalyst/simulated_beacon.go index b2e7dd24ab..42d596d000 100644 --- a/eth/catalyst/simulated_beacon.go +++ b/eth/catalyst/simulated_beacon.go @@ -161,14 +161,22 @@ func (c *SimulatedBeacon) sealBlock(withdrawals []*types.Withdrawal, timestamp u c.setCurrentState(header.Hash(), *finalizedHash) } - var random [32]byte + var ( + random [32]byte + payloadVersion = engine.PayloadV2 + attrs = &engine.PayloadAttributes{ + Timestamp: timestamp, + SuggestedFeeRecipient: feeRecipient, + Withdrawals: withdrawals, + Random: random, + } + ) rand.Read(random[:]) - fcResponse, err := c.engineAPI.forkchoiceUpdated(c.curForkchoiceState, &engine.PayloadAttributes{ - Timestamp: timestamp, - SuggestedFeeRecipient: feeRecipient, - Withdrawals: withdrawals, - Random: random, - }, engine.PayloadV2, true) + if isCancun { + payloadVersion = engine.PayloadV3 + attrs.BeaconRoot = &common.Hash{} + } + fcResponse, err := c.engineAPI.forkchoiceUpdated(c.curForkchoiceState, attrs, payloadVersion, true) if err != nil { return err }