@@ -18,6 +18,7 @@ package catalyst
1818
1919import (
2020 "crypto/rand"
21+ "crypto/sha256"
2122 "errors"
2223 "math/big"
2324 "sync"
@@ -27,6 +28,7 @@ import (
2728 "github.com/ethereum/go-ethereum/common"
2829 "github.com/ethereum/go-ethereum/core/txpool"
2930 "github.com/ethereum/go-ethereum/core/types"
31+ "github.com/ethereum/go-ethereum/crypto/kzg4844"
3032 "github.com/ethereum/go-ethereum/eth"
3133 "github.com/ethereum/go-ethereum/log"
3234 "github.com/ethereum/go-ethereum/node"
@@ -161,14 +163,14 @@ func (c *SimulatedBeacon) sealBlock(withdrawals []*types.Withdrawal, timestamp u
161163 SuggestedFeeRecipient : feeRecipient ,
162164 Withdrawals : withdrawals ,
163165 Random : random ,
164- }, engine .PayloadV2 , true )
166+ BeaconRoot : & common.Hash {},
167+ }, engine .PayloadV3 , true )
165168 if err != nil {
166169 return err
167170 }
168171 if fcResponse == engine .STATUS_SYNCING {
169172 return errors .New ("chain rewind prevented invocation of payload creation" )
170173 }
171-
172174 envelope , err := c .engineAPI .getPayload (* fcResponse .PayloadID , true )
173175 if err != nil {
174176 return err
@@ -186,8 +188,21 @@ func (c *SimulatedBeacon) sealBlock(withdrawals []*types.Withdrawal, timestamp u
186188 }
187189 }
188190
191+ // Independently calculate the blob hashes from sidecars.
192+ blobHashes := make ([]common.Hash , 0 )
193+ if envelope .BlobsBundle != nil {
194+ hasher := sha256 .New ()
195+ for _ , commit := range envelope .BlobsBundle .Commitments {
196+ var c kzg4844.Commitment
197+ if len (commit ) != len (c ) {
198+ return errors .New ("invalid commitment length" )
199+ }
200+ copy (c [:], commit )
201+ blobHashes = append (blobHashes , kzg4844 .CalcBlobHashV1 (hasher , & c ))
202+ }
203+ }
189204 // Mark the payload as canon
190- if _ , err = c .engineAPI .NewPayloadV2 (* payload ); err != nil {
205+ if _ , err = c .engineAPI .NewPayloadV3 (* payload , blobHashes , & common. Hash {} ); err != nil {
191206 return err
192207 }
193208 c .setCurrentState (payload .BlockHash , finalizedHash )
0 commit comments