From 53f0fcc64d68e22c01ab55bb6236a4f5a3a90499 Mon Sep 17 00:00:00 2001 From: Aman Sanghi Date: Fri, 18 Jul 2025 16:10:04 +0530 Subject: [PATCH] Call processAllAssertionsInRange with small batch filterOpts --- assertions/sync.go | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/assertions/sync.go b/assertions/sync.go index ee5c8b2696..da27f05640 100644 --- a/assertions/sync.go +++ b/assertions/sync.go @@ -85,7 +85,7 @@ func (m *Manager) syncAssertions(ctx context.Context) { return true, nil }) if err != nil { - log.Error("Could not check for assertion added event") + log.Error("Could not check for assertion added event", "err", err) return } } @@ -105,22 +105,28 @@ func (m *Manager) syncAssertions(ctx context.Context) { if fromBlock == toBlock { continue } - filterOpts := &bind.FilterOpts{ - Start: fromBlock, - End: &toBlock, - Context: ctx, - } - _, err = retry.UntilSucceeds(ctx, func() (bool, error) { - innerErr := m.processAllAssertionsInRange(ctx, filterer, filterOpts) - if innerErr != nil { - log.Error("Could not process assertions in range", "err", innerErr) - return false, innerErr + for startBlock := fromBlock; startBlock <= toBlock; startBlock = startBlock + m.maxGetLogBlocks { + endBlock := startBlock + m.maxGetLogBlocks + if endBlock > toBlock { + endBlock = toBlock + } + filterOpts := &bind.FilterOpts{ + Start: startBlock, + End: &endBlock, + Context: ctx, + } + _, err = retry.UntilSucceeds(ctx, func() (bool, error) { + innerErr := m.processAllAssertionsInRange(ctx, filterer, filterOpts) + if innerErr != nil { + log.Error("Could not process assertions in range", "err", innerErr) + return false, innerErr + } + return true, nil + }) + if err != nil { + log.Error("Could not check for assertion added event", "err", err) + return } - return true, nil - }) - if err != nil { - log.Error("Could not check for assertion added", "err", err) - return } fromBlock = toBlock case <-ctx.Done():