Skip to content

fix: retry getLogs with narrower range on max results exceeded#20

Merged
mattsse merged 2 commits intomainfrom
fix-get-logs-max-results-retry
Feb 4, 2026
Merged

fix: retry getLogs with narrower range on max results exceeded#20
mattsse merged 2 commits intomainfrom
fix-get-logs-max-results-retry

Conversation

@gakonst
Copy link
Contributor

@gakonst gakonst commented Feb 4, 2026

When an RPC returns an error like:

query exceeds max results 20000, retry with the range 24383075-24383096

The get_logs macro now automatically parses this error and retries with the suggested narrower block range.

Changes:

  • Added get_logs::get_logs_with_retry() helper that parses the error message and retries with the narrower range
  • Updated get_logs! macro to use this helper
  • Added unit tests for error parsing

Fixes the failing get_logs tests when block ranges contain too many logs.

cc @mattsse @U0A34UN92HW

gakonst and others added 2 commits February 4, 2026 12:48
When an RPC returns an error like:
  'query exceeds max results 20000, retry with the range 24383075-24383096'

The get_logs macro now automatically parses this error and retries with
the suggested narrower block range, preventing test failures for queries
that return too many logs.

Added get_logs::get_logs_with_retry() helper that:
- Attempts the initial get_logs request
- Parses 'max results exceeded' errors for suggested range
- Retries with the narrower filter if a range is found

Amp-Thread-ID: https://ampcode.com/threads/T-019c28af-3499-7740-96b5-091785eeb259
Co-authored-by: Amp <[email protected]>
@mattsse mattsse merged commit 65ab571 into main Feb 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants