Skip to content

Commit

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

// stage loop should continue until we get the forkid from the L1 in a finalised block
if forkId == 0 {
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 2a6e261

Please sign in to comment.