Skip to content

fix(coin-mina): stop staking fetch breaking account sync (LIVE-35237) - #20275

Merged
cted-ledger merged 2 commits into
developfrom
fix/coin-mina-isolate-staking-sync
Aug 3, 2026
Merged

fix(coin-mina): stop staking fetch breaking account sync (LIVE-35237)#20275
cted-ledger merged 2 commits into
developfrom
fix/coin-mina-isolate-staking-sync

Conversation

@cted-ledger

@cted-ledger cted-ledger commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

📝 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.all with no error handling, so any upstream failure rejected getAccountShape and 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.

  • Staking enrichment moved to getStakingResources, wrapped in a try/catch that falls back to the resources from the previous sync. Balance, operations and block height are unaffected by a staking upstream outage.
  • fetchValidators is wrapped in makeLRUCache (30 min TTL, single entry), so concurrent account syncs share one request instead of one full pagination each.
  • Validator requests go through makeNetworkRequest (retry + backoff on 502/503/504, explicit 30s timeout instead of the 120s Rosetta one).
  • The pagination loop is bounded: while (!data.last) could spin forever against an upstream that stops reporting last.

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 resources yet.

🔗 Context

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>
Copilot AI review requested due to automatic review settings July 31, 2026 10:21
@live-github-bot live-github-bot Bot changed the title fix(coin-mina): stop staking data fetching from breaking account sync [LWDM] fix(coin-mina): stop staking data fetching from breaking account sync Jul 31, 2026
@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Web Tools Build Status

Build Status Deployment
Web Tools Build ✅ Deployed https://web-tools-45bghvbc8-ledger-hq-prd.vercel.app
Native Storybook Build ⏭️ Skipped
React Storybook Build ⏭️ Skipped

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 getAccountShape flow 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.

Comment thread libs/coin-modules/coin-mina/src/network/index.ts
Comment thread libs/coin-modules/coin-mina/src/network/index.ts
Comment thread libs/coin-modules/coin-mina/src/network/index.test.ts Outdated
Comment thread .changeset/mina-isolate-staking-sync.md Outdated
@cted-ledger cted-ledger changed the title [LWDM] fix(coin-mina): stop staking data fetching from breaking account sync fix(coin-mina): stop staking data fetching from breaking account sync (LIVE-35237) Jul 31, 2026
@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Rsdoctor Bundle Diff Analysis

Found 7 projects in monorepo, 7 projects with changes.

📊 Quick Summary
Project Total Size Change
desktop-main 2.3 MB -
desktop-preloader 7.1 KB -
desktop-renderer 80.6 MB -
desktop-webviewDappPreloader 36.9 KB -
desktop-webviewPreloader 200.0 B -
desktop-workers 36.8 KB -
mobile 261.4 MB -
📋 Detailed Reports (Click to expand)

📁 desktop-main

Path: rsdoctor/desktop-main/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 2.3 MB - -
📄 JavaScript 2.2 MB - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 135.3 KB - -

📁 desktop-preloader

Path: rsdoctor/desktop-preloader/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 7.1 KB - -
📄 JavaScript 5.3 KB - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 1.8 KB - -

📁 desktop-renderer

Path: rsdoctor/desktop-renderer/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 80.6 MB - -
📄 JavaScript 29.3 MB - -
🎨 CSS 183.1 KB - -
🌐 HTML 1.8 KB - -
📁 Other Assets 51.2 MB - -

📁 desktop-webviewDappPreloader

Path: rsdoctor/desktop-webviewDappPreloader/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 36.9 KB - -
📄 JavaScript 36.9 KB - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 desktop-webviewPreloader

Path: rsdoctor/desktop-webviewPreloader/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 200.0 B - -
📄 JavaScript 200.0 B - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 desktop-workers

Path: rsdoctor/desktop-workers/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 36.8 KB - -
📄 JavaScript 36.8 KB - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 mobile

Path: rsdoctor/mobile/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 261.4 MB - -
📄 JavaScript 110.4 MB - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 151.0 MB - -

Generated by Rsdoctor GitHub Action

Copilot AI review requested due to automatic review settings August 1, 2026 07:55
@cted-ledger cted-ledger changed the title fix(coin-mina): stop staking data fetching from breaking account sync (LIVE-35237) fix(coin-mina): stop staking fetch breaking account sync (LIVE-35237) Aug 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@sonarqubecloud

sonarqubecloud Bot commented Aug 1, 2026

Copy link
Copy Markdown

@cted-ledger
cted-ledger marked this pull request as ready for review August 1, 2026 08:27
@cted-ledger
cted-ledger requested review from a team as code owners August 1, 2026 08:27
@cted-ledger
cted-ledger merged commit 5148f12 into develop Aug 3, 2026
85 of 86 checks passed
@cted-ledger
cted-ledger deleted the fix/coin-mina-isolate-staking-sync branch August 3, 2026 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants