split block ranges when there's too many proofs returned#95
Merged
Conversation
illuzen
approved these changes
Apr 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix for this:
❌ Error: Error: Error: GraphQL errors: Query returned 2103 results, which exceeds the limit of 1000. Please use longer hash prefixes for more specific queries.
Summary of changes:
src/subsquid/client.rs— addedSubsquidClient::query_all_transfers_by_prefix. It seeds the range frombase_params.after_block/before_block(defaulting to0andu32::MAX), calls the existingquery_transfers_by_prefixper sub-range withlimit=1000, and when the server responds with the "exceeds the limit" error it binary-splits at the midpoint and retries via an explicitVecstack (no async recursion boxing). Any other error propagates immediately. If a single block legitimately has >1000 matches it fails loudly rather than looping.src/collect_rewards_lib.rs— swapped the three call sites (collect_rewards,query_pending_transfers,query_pending_transfers_for_address) to use the paginating method. Removed the now-irrelevantwith_limit(1000)parameters. Privacy prefix stays at 8 hex chars; SDK function signatures unchanged.Test — added
test_server_limit_error_markerguarding the"exceeds the limit"substring the paginator pattern-matches on, so future server wording changes break a test instead of silently breaking production.cargo buildand all subsquid/collect_rewards unit tests pass.Regarding your follow-up question on scale: after this fix there's no architectural cap on transfers per
collect_rewardscall. The true per-transaction cap remains 16 proofs (num_leaf_proofs); 1000s of transfers are submitted asceil(N/16)unsigned extrinsics back-to-back. The bottleneck becomes serial proof generation time and in-memory buffering of all proof bytes, not the indexer or the chain.