Skip to content

fix(assets-controller): hardened error handling#8294

Open
Kriys94 wants to merge 1 commit intomainfrom
fix/TryCatch
Open

fix(assets-controller): hardened error handling#8294
Kriys94 wants to merge 1 commit intomainfrom
fix/TryCatch

Conversation

@Kriys94
Copy link
Copy Markdown
Contributor

@Kriys94 Kriys94 commented Mar 25, 2026

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
Changes request fan-out and concurrency for token metadata and spot-price fetching and alters error propagation by swallowing exceptions in several update callbacks, which could impact refresh behavior and observability if misconfigured.

Overview
Improves assets pipeline resilience by wrapping several push-update callbacks in try/catch (active-chain updates in AssetsController, and polling callbacks in RpcDataSource and StakedBalanceDataSource) to prevent unhandled errors from breaking subscription/poll ticks.

Fixes v3 API request limits by chunking Tokens /v3/assets metadata fetches and Prices v3 spot-price fetches into max 120 asset IDs per request, executing chunks in parallel with bounded concurrency via p-limit; adds unit tests covering chunking behavior (including non-USD + USD dual-fetch). Also hardens SnapDataSource balance update handling against missing/undefined payload fields and updates the mock messenger fixture import path.

Written by Cursor Bugbot for commit f715a73. This will update automatically on new commits. Configure here.

@Kriys94 Kriys94 force-pushed the fix/TryCatch branch 3 times, most recently from f57996a to 4b711c2 Compare March 27, 2026 10:42
@Kriys94 Kriys94 marked this pull request as ready for review March 27, 2026 10:42
@Kriys94 Kriys94 requested review from a team as code owners March 27, 2026 10:42
Copy link
Copy Markdown

@cursor cursor bot left a comment

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.

/** Max concurrent `/v3/assets` chunk requests (same default scale as balance middleware). */
const V3_ASSETS_FETCH_CONCURRENCY = 3;

const MIN_TOKEN_OCCURRENCES = 3;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unused MIN_TOKEN_OCCURRENCES constant is dead code

Low Severity

The MIN_TOKEN_OCCURRENCES constant is defined but never referenced anywhere in the codebase. A grep across the entire repository finds only this single definition. The changelog notes that the filtering approach changed from minimum occurrence count to Blockaid scanning, so this constant appears to be a leftover from the old approach that was inadvertently introduced in this diff.

Fix in Cursor Fix in Web

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.

1 participant