@@ -154,7 +154,8 @@ func (p *BatchProposer) proposeBatchChunks() ([]*orm.Chunk, *types.BatchMeta, er
154
154
return nil , nil , err
155
155
}
156
156
157
- dbChunks , err := p .chunkOrm .GetChunksGEIndex (p .ctx , unbatchedChunkIndex , int (p .maxChunkNumPerBatch )+ 1 )
157
+ // select at most p.maxChunkNumPerBatch chunks
158
+ dbChunks , err := p .chunkOrm .GetChunksGEIndex (p .ctx , unbatchedChunkIndex , int (p .maxChunkNumPerBatch ))
158
159
if err != nil {
159
160
return nil , nil , err
160
161
}
@@ -207,8 +208,7 @@ func (p *BatchProposer) proposeBatchChunks() ([]*orm.Chunk, *types.BatchMeta, er
207
208
totalL1CommitGas += types .CalldataNonZeroByteGas * (32 * (totalL1MessagePopped + 255 ) / 256 )
208
209
totalL1CommitGas += types .GetKeccak256Gas (89 + 32 * (totalL1MessagePopped + 255 )/ 256 )
209
210
totalOverEstimateL1CommitGas := uint64 (p .gasCostIncreaseMultiplier * float64 (totalL1CommitGas ))
210
- if totalChunks > p .maxChunkNumPerBatch ||
211
- totalL1CommitCalldataSize > p .maxL1CommitCalldataSizePerBatch ||
211
+ if totalL1CommitCalldataSize > p .maxL1CommitCalldataSizePerBatch ||
212
212
totalOverEstimateL1CommitGas > p .maxL1CommitGasPerBatch {
213
213
// Check if the first chunk breaks hard limits.
214
214
// If so, it indicates there are bugs in chunk-proposer, manual fix is needed.
@@ -234,8 +234,6 @@ func (p *BatchProposer) proposeBatchChunks() ([]*orm.Chunk, *types.BatchMeta, er
234
234
}
235
235
236
236
log .Debug ("breaking limit condition in batching" ,
237
- "currentTotalChunks" , totalChunks ,
238
- "maxChunkNumPerBatch" , p .maxChunkNumPerBatch ,
239
237
"currentL1CommitCalldataSize" , totalL1CommitCalldataSize ,
240
238
"maxL1CommitCalldataSizePerBatch" , p .maxL1CommitCalldataSizePerBatch ,
241
239
"currentOverEstimateL1CommitGas" , totalOverEstimateL1CommitGas ,
@@ -249,12 +247,20 @@ func (p *BatchProposer) proposeBatchChunks() ([]*orm.Chunk, *types.BatchMeta, er
249
247
}
250
248
251
249
currentTimeSec := uint64 (time .Now ().Unix ())
252
- if dbChunks [0 ].StartBlockTime + p .batchTimeoutSec < currentTimeSec {
253
- log .Warn ("first block timeout" ,
254
- "start block number" , dbChunks [0 ].StartBlockNumber ,
255
- "first block timestamp" , dbChunks [0 ].StartBlockTime ,
256
- "chunk outdated time threshold" , currentTimeSec ,
257
- )
250
+ if dbChunks [0 ].StartBlockTime + p .batchTimeoutSec < currentTimeSec ||
251
+ totalChunks == p .maxChunkNumPerBatch {
252
+ if dbChunks [0 ].StartBlockTime + p .batchTimeoutSec < currentTimeSec {
253
+ log .Warn ("first block timeout" ,
254
+ "start block number" , dbChunks [0 ].StartBlockNumber ,
255
+ "start block timestamp" , dbChunks [0 ].StartBlockTime ,
256
+ "current time" , currentTimeSec ,
257
+ )
258
+ } else {
259
+ log .Info ("reached maximum number of chunks in batch" ,
260
+ "chunk count" , totalChunks ,
261
+ )
262
+ }
263
+
258
264
batchMeta .TotalL1CommitGas = totalL1CommitGas
259
265
batchMeta .TotalL1CommitCalldataSize = totalL1CommitCalldataSize
260
266
p .batchFirstBlockTimeoutReached .Inc ()
0 commit comments