Skip to content

fix(solana): fail getAccountBalances when an RPC fetch for a requested network fails - #527

Draft
rvelaz wants to merge 8 commits into
mainfrom
fix/stale-balances-09-solana-fail-on-fetch-error
Draft

rvelaz wants to merge 8 commits into
mainfrom
fix/stale-balances-09-solana-fail-on-fetch-error

Conversation

@rvelaz

@rvelaz rvelaz commented Oct 26, 2026 •

Copy link
Copy Markdown

Draft. Updated 9 Nov 2026: merged main; vitest mock fixes; snap.manifest.json shasum regenerated.

  • Package: @metamask/solana-wallet-snap

Explanation

Bug

When Solana RPC fetches fail, getAccountBalances can return a partial/empty map so the wallet keeps showing a stale SOL balance with no error.

How to reproduce

  1. Build solana snap from this branch.
  2. With a correct SOL balance showing, block the Solana RPC host in DevTools (or induce 5xx/timeouts).
  3. Watch the Solana row.

Expected: balance becomes unavailable with Retry.
Actual (before): stale SOL amount.

Without a browser: Keyring.test.ts › partial fetch failure throws.

Why

SnapAssetsAdapter used Promise.allSettled and dropped failed networks; successful RPC mixed with failed ones looked like a “successful” balance read.

Validation

  • Targeted suites (Keyring, AssetsService, SnapAssetsAdapter, index error paths): pass on branch 20a63837.
  • Full solana package: some unrelated cron/confirmation suites need env/RPC fixtures (pre-existing); core PR behavior tests pass.
  • Build: pass.

Changelog

Unreleased → Fixed: fail getAccountBalances when a requested network’s RPC fails (#527).

…d network fails

keyring_getAccountBalances passes failOnNetworks for the networks of the requested assets. If a native or token-account fetch for one of them fails, SnapAssetsAdapter throws AccountAssetsFetchError instead of returning a partial or empty result, so the client flags the balance unavailable instead of keeping a stale one. Other callers keep the skip-and-report behaviour.
rvelaz and others added 7 commits November 9, 2026 12:46
…-solana-fail-on-fetch-error

Co-authored-by: Raul Velaz <rvelaz@users.noreply.github.com>
Co-authored-by: Raul Velaz <rvelaz@users.noreply.github.com>
Co-authored-by: Raul Velaz <rvelaz@users.noreply.github.com>
Co-authored-by: Raul Velaz <rvelaz@users.noreply.github.com>
Co-authored-by: Raul Velaz <rvelaz@users.noreply.github.com>
…rror

Co-authored-by: Raul Velaz <rvelaz@users.noreply.github.com>

# Conflicts:
#	packages/solana-wallet-snap/CHANGELOG.md
Co-authored-by: Raul Velaz <rvelaz@users.noreply.github.com>
@sonarqubecloud

sonarqubecloud Bot commented Nov 9, 2026

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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.

1 participant