From f3e69a36dc878786083531c10c5c8c9681c9ad11 Mon Sep 17 00:00:00 2001 From: Daniel T <30197399+danwt@users.noreply.github.com> Date: Mon, 12 Aug 2024 16:55:17 +0100 Subject: [PATCH 1/2] fix(submit loop): correctly load commit on startup (#1011) --- block/submit.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/submit.go b/block/submit.go index 138550797..d55423f6c 100644 --- a/block/submit.go +++ b/block/submit.go @@ -53,7 +53,7 @@ func SubmitLoopInner( eg.Go(func() error { // 'trigger': we need one thread to continuously consume the bytes produced channel, and to monitor timer - ticker := time.NewTicker(maxBatchTime) + ticker := time.NewTicker(maxBatchTime / 10) // interval does not need to match max batch time since the other thread keeps track of the actual time defer ticker.Stop() for { if maxBatchSkew*maxBatchBytes < pendingBytes.Load() { @@ -240,7 +240,7 @@ func (m *Manager) GetUnsubmittedBytes() int { } break } - commit, err := m.Store.LoadBlock(h) + commit, err := m.Store.LoadCommit(h) if err != nil { if !errors.Is(err, gerrc.ErrNotFound) { m.logger.Error("Get unsubmitted bytes load commit.", "err", err) From fab177aa5d208cf24d0d097921c4601d895fa205 Mon Sep 17 00:00:00 2001 From: Sergi Rene Date: Mon, 12 Aug 2024 18:17:27 +0200 Subject: [PATCH 2/2] 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 (