Skip to content

Commit

Permalink
fix init genesis bug
Browse files Browse the repository at this point in the history
  • Loading branch information
georgehao committed Jul 18, 2024
1 parent f19f00f commit aca5cba
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions rollup/internal/controller/relayer/l2_relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,15 @@ func NewLayer2Relayer(ctx context.Context, l2Client *ethclient.Client, db *gorm.
}

func (r *Layer2Relayer) initializeGenesis() error {
latestBatch, err := r.batchOrm.GetLatestBatch(r.ctx)
if err != nil {
return fmt.Errorf("failed to get latest batch: %v", err)
}
if latestBatch.Index > 274314 {
log.Info("genesis already imported")
return nil
}

lastBernoulliBatch, err := r.batchOrm.GetBatchByIndex(r.ctx, 274314 /* last bernoulli batch */)
if err != nil {
log.Error("Failed to fetch pending L2 batches", "err", err)
Expand Down

0 comments on commit aca5cba

Please sign in to comment.