@@ -80,7 +80,7 @@ func (d *DACodecV4) NewDABatch(batch *Batch) (DABatch, error) {
8080 }
8181
8282 // blob payload
83- blob , blobVersionedHash , z , blobBytes , err := d .constructBlobPayload (batch .Chunks , d .MaxNumChunksPerBatch (), enableCompression )
83+ blob , blobVersionedHash , z , blobBytes , challengeDigest , err := d .constructBlobPayload (batch .Chunks , d .MaxNumChunksPerBatch (), enableCompression )
8484 if err != nil {
8585 return nil , err
8686 }
@@ -106,6 +106,7 @@ func (d *DACodecV4) NewDABatch(batch *Batch) (DABatch, error) {
106106 blob , // blob
107107 z , // z
108108 blobBytes , // blobBytes
109+ challengeDigest , // challengeDigest
109110 )
110111}
111112
@@ -129,10 +130,11 @@ func (d *DACodecV4) NewDABatchFromBytes(data []byte) (DABatch, error) {
129130 common .BytesToHash (data [daBatchOffsetDataHash :daBatchV3OffsetBlobVersionedHash ]), // dataHash
130131 common .BytesToHash (data [daBatchV3OffsetParentBatchHash :daBatchV3OffsetLastBlockTimestamp ]), // parentBatchHash
131132 common .BytesToHash (data [daBatchV3OffsetBlobVersionedHash :daBatchV3OffsetParentBatchHash ]), // blobVersionedHash
132- nil , // skippedL1MessageBitmap
133- nil , // blob
134- nil , // z
135- nil , // blobBytes
133+ nil , // skippedL1MessageBitmap
134+ nil , // blob
135+ nil , // z
136+ nil , // blobBytes
137+ common.Hash {}, // challengeDigest
136138 [2 ]common.Hash { // blobDataProof
137139 common .BytesToHash (data [daBatchV3OffsetBlobDataProof : daBatchV3OffsetBlobDataProof + kzgPointByteSize ]),
138140 common .BytesToHash (data [daBatchV3OffsetBlobDataProof + kzgPointByteSize : daBatchV3EncodedLength ]),
@@ -141,7 +143,7 @@ func (d *DACodecV4) NewDABatchFromBytes(data []byte) (DABatch, error) {
141143}
142144
143145// constructBlobPayload constructs the 4844 blob payload.
144- func (d * DACodecV4 ) constructBlobPayload (chunks []* Chunk , maxNumChunksPerBatch int , enableCompression bool ) (* kzg4844.Blob , common.Hash , * kzg4844.Point , []byte , error ) {
146+ func (d * DACodecV4 ) constructBlobPayload (chunks []* Chunk , maxNumChunksPerBatch int , enableCompression bool ) (* kzg4844.Blob , common.Hash , * kzg4844.Point , []byte , common. Hash , error ) {
145147 // metadata consists of num_chunks (2 bytes) and chunki_size (4 bytes per chunk)
146148 metadataLength := 2 + maxNumChunksPerBatch * 4
147149
@@ -172,7 +174,7 @@ func (d *DACodecV4) constructBlobPayload(chunks []*Chunk, maxNumChunksPerBatch i
172174 // encode L2 txs into blob payload
173175 rlpTxData , err := convertTxDataToRLPEncoding (tx )
174176 if err != nil {
175- return nil , common.Hash {}, nil , nil , fmt .Errorf ("failed to convert txData to RLP encoding: %w" , err )
177+ return nil , common.Hash {}, nil , nil , common. Hash {}, fmt .Errorf ("failed to convert txData to RLP encoding: %w" , err )
176178 }
177179 batchBytes = append (batchBytes , rlpTxData ... )
178180 }
@@ -205,12 +207,12 @@ func (d *DACodecV4) constructBlobPayload(chunks []*Chunk, maxNumChunksPerBatch i
205207 var err error
206208 blobBytes , err = zstd .CompressScrollBatchBytes (batchBytes )
207209 if err != nil {
208- return nil , common.Hash {}, nil , nil , err
210+ return nil , common.Hash {}, nil , nil , common. Hash {}, err
209211 }
210212 // Check compressed data compatibility.
211213 if err = checkCompressedDataCompatibility (blobBytes ); err != nil {
212214 log .Error ("ConstructBlobPayload: compressed data compatibility check failed" , "err" , err , "batchBytes" , hex .EncodeToString (batchBytes ), "blobBytes" , hex .EncodeToString (blobBytes ))
213- return nil , common.Hash {}, nil , nil , err
215+ return nil , common.Hash {}, nil , nil , common. Hash {}, err
214216 }
215217 blobBytes = append ([]byte {1 }, blobBytes ... )
216218 } else {
@@ -219,19 +221,19 @@ func (d *DACodecV4) constructBlobPayload(chunks []*Chunk, maxNumChunksPerBatch i
219221
220222 if len (blobBytes ) > maxEffectiveBlobBytes {
221223 log .Error ("ConstructBlobPayload: Blob payload exceeds maximum size" , "size" , len (blobBytes ), "blobBytes" , hex .EncodeToString (blobBytes ))
222- return nil , common.Hash {}, nil , nil , errors .New ("Blob payload exceeds maximum size" )
224+ return nil , common.Hash {}, nil , nil , common. Hash {}, errors .New ("Blob payload exceeds maximum size" )
223225 }
224226
225227 // convert raw data to BLSFieldElements
226228 blob , err := makeBlobCanonical (blobBytes )
227229 if err != nil {
228- return nil , common.Hash {}, nil , nil , fmt .Errorf ("failed to convert blobBytes to canonical form: %w" , err )
230+ return nil , common.Hash {}, nil , nil , common. Hash {}, fmt .Errorf ("failed to convert blobBytes to canonical form: %w" , err )
229231 }
230232
231233 // compute blob versioned hash
232234 c , err := kzg4844 .BlobToCommitment (blob )
233235 if err != nil {
234- return nil , common.Hash {}, nil , nil , fmt .Errorf ("failed to create blob commitment: %w" , err )
236+ return nil , common.Hash {}, nil , nil , common. Hash {}, fmt .Errorf ("failed to create blob commitment: %w" , err )
235237 }
236238 blobVersionedHash := kzg4844 .CalcBlobHashV1 (sha256 .New (), & c )
237239
@@ -246,12 +248,12 @@ func (d *DACodecV4) constructBlobPayload(chunks []*Chunk, maxNumChunksPerBatch i
246248 // the challenge point z
247249 var z kzg4844.Point
248250 if len (pointBytes ) > kzgPointByteSize {
249- return nil , common.Hash {}, nil , nil , fmt .Errorf ("pointBytes length exceeds %d bytes, got %d bytes" , kzgPointByteSize , len (pointBytes ))
251+ return nil , common.Hash {}, nil , nil , common. Hash {}, fmt .Errorf ("pointBytes length exceeds %d bytes, got %d bytes" , kzgPointByteSize , len (pointBytes ))
250252 }
251253 start := kzgPointByteSize - len (pointBytes )
252254 copy (z [start :], pointBytes )
253255
254- return blob , blobVersionedHash , & z , blobBytes , nil
256+ return blob , blobVersionedHash , & z , blobBytes , challengeDigest , nil
255257}
256258
257259func (d * DACodecV4 ) estimateL1CommitBatchSizeAndBlobSize (chunks []* Chunk ) (uint64 , uint64 , error ) {
0 commit comments