@@ -96,10 +96,10 @@ func (d *DACodecV7) NewDAChunk(chunk *Chunk, totalL1MessagePoppedBefore uint64)
9696 }
9797 // sanity check: L1 message indices are contiguous across blocks boundaries
9898 if numL1Messages > 0 {
99- if l1MessageIndex + uint64 (numL1Messages ) != highestQueueIndex {
100- return nil , fmt .Errorf ("failed to sanity check L1 messages count: l1MessageIndex + numL1Messages != highestQueueIndex: %d + %d != %d" , l1MessageIndex , numL1Messages , highestQueueIndex )
99+ if l1MessageIndex + uint64 (numL1Messages ) != highestQueueIndex + 1 {
100+ return nil , fmt .Errorf ("failed to sanity check L1 messages count after block %d : l1MessageIndex + numL1Messages != highestQueueIndex+1 : %d + %d != %d" , block . Header . Number . Uint64 (), l1MessageIndex , numL1Messages , highestQueueIndex + 1 )
101101 }
102- l1MessageIndex = highestQueueIndex
102+ l1MessageIndex += uint64 ( numL1Messages )
103103 }
104104
105105 daBlock := newDABlockV7 (block .Header .Number .Uint64 (), block .Header .Time , block .Header .BaseFee , block .Header .GasLimit , uint16 (len (block .Transactions )), numL1Messages )
@@ -375,7 +375,12 @@ func (d *DACodecV7) estimateL1CommitBatchSizeAndBlobSize(batch *Batch) (uint64,
375375
376376// EstimateChunkL1CommitBatchSizeAndBlobSize estimates the L1 commit batch size and blob size for a single chunk.
377377func (d * DACodecV7 ) EstimateChunkL1CommitBatchSizeAndBlobSize (chunk * Chunk ) (uint64 , uint64 , error ) {
378- return d .estimateL1CommitBatchSizeAndBlobSize (& Batch {Blocks : chunk .Blocks })
378+ return d .estimateL1CommitBatchSizeAndBlobSize (& Batch {
379+ Blocks : chunk .Blocks ,
380+ InitialL1MessageIndex : chunk .InitialL1MessageIndex ,
381+ InitialL1MessageQueueHash : chunk .InitialL1MessageQueueHash ,
382+ LastL1MessageQueueHash : chunk .LastL1MessageQueueHash ,
383+ })
379384}
380385
381386// EstimateBatchL1CommitBatchSizeAndBlobSize estimates the L1 commit batch size and blob size for a batch.
0 commit comments