Skip to content

fix: separate account fetching from loop to avoid rate limiting#542

Merged
MicaiahReid merged 1 commit intosolana-foundation:mainfrom
0xzrf:rate_limit_resistent_account_fetch
Mar 5, 2026
Merged

fix: separate account fetching from loop to avoid rate limiting#542
MicaiahReid merged 1 commit intosolana-foundation:mainfrom
0xzrf:rate_limit_resistent_account_fetch

Conversation

@0xzrf
Copy link
Copy Markdown
Contributor

@0xzrf 0xzrf commented Feb 27, 2026

Summary

This PR refactors SurfnetRemoteClient::get_multiple_accounts() to batch RPC account fetches rather than issuing individual calls inside a loop. Instead of calling self.get_account_with_commitment() repeatedly per iteration, a single self.get_multiple_accounts_with_confirmation() call is made upfront and the results are processed afterwards.

What Changed

  • Replaced repeated self.get_account_with_commitment() calls inside a loop with a single batched self.get_multiple_accounts_with_confirmation() call
  • Reduced the number of RPC round-trips, lowering the risk of hitting rate limits under high load or large snapshot files

Context

This change was motivated by an existing comment inside SurfnetRemoteClient::get_multiple_accounts() that flagged the per-iteration RPC pattern as a potential rate-limiting concern. No new functionality is introduced — this is a pure refactor aimed at improving resilience when processing large snapshot files.

@MicaiahReid MicaiahReid changed the title Seperates account fetching from loop to avoid rate limiting fix: separate account fetching from loop to avoid rate limiting Feb 27, 2026
Copy link
Copy Markdown
Collaborator

@MicaiahReid MicaiahReid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff, thank you @0xzrf!

@MicaiahReid MicaiahReid requested a review from lgalabru March 3, 2026 16:16
@MicaiahReid MicaiahReid merged commit 66ed356 into solana-foundation:main Mar 5, 2026
5 checks passed
@0xzrf 0xzrf deleted the rate_limit_resistent_account_fetch branch April 10, 2026 10:09
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.

2 participants