Skip to content

Feat/stellar/enrichment client side#33084

Open
khanti42 wants to merge 3 commits into
feat/stellar/developmentfrom
feat/stellar/enrichment-client-side
Open

Feat/stellar/enrichment client side#33084
khanti42 wants to merge 3 commits into
feat/stellar/developmentfrom
feat/stellar/enrichment-client-side

Conversation

@khanti42

@khanti42 khanti42 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Description

Changelog

CHANGELOG entry:

Related issues

Fixes:

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Medium Risk
Touches core AssetsController balance merge and account-tree refresh paths used by unified assets state; incorrect merging could affect displayed balances or metadata across chains, though the change is narrowly scoped to merge semantics and new-account fetching.

Overview
Extends the vendored @metamask/assets-controller Yarn patch so balance updates behave correctly with client-side Stellar trustline/metadata enrichment.

mergeAccountBalances no longer shallow-merges per account; for each asset id it merges into the existing balance object (defaulting amount to '0' when missing) so partial updates—e.g. enrichment writing metadata via handleAssetsUpdate with updateMode: 'merge'—are not wiped when a later fetch only supplies amount.

On account tree changes, the controller now tracks newly added accounts and, after the usual refresh, runs an extra getAssets for those accounts across all enabled chains, so multichain/Stellar balances populate when accounts are added without a full restart.

A small refactor in _AssetsController_handleAccountGroupChanged reuses a cached accounts variable when fetching balances for newly enabled chains (behavior unchanged).

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

@khanti42 khanti42 requested review from a team as code owners July 9, 2026 23:03
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@mm-token-exchange-service mm-token-exchange-service Bot added the team-networks Networks team label Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is an update of the patch to include this fix: MetaMask/core#9453

otherwise balance update drops metadata

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated the snap to latest version by patching it

@socket-security

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeAccounts, SmokeConfirmations, SmokeNetworkAbstractions, SmokeNetworkExpansion, SmokeSwap, SmokeStake, SmokeWalletPlatform, SmokeMoney, SmokePerps, SmokeMultiChainAPI, SmokePredictions, SmokeSeedlessOnboarding, SmokeBrowser, SmokeSnaps
  • Selected Performance tags: @PerformanceAssetLoading
  • Risk Level: high
  • AI Confidence: 100%
click to see 🤖 AI reasoning details

E2E Test Selection:
Hard rule (controller-version-update): @MetaMask controller package version updated in package.json: @metamask/assets-controllers, @metamask/assets-controller@npm:^10.0.1, @metamask/assets-controller. Running all tests.

Performance Test Selection:
The attachAccountAssetInfoFromBalances function is added to the selectAssetsBySelectedAccountGroup selector which runs on every state change for the main token list. This adds an additional iteration over all assets to re-attach metadata from balances. While the operation is O(n) and likely fast, it runs in a hot path (createDeepEqualSelector) that affects asset loading performance. The @metamask/assets-controller version change (downgrade with patch) could also affect balance fetching performance. @PerformanceAssetLoading covers token list rendering and balance fetching which are directly impacted by these selector changes.

View GitHub Actions results

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

⚡ Performance Test Results

ℹ️ Performance test results are currently non-blocking and will not block this PR.

All tests passed · 2 tests · 1 device

📱 Devices tested (1)

Android: Google Pixel 8 Pro (v14.0)

✅ Passed Tests (2)
Test Platform Device Duration Team Recording
Aggregated Balance Loading Time, SRP 1 + SRP 2 + SRP 3 Android Google Pixel 8 Pro (v14.0) 8.25s @assets-dev-team 📹 Watch
Asset View, SRP 1 + SRP 2 + SRP 3 Android Google Pixel 8 Pro (v14.0) 4.13s @assets-dev-team 📹 Watch

Branch: feat/stellar/enrichment-client-side · Build: Normal · Commit: ccbc94c · View full run

}
}
} else {
await MultichainAssetsController.addAssets(

@stanleyyconsensys stanleyyconsensys Jul 10, 2026

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.

this is by purpose, dont move it here

our plan is to remove asset enrich from old controller, and do it on new controller

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants