PE-9131: Minimize Solana RPC usage in sync and gateway registry - #2165
vilenarios wants to merge 4 commits into
Conversation
- every sync (auto-sync every ~5 minutes, tab-focus restarts, manual syncs) forced a full ArNS sweep on Solana via getAntRecordsForWallet(update: true), bypassing the repository's 15-minute cache; each sweep makes several RPC calls per owned name - ArDrive currently has no ArNS integration, so the sweep and the post-sync saveAllFilesWithAssignedNames pass were pure RPC cost with no user-facing effect; both are removed along with the ARNSRepository dependency on SyncRepository - ArNS lookups elsewhere (upload flows, profile name) are untouched and fetch on demand; sync-time integration can be reintroduced later if the feature returns Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- the AR.IO gateway list was fetched from Solana RPC once per app session (data-fetch fallback, snapshot validation) and on every open of the gateway settings modal; the registry rarely changes, so this was recurring RPC cost for static data - DataGatewayFallback now persists the list in local storage: memory -> persisted cache -> single SDK fetch (persisted on success); across sessions the network is hit at most once ever - gateway settings serve the cached list; an explicit 'Refresh list' action (new RefreshGateways event + modal button) force-fetches and persists - SnapshotValidationService reads through the same shared cache - corrupt or missing persisted entries fall back to a normal fetch; fetch failures are cached in memory only (never persisted) so the next session retries - add DataGatewayFallback persistence tests and update gar repository tests Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- equatable 2.1.0 (released after the last green dev build) deprecates EquatableMixin, which data_table.dart uses; package lockfiles are not committed, so CI's per-package pub get floated to 2.1.0 and scr test failed on the analyze step for every PR and dev push - the main app's committed lockfile resolves equatable 2.0.7, where Equatable cannot be used as a mixin, so migrating the code instead of pinning would break the app build; pin until both contexts can move to 2.1.x together Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 4 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (12)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Consolidated into #2162 so all sync improvements can be tested on one preview build. Branch merged there commit-for-commit. |
|
Visit the preview URL for this PR (updated for commit fe3d465): https://ardrive-web--pr2165-perf-minimize-solana-qch8uf45.web.app (expires Thu, 16 Jul 2026 18:04:58 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: a224ebaee2f0939e7665e7630e7d3d6cd7d0f8b0 |
Summary
Investigation of heavy traffic to ArDrive's QuikNode Solana RPC found two structural sources; this PR eliminates both.
1. Sync no longer sweeps ArNS on every run
Every sync (auto-sync ~5 min, tab-focus restarts, manual) called
getAntRecordsForWallet(update: true)— deliberately bypassing the repository's 15-minute cache — walking every owned ArNS name on Solana (several RPC calls per name), plus a post-syncsaveAllFilesWithAssignedNamespass. ArDrive currently has no ArNS integration, so this was pure RPC cost with no user-facing effect. Both call sites and theARNSRepositorydependency are removed fromSyncRepository. On-demand ArNS lookups elsewhere (upload flows, profile name) are untouched; sync-time integration can return later with the feature.2. GAR gateway list: fetch at most once ever, refresh only on demand
The AR.IO gateway list was re-fetched from Solana RPC every app session (data-fetch fallback, snapshot validation) and on every open of the gateway settings modal. It's now persisted in local storage:
DataGatewayFallback: memory → persisted cache → single SDK fetch (persisted on success). Across sessions the network is hit at most once, ever.RefreshGatewaysbloc event) force-fetches and persists — the only path that re-hits the RPC.SnapshotValidationServicereads through the same shared cache.Expected impact
Steady-state Solana RPC volume drops to ~zero for a signed-in user who isn't using crypto top-ups or explicitly refreshing the gateway list.
Tests
DataGatewayFallbackpersistence suite (store-hit/no-RPC, fetch-once-persist, cross-session reuse, failure non-persistence, corrupt-entry recovery, forced refresh)gar_repository_testrewired to the shared cache (asserts no SDK call on plaingetGateways)Note: local test execution was unavailable for this branch (WSL→Windows interop broke mid-session); CI is the validation gate for this PR — please wait for green before review.
🤖 Generated with Claude Code
https://claude.ai/code/session_0172nfTRDj7wgnhs44Lg6mxC