From 0dba52dcd4799d3fa5a33af8aac8e3d013db7bf8 Mon Sep 17 00:00:00 2001 From: Sergi Rene Date: Mon, 12 Aug 2024 18:17:27 +0200 Subject: [PATCH] fix(manager): full-node syncing fix (#1013) --- block/manager.go | 14 +++++++------- go.mod | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/block/manager.go b/block/manager.go index b1c6239a9..28f3681bd 100644 --- a/block/manager.go +++ b/block/manager.go @@ -146,9 +146,10 @@ func (m *Manager) Start(ctx context.Context) error { } } - eg, ctx := errgroup.WithContext(ctx) - if isSequencer { + + eg, ctx := errgroup.WithContext(ctx) + // Sequencer must wait till DA is synced to start submitting blobs <-m.DAClient.Synced() nBytes := m.GetUnsubmittedBytes() @@ -164,6 +165,10 @@ func (m *Manager) Start(ctx context.Context) error { bytesProducedC <- nBytes return m.ProduceBlockLoop(ctx, bytesProducedC) }) + go func() { + _ = eg.Wait() // errors are already logged + m.logger.Info("Block manager err group finished.") + }() } else { // Full-nodes can sync from DA but it is not necessary to wait for it, since it can sync from P2P as well in parallel. @@ -181,11 +186,6 @@ func (m *Manager) Start(ctx context.Context) error { go uevent.MustSubscribe(ctx, m.Pubsub, "applyBlockSyncBlocksLoop", p2p.EventQueryNewBlockSyncBlock, m.onReceivedBlock, m.logger) } - go func() { - _ = eg.Wait() // errors are already logged - m.logger.Info("Block manager err group finished.") - }() - return nil } diff --git a/go.mod b/go.mod index 0976f51e9..a8021c193 100644 --- a/go.mod +++ b/go.mod @@ -288,7 +288,7 @@ require ( github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f // indirect go.uber.org/mock v0.4.0 // indirect golang.org/x/tools v0.18.0 // indirect - pgregory.net/rapid v1.1.0 // indirect + pgregory.net/rapid v1.1.0 ) replace (