fix: paginate Helius stake account requests - #283
Conversation
|
Hi @galvanizze, could you please review this change? GitHub does not allow the PR author to submit a formal review request without upstream write permission. |
| params=[self.STAKE_PROGRAM_ID, config], | ||
| ) | ||
|
|
||
| config['limit'] = self.api_options.max_items_per_page |
There was a problem hiding this comment.
recheck this setting for helius
There was a problem hiding this comment.
Checked against the current Helius contract: limits from 1 to 10,000 are supported, with 1,000–5,000 recommended for most use cases. I changed this to a Helius-specific page size of 5,000. A live authority with 4,093 stake accounts returned the same accounts and aggregate balances with limits 1,000, 5,000, and 10,000. The 5,000 limit reduced traversal from five requests to one, while 10,000 provided no meaningful benefit.
galvanizze
left a comment
There was a problem hiding this comment.
test on some addresses, with lots of balances/nfts, to check whether paginating works ok
|
Tested the complete balance flow with |
9c03905 to
b1d5a22
Compare
|
Update after narrowing the hotfix scope: this branch no longer implements retries. If a later Helius V2 page fails, the whole fetch fails without returning partial data. Timeout/retry handling is deferred to a follow-up. |
📝 Summary
Use paginated Helius stake-account queries while preserving legacy
getProgramAccountsbehavior for non-Helius Solana RPC providers.🔍 Review
Recommendation: 🟡 Focused review — the change is localized, but stake balances depend on complete cursor traversal.
blockapi/v2/api/solana.py:_fetch_staked_sol— continue through empty filtered pages untilpaginationKeyisnulland preserve the flat internal result contract.🔗 Compatibility
Helius RPC hosts use
getProgramAccountsV2; other Solana RPC providers retaingetProgramAccounts. Existing parsers still receiveresultas a flat account list.✅ Verification
Confidence: 🟢 Fully verified — focused and full unit suites pass, and both production Helius and the default Solana RPC paths were exercised live.