Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(forkid): wait for finalised on l1 closes #849 #974

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading