@@ -96,7 +96,7 @@ func (b *BlobUploader) UploadBlobToS3() {
9696 if err != nil {
9797 log .Error ("failed to calculate versioned blob hash" , "batch index" , dbBatch .Index , "err" , err )
9898 b .metrics .rollupBlobUploaderUploadToS3FailedTotal .Inc ()
99- // Update status to failed
99+ // update status to failed
100100 if updateErr := b .blobUploadOrm .InsertOrUpdateBlobUpload (b .ctx , dbBatch .Index , types .BlobStoragePlatformS3 , types .BlobUploadStatusFailed ); updateErr != nil {
101101 log .Error ("failed to update blob upload status to failed" , "batch index" , dbBatch .Index , "err" , updateErr )
102102 }
@@ -109,14 +109,14 @@ func (b *BlobUploader) UploadBlobToS3() {
109109 if err != nil {
110110 log .Error ("failed to upload blob data to AWS S3" , "batch index" , dbBatch .Index , "versioned blob hash" , key , "err" , err )
111111 b .metrics .rollupBlobUploaderUploadToS3FailedTotal .Inc ()
112- // Update status to failed
113- if err = b .blobUploadOrm .InsertOrUpdateBlobUpload (b .ctx , dbBatch .Index , types .BlobStoragePlatformS3 , types .BlobUploadStatusFailed ); err != nil {
114- log .Error ("failed to update blob upload status to failed" , "batch index" , dbBatch .Index , "err" , err )
112+ // update status to failed
113+ if updateErr : = b .blobUploadOrm .InsertOrUpdateBlobUpload (b .ctx , dbBatch .Index , types .BlobStoragePlatformS3 , types .BlobUploadStatusFailed ); updateErr != nil {
114+ log .Error ("failed to update blob upload status to failed" , "batch index" , dbBatch .Index , "err" , updateErr )
115115 }
116116 return
117117 }
118118
119- // Update status to uploaded
119+ // update status to uploaded
120120 if err = b .blobUploadOrm .InsertOrUpdateBlobUpload (b .ctx , dbBatch .Index , types .BlobStoragePlatformS3 , types .BlobUploadStatusUploaded ); err != nil {
121121 log .Error ("failed to update blob upload status to uploaded" , "batch index" , dbBatch .Index , "err" , err )
122122 b .metrics .rollupBlobUploaderUploadToS3FailedTotal .Inc ()
@@ -143,12 +143,14 @@ func (b *BlobUploader) constructBlobCodec(dbBatch *orm.Batch) (*kzg4844.Blob, er
143143 }
144144
145145 chunks := make ([]* encoding.Chunk , len (dbChunks ))
146+ var allBlocks []* encoding.Block // collect blocks for CodecV7
146147 for i , c := range dbChunks {
147148 blocks , getErr := b .l2BlockOrm .GetL2BlocksInRange (b .ctx , c .StartBlockNumber , c .EndBlockNumber )
148149 if getErr != nil {
149150 return nil , fmt .Errorf ("failed to get blocks in range for batch %d: %w" , dbBatch .Index , getErr )
150151 }
151152 chunks [i ] = & encoding.Chunk {Blocks : blocks }
153+ allBlocks = append (allBlocks , blocks ... )
152154 }
153155
154156 var encodingBatch * encoding.Batch
@@ -165,23 +167,13 @@ func (b *BlobUploader) constructBlobCodec(dbBatch *orm.Batch) (*kzg4844.Blob, er
165167 }
166168
167169 case encoding .CodecV7 :
168- var batchBlocks []* encoding.Block
169- for _ , dbChunk := range dbChunks {
170- blocks , err := b .l2BlockOrm .GetL2BlocksInRange (b .ctx , dbChunk .StartBlockNumber , dbChunk .EndBlockNumber )
171- if err != nil {
172- return nil , fmt .Errorf ("failed to get blocks in range for batch %d: %w" , dbBatch .Index , err )
173- }
174-
175- batchBlocks = append (batchBlocks , blocks ... )
176- }
177-
178170 encodingBatch = & encoding.Batch {
179171 Index : dbBatch .Index ,
180172 ParentBatchHash : common .HexToHash (dbBatch .ParentBatchHash ),
181173 Chunks : chunks ,
182174 PrevL1MessageQueueHash : common .HexToHash (dbBatch .PrevL1MessageQueueHash ),
183175 PostL1MessageQueueHash : common .HexToHash (dbBatch .PostL1MessageQueueHash ),
184- Blocks : batchBlocks ,
176+ Blocks : allBlocks ,
185177 }
186178 default :
187179 return nil , fmt .Errorf ("unsupported codec version, batch index: %d, batch codec version: %d" , dbBatch .Index , codecVersion )
0 commit comments