Skip to content

fix: run RPC fallback on Accounts API poll updates - #10078

Merged
salimtb merged 4 commits into
mainfrom
fix/fix-polling-fallback
Sep 2, 2026
Merged

fix: run RPC fallback on Accounts API poll updates#10078
salimtb merged 4 commits into
mainfrom
fix/fix-polling-fallback

Conversation

@salimtb

@salimtb salimtb commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

The stale-balance re-read only ran in the forced getAssets fast pipeline, so while the wallet sat open, 30s Accounts API polls kept committing responses that omit unindexed tokens with a plain merge — the stale amount survived until the next forced refresh (unlock, transaction, manual refresh).

handleAssetsUpdate now inserts RpcFallbackMiddleware into the enrichment pipeline for AccountsApiDataSource updates, after graduation and before detection, mirroring the fast pipeline. WebSocket updates are excluded (incremental single-asset pushes — absence is not staleness) and RPC/Snap updates are excluded so RPC never re-triggers itself.

Explanation

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Touches the live balance merge path for Accounts API polls and adds extra RPC reads when indexed tokens are omitted; scope is limited by source gating and existing fallback rules.

Overview
Fixes stale token balances that could persist while the wallet stayed open: periodic Accounts API polls merge responses that omit unindexed tokens, and RpcFallbackMiddleware previously ran only on the forced getAssets fast path.

handleAssetsUpdate now runs RpcFallbackMiddleware for AccountsApiDataSource updates in the enrichment pipeline (after custom-asset graduation, before detection), so tracked assets missing from a poll response are re-read on-chain via RPC. WebSocket (AccountActivityDataSource), RPC, and Snap updates are unchanged and do not trigger the fallback.

Adds a unit test that asserts poll updates pass omitted tracked assets as customAssets to RPC, and that WebSocket updates do not invoke the fallback. Changelog updated under Fixed.

Reviewed by Cursor Bugbot for commit ed7cf21. Bugbot is set up for automated code reviews on this repo. Configure here.

The stale-balance re-read only ran in the forced getAssets fast pipeline, so
while the wallet sat open, 30s Accounts API polls kept committing responses
that omit unindexed tokens with a plain merge — the stale amount survived
until the next forced refresh (unlock, transaction, manual refresh).

handleAssetsUpdate now inserts RpcFallbackMiddleware into the enrichment
pipeline for AccountsApiDataSource updates, after graduation and before
detection, mirroring the fast pipeline. WebSocket updates are excluded
(incremental single-asset pushes — absence is not staleness) and RPC/Snap
updates are excluded so RPC never re-triggers itself.
@salimtb
salimtb force-pushed the fix/fix-polling-fallback branch from 831ee6b to 20944d2 Compare September 2, 2026 16:19
@salimtb
salimtb marked this pull request as ready for review September 2, 2026 16:22
@salimtb
salimtb requested review from a team as code owners September 2, 2026 16:22
@salimtb
salimtb deployed to default-branch September 2, 2026 16:22 — with GitHub Actions Active

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9ff47f3. Configure here.

Comment thread packages/assets-controller/src/AssetsController.ts
Co-authored-by: Cursor <cursoragent@cursor.com>
@salimtb

salimtb commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

@cursor fix the conflict

@cursor

cursor Bot commented Sep 2, 2026

Copy link
Copy Markdown

I've successfully resolved the merge conflict in the CHANGELOG.md file. Here's what I did:

Conflict Resolution:

Changes Made:

  • Resolved the conflict in packages/assets-controller/CHANGELOG.md
  • Staged and committed the merge with a descriptive message
  • Pushed the resolved merge to origin/fix/fix-polling-fallback

The PR now includes the latest changes from main and the conflict has been resolved. The branch is ready for review.

Open in Web Open in Cursor 

Resolved changelog conflict by keeping both stale balance fixes:
- RPC fallback on poll updates (#10078)
- bypassServerCache on transaction confirmation (#10068)

Co-authored-by: Salim TOUBAL <salimtb@users.noreply.github.com>
@salimtb
salimtb enabled auto-merge September 2, 2026 16:34
@salimtb
salimtb added this pull request to the merge queue Sep 2, 2026
Merged via the queue into main with commit 871d1fd Sep 2, 2026
58 checks passed
@salimtb
salimtb deleted the fix/fix-polling-fallback branch September 2, 2026 17:01
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.

3 participants