Skip to content

Commit f91c999

Browse files
committed
fix batch proposer panic
1 parent d6674e8 commit f91c999

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

rollup/internal/controller/watcher/batch_proposer.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,13 @@ func (p *BatchProposer) proposeBatch() error {
331331
"maxUncompressedBatchBytesSize", p.maxUncompressedBatchBytesSize)
332332

333333
lastChunk := batch.Chunks[len(batch.Chunks)-1]
334-
batch.Blocks = batch.Blocks[:len(batch.Blocks)-len(lastChunk.Blocks)]
335334
batch.Chunks = batch.Chunks[:len(batch.Chunks)-1]
336335
batch.PostL1MessageQueueHash = common.HexToHash(dbChunks[i-1].PostL1MessageQueueHash)
337336

337+
if codec.Version() >= encoding.CodecV7 {
338+
batch.Blocks = batch.Blocks[:len(batch.Blocks)-len(lastChunk.Blocks)]
339+
}
340+
338341
metrics, err = utils.CalculateBatchMetrics(&batch, codec.Version())
339342
if err != nil {
340343
return fmt.Errorf("failed to calculate batch metrics: %w", err)

0 commit comments

Comments
 (0)