Skip to content

fix: batch getLogs in upgradeExecutorFetchPrivilegedAccounts - #745

Open
gomesalexandre wants to merge 1 commit into
OffchainLabs:mainfrom
gomesalexandre:fix_upgradeexecutor_getlogs_batching
Open

fix: batch getLogs in upgradeExecutorFetchPrivilegedAccounts#745
gomesalexandre wants to merge 1 commit into
OffchainLabs:mainfrom
gomesalexandre:fix_upgradeexecutor_getlogs_batching

Conversation

@gomesalexandre

Copy link
Copy Markdown

closes #642

what

upgradeExecutorFetchPrivilegedAccounts fetched the RoleGranted and RoleRevoked events with a single getLogs({ fromBlock: 0n, toBlock: 'latest' }) per event. Most RPC providers cap eth_getLogs to a bounded block range, so this fails with "query range is too big" on nearly every endpoint (including https://sepolia-rollup.arbitrum.io/rpc), making the function unusable there.

how

Use getLogsWithBatching, the helper the other fetchers already use (getBatchPosters, getValidators, getKeysets, createRollupFetchCoreContracts). It attempts the full range first and, on failure, falls back to fixed-size (9,999-block) batches from the latest block down to the rollup-creator deployment block, so it works against range-limited RPCs while staying fast on permissive ones.

tests

Added a unit test that mocks the RPC to reject the full-range query and asserts the function batches (rather than throwing) and returns the correct privileged account. It fails against the previous implementation.

  • test:unit (vitest) passes, tsc, eslint, prettier --check clean.

`upgradeExecutorFetchPrivilegedAccounts` queried the RoleGranted and
RoleRevoked events with a single `fromBlock: 0n, toBlock: 'latest'`
call. Most RPC providers cap `eth_getLogs` to a bounded block range, so
this fails with "query range is too big" on nearly every endpoint,
including https://sepolia-rollup.arbitrum.io/rpc.

Use `getLogsWithBatching`, the same helper the other fetchers
(getBatchPosters, getValidators, getKeysets, ...) already use: it tries
the full range first and falls back to fixed-size batches on failure, so
it works against range-limited RPCs.

closes OffchainLabs#642
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.

Make upgradeExecutorFetchPrivilegedAccounts more flexible

1 participant