Skip to content

Commit

Permalink
feat(forkid): wait for finalised on l1 closes #849 (#974)
Browse files Browse the repository at this point in the history
  • Loading branch information
revitteth authored and Stefan-Ethernal committed Sep 20, 2024
1 parent 75ea8e7 commit 2cb287e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions zk/stages/stage_sequence_execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ func SpawnSequencingStage(
return err
}

// stage loop should continue until we get the forkid from the L1 in a finalised block
if forkId == 0 {
log.Warn(fmt.Sprintf("[%s] ForkId is 0. Waiting for L1 to finalise a block...", logPrefix))
time.Sleep(10 * time.Second)
return nil
}

var block *types.Block
runLoopBlocks := true
batchContext := newBatchContext(ctx, &cfg, &historyCfg, s, sdb)
Expand Down
3 changes: 2 additions & 1 deletion zk/stages/stage_sequence_execute_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ func prepareForkId(lastBatch, executionAt uint64, hermezDb forkDb) (uint64, erro
}

if latest == 0 {
return 0, fmt.Errorf("could not find a suitable fork for batch %v, cannot start sequencer, check contract configuration", lastBatch+1)
// not an error, need to wait for the block to finalize on the L1
return 0, nil
}

// now we need to check the last batch to see if we need to update the fork id
Expand Down

0 comments on commit 2cb287e

Please sign in to comment.