From 5e86a2c69802d5316fd747b9430c7d9f8b1b01b7 Mon Sep 17 00:00:00 2001 From: Scott Fairclough Date: Mon, 30 Sep 2024 14:30:03 +0100 Subject: [PATCH] finish last block in batch based on block timing --- zk/stages/stage_sequence_execute.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/zk/stages/stage_sequence_execute.go b/zk/stages/stage_sequence_execute.go index 221c479ce73..1c3a958a8de 100644 --- a/zk/stages/stage_sequence_execute.go +++ b/zk/stages/stage_sequence_execute.go @@ -229,7 +229,14 @@ func sequencingBatchStep( log.Info(fmt.Sprintf("[%s] Starting batch %d...", logPrefix, batchState.batchNumber)) + // once the batch ticker has ticked we need a signal to close the batch after the next block is done + batchTimedOut := false + for blockNumber := executionAt + 1; runLoopBlocks; blockNumber++ { + if batchTimedOut { + log.Debug(fmt.Sprintf("[%s] Closing batch due to timeout", logPrefix)) + break + } log.Info(fmt.Sprintf("[%s] Starting block %d (forkid %v)...", logPrefix, blockNumber, batchState.forkId)) logTicker.Reset(10 * time.Second) blockTicker.Reset(cfg.zk.SequencerBlockSealTime) @@ -314,8 +321,8 @@ func sequencingBatchStep( } case <-batchTicker.C: if !batchState.isAnyRecovery() { - runLoopBlocks = false - break LOOP_TRANSACTIONS + log.Debug(fmt.Sprintf("[%s] Batch timeout reached", logPrefix)) + batchTimedOut = true } default: if batchState.isLimboRecovery() {