@@ -18,6 +18,7 @@ package catalyst
18
18
19
19
import (
20
20
"crypto/rand"
21
+ "crypto/sha256"
21
22
"errors"
22
23
"math/big"
23
24
"sync"
@@ -27,6 +28,7 @@ import (
27
28
"github.com/ethereum/go-ethereum/common"
28
29
"github.com/ethereum/go-ethereum/core/txpool"
29
30
"github.com/ethereum/go-ethereum/core/types"
31
+ "github.com/ethereum/go-ethereum/crypto/kzg4844"
30
32
"github.com/ethereum/go-ethereum/eth"
31
33
"github.com/ethereum/go-ethereum/log"
32
34
"github.com/ethereum/go-ethereum/node"
@@ -161,14 +163,14 @@ func (c *SimulatedBeacon) sealBlock(withdrawals []*types.Withdrawal, timestamp u
161
163
SuggestedFeeRecipient : feeRecipient ,
162
164
Withdrawals : withdrawals ,
163
165
Random : random ,
164
- }, engine .PayloadV2 , true )
166
+ BeaconRoot : & common.Hash {},
167
+ }, engine .PayloadV3 , true )
165
168
if err != nil {
166
169
return err
167
170
}
168
171
if fcResponse == engine .STATUS_SYNCING {
169
172
return errors .New ("chain rewind prevented invocation of payload creation" )
170
173
}
171
-
172
174
envelope , err := c .engineAPI .getPayload (* fcResponse .PayloadID , true )
173
175
if err != nil {
174
176
return err
@@ -186,8 +188,21 @@ func (c *SimulatedBeacon) sealBlock(withdrawals []*types.Withdrawal, timestamp u
186
188
}
187
189
}
188
190
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
+ }
189
204
// 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 {
191
206
return err
192
207
}
193
208
c .setCurrentState (payload .BlockHash , finalizedHash )
0 commit comments