Skip to content

feat: configurable max block range for EventFetcher chunking#630

Open
gzeoneth wants to merge 11 commits intomainfrom
feat/configurable-event-fetcher-chunking
Open

feat: configurable max block range for EventFetcher chunking#630
gzeoneth wants to merge 11 commits intomainfrom
feat/configurable-event-fetcher-chunking

Conversation

@gzeoneth
Copy link
Copy Markdown
Member

@gzeoneth gzeoneth commented Mar 24, 2026

Summary

  • EventFetcher now auto-chunks log queries on RPC failure with exponential backoff (retry with halved chunk size down to 500 blocks)
  • EventFetcher.setMaxBlockRange(n) lets callers configure the initial chunk size globally (defaults to 10,000)
  • DEFAULT_MAX_BLOCK_RANGE exported for reference

Usage

import { EventFetcher } from '@arbitrum/sdk'

// Set once at app startup — applies to all EventFetcher instances
EventFetcher.setMaxBlockRange(5000)

Test plan

  • Existing chunking tests pass (fallback, negative blocks, retry with smaller chunks, min chunk error)
  • New test: setMaxBlockRange produces correct chunk boundaries (2000-block chunks)
  • Static setter resets cleanly between tests

EventFetcher now accepts an optional `maxBlockRange` parameter.
When set, queries spanning more than `maxBlockRange` blocks are
automatically split into sequential chunks. This allows callers
using RPC providers with block range limits (e.g. free-tier nodes
capped at 10,000 blocks) to work without errors.

ChildToParentMessageReaderNitro exposes a `setMaxBlockRange()`
method that propagates to all internal EventFetcher instances
used for parent chain queries (getSendProps, getBlockFromAssertionId,
getFirstExecutableBlock).

Usage:
```ts
const message = ChildToParentMessageReader.fromEvent(provider, event);
message.setMaxBlockRange(1000); // chunk L1 queries to 1000 blocks
const status = await message.status(childProvider);
```
@cla-bot cla-bot Bot added the cla-signed label Mar 24, 2026
@gzeoneth gzeoneth marked this pull request as draft March 24, 2026 20:01
@douglance douglance marked this pull request as ready for review March 27, 2026 14:10
@douglance douglance changed the title feat: add configurable block range chunking to EventFetcher feat: auto-chunk EventFetcher queries on RPC failure Mar 27, 2026
…nge()

Expose a static setter so callers can configure the chunk size globally
without threading a parameter through every EventFetcher instantiation.
@douglance douglance changed the title feat: auto-chunk EventFetcher queries on RPC failure feat: configurable max block range for EventFetcher chunking Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants