fix(coin-mina): stop staking fetch breaking account sync (LIVE-35237) - #20275
Conversation
The validator and epoch calls added with the staking coin-module run on every account synchronisation, so an upstream failure there rejected getAccountShape and failed the whole sync, balance and operations included, even though Rosetta was healthy. Staking resources now fall back to the values from the previous sync, the validator list is fetched once and shared across accounts instead of being re-paginated per account per sync, and validator requests go through the retrying network helper with a bounded pagination loop. Co-authored-by: Cursor <cursoragent@cursor.com>
Web Tools Build Status
|
There was a problem hiding this comment.
Pull request overview
This PR hardens Mina account synchronisation by isolating non-critical staking enrichment so that upstream staking outages no longer break the core sync path (balance/ops), while also reducing validator-fetch load via caching, retries, and bounded pagination.
Changes:
- Move staking enrichment out of the main
getAccountShapeflow into a guarded helper that falls back to previously-synced staking resources on failure. - Add an LRU-cached, retrying validator fetch with explicit timeout and bounded pagination.
- Add unit tests covering degraded staking behavior, cache sharing/reset, retry behavior, and pagination stop conditions; add new Mina staking/validators constants and a changeset.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| libs/coin-modules/coin-mina/src/network/index.ts | Adds cached validator fetching with retry/timeout and bounded pagination; makes data optional in makeNetworkRequest. |
| libs/coin-modules/coin-mina/src/network/index.test.ts | Extends validator-fetch tests to cover caching, retry, and pagination bounds. |
| libs/coin-modules/coin-mina/src/consts.ts | Introduces validators-specific timeout, pagination, and cache TTL constants. |
| libs/coin-modules/coin-mina/src/bridge/synchronisation.ts | Wraps staking resource fetching in a try/catch and falls back to previous resources to keep sync resilient. |
| libs/coin-modules/coin-mina/src/bridge/synchronisation.test.ts | Adds coverage ensuring sync still returns balance/ops when staking upstreams fail and validates fallback behavior. |
| .changeset/mina-isolate-staking-sync.md | Declares the package version bump and release note for the sync hardening changes. |
Rsdoctor Bundle Diff AnalysisFound 7 projects in monorepo, 7 projects with changes. 📊 Quick Summary
📋 Detailed Reports (Click to expand)📁 desktop-mainPath:
📁 desktop-preloaderPath:
📁 desktop-rendererPath:
📁 desktop-webviewDappPreloaderPath:
📁 desktop-webviewPreloaderPath:
📁 desktop-workersPath:
📁 mobilePath:
Generated by Rsdoctor GitHub Action |
|



📝 Description
The staking coin-module work merged in #15683 is not integrated in LWD/LWM yet, but its data fetching is not gated by the UI: the validator and epoch calls were added to
getAccountShape, which is the synchronisation path used by every Mina account. They run on every sync (~8 min per account, plus app start and manual refresh) regardless of any staking screen.Previous behaviour. The three staking calls (validators REST + two GraphQL queries) were awaited in a
Promise.allwith no error handling, so any upstream failure rejectedgetAccountShapeand failed the whole account sync — balance and operations included — even when Rosetta was healthy. The validator list was also re-paginated in full on every sync of every account, although it is network-wide and identical for all of them, and those requests bypassed the retrying network helper.Fix.
getStakingResources, wrapped in atry/catchthat falls back to the resources from the previous sync. Balance, operations and block height are unaffected by a staking upstream outage.fetchValidatorsis wrapped inmakeLRUCache(30 min TTL, single entry), so concurrent account syncs share one request instead of one full pagination each.makeNetworkRequest(retry + backoff on 502/503/504, explicit 30s timeout instead of the 120s Rosetta one).while (!data.last)could spin forever against an upstream that stops reportinglast.Automated checks preventing regression. 9 new unit tests: sync still returns balance/operations when a staking upstream fails, resources fall back to the previous sync, resources stay unset when there is nothing to fall back on, a single fetch is shared between callers, failures are not cached, and both pagination stop conditions plus the retry path.
No behaviour change when upstreams are healthy, and no impact on LWD/LWM since neither consumes
resourcesyet.🔗 Context