Skip to content

Commit

Permalink
finish last block in batch based on block timing (#1248)
Browse files Browse the repository at this point in the history
  • Loading branch information
hexoscott committed Sep 30, 2024
1 parent da9810c commit 12ced6b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions zk/stages/stage_sequence_execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,14 @@ func SpawnSequencingStage(

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)
Expand Down Expand Up @@ -231,8 +238,8 @@ func SpawnSequencingStage(
}
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() {
Expand Down

0 comments on commit 12ced6b

Please sign in to comment.