Skip to content

Commit

Permalink
moved retieve loop to after sync block manager + log
Browse files Browse the repository at this point in the history
  • Loading branch information
srene committed May 16, 2024
1 parent 43bc9f3 commit 0b24dd7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions block/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,6 @@ func (m *Manager) Start(ctx context.Context) error {
// Fullnode loop can start before syncing from DA
if !isSequencer {
go uevent.MustSubscribe(ctx, m.Pubsub, "applyGossipedBlocksLoop", p2p.EventQueryNewNewGossipedBlock, m.onNewGossipedBlock, m.logger)
go m.RetrieveLoop(ctx)
go m.SyncTargetLoop(ctx)
}

// TODO: populate the accumulatedSize on startup
Expand All @@ -159,10 +157,13 @@ func (m *Manager) Start(ctx context.Context) error {
return fmt.Errorf("sync block manager: %w", err)
}

// Aggregator producer loop is started only when finished syncing from DA
// Sequencer producer loop and full-node retrieve loop is started only when finished syncing from DA
if isSequencer {
go m.ProduceBlockLoop(ctx)
go m.SubmitLoop(ctx)
} else {
go m.RetrieveLoop(ctx)
go m.SyncTargetLoop(ctx)
}
return nil
}
Expand Down
1 change: 1 addition & 0 deletions block/retriever.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func (m *Manager) RetrieveLoop(ctx context.Context) {
// the actual blocks from the DA.
func (m *Manager) syncUntilTarget(targetHeight uint64) error {
for currH := m.State.Height(); currH < targetHeight; currH = m.State.Height() {
m.logger.Info("Syncing from DA", "store height", currH, "target height", targetHeight)

// It's important that we query the state index before fetching the batch, rather
// than e.g. keep it and increment it, because we might be concurrently applying blocks
Expand Down

0 comments on commit 0b24dd7

Please sign in to comment.