fix: non-evm bridge activity - #44751
Conversation
|
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. |
✨ Files requiring CODEOWNER review ✨👨🔧 @MetaMask/core-extension-ux (1 files, +20 -7)
|
| const bridgeHistoryEntry = getBridgeHistory(transaction.id); | ||
| const { quote } = bridgeHistoryEntry ?? {}; | ||
|
|
||
| if (quote && isCrossChain(quote.srcChainId, quote.destChainId)) { |
There was a problem hiding this comment.
Point of interest: detect cross-chain bridge
| const destinationChainId = getChainIdFromAssetId( | ||
| destinationToken?.assetId as CaipAssetType, | ||
| ); | ||
| const subtitle = |
|
|
||
| function getChainDisplay(activity: ActivityRowProps['data']) { | ||
| const { namespace } = parseCaipChainId(activity.chainId); | ||
| function getChainDisplay(caipChainId: string) { |
Builds ready [59bbaf1]
⚡ Performance Benchmarks (Total: 🟢 15 pass · 🟡 10 warn · 🔴 0 fail)
Bundle size diffs
|
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
|
Looks like lint is failing |
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
|
Builds ready [4ca022a]
⚡ Performance Benchmarks (Total: 🟢 15 pass · 🟡 9 warn · 🔴 0 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
🧪 Validation RunVerdict: Note Trial run of the MetaMask evidence skills — Same selector, same fixture, same probe, run in CI at the merge commit and at its parent. Five writes that touch nothing the selector reads. At the parent commit:
|
| Condition | Calls | Recomputations |
|---|---|---|
| Identical state reference | 5 | 1 |
Fresh metamask slice, unrelated field |
5 | 1 |
pinnedAccountList changed (a real input) |
5 | 1 |
Correctness: the returned value is identical across all calls above, so the count
measures memoisation rather than a change in behaviour.
$ git checkout --detach 62fd747287f0bda8a4ecf671b8c28514f3d07f6e && bash selector-recompute.sh --label selector-recompute-base --out evidence-artifacts --module ui/selectors/activity --export selectNonEvmActivityItems --fixture test/data/mock-state.json --slice metamask --perturb pinnedAccountList
RECOMPUTE_PROBE identical=1 unrelated=1 inputChanged=1 n=5 valueStable=true
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Time: 3.632 s, estimated 7 sProduced by selector-recompute.sh via reselect's own counter; the probe is generated, run, and kept beside this artifact. head 62fd747287f0bda8a4ecf671b8c28514f3d07f6e · 0 tracked changes · node v24.13.1. Run: https://github.com/MajorLift/metamask-skills/actions/runs/30749351450 — logs and artifacts attached there.
At the merge commit:
selectNonEvmActivityItems recomputation count
Verdict: recomputes on unrelated writes
| Condition | Calls | Recomputations |
|---|---|---|
| Identical state reference | 5 | 1 |
Fresh metamask slice, unrelated field |
5 | 6 |
pinnedAccountList changed (a real input) |
5 | 11 |
Correctness: the returned value is identical across all calls above, so the count
measures memoisation rather than a change in behaviour.
$ git checkout --detach ab4fbefa8d2a087c48491e5cf76bf31b3907cd34 && bash selector-recompute.sh --label selector-recompute-head --out evidence-artifacts --module ui/selectors/activity --export selectNonEvmActivityItems --fixture test/data/mock-state.json --slice metamask --perturb pinnedAccountList
RECOMPUTE_PROBE identical=1 unrelated=6 inputChanged=11 n=5 valueStable=true
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Time: 6.821 sProduced by selector-recompute.sh via reselect's own counter; the probe is generated, run, and kept beside this artifact. head ab4fbefa8d2a087c48491e5cf76bf31b3907cd34 · 0 tracked changes · node v24.13.1. Run: https://github.com/MajorLift/metamask-skills/actions/runs/30749351450 — logs and artifacts attached there.
Follows from the arms above
- One recomputation before, six after, for the same five unrelated writes — the selector now recomputes on every dispatch rather than when its inputs move.
valueStable=truein both, so the extra work produces an identical result each time.- The cause is an input selector reading the whole store, added by this change:
ui/selectors/activity.ts#L224-L228.[(state) => state]changes identity on every dispatch, so the memo can never hit, and it returns a fresh closure each time. selectNonEvmActivityItemsByIdtakesselectNonEvmActivityItemsas its input, so it inherits this.- A narrower input reaches the same value:
selectBridgeHistoryItemForTxHashneeds the bridge-status slice, not the store.
Open for review: one fixture with one perturbed key, so the third row is not meaningful here — pinnedAccountList is not an input to this selector at either commit. The middle row is what moves, 1 → 6. Whether that matters in the running app depends on how often the activity list is subscribed while dispatches are flowing, which this does not establish.


Description
Fix labels of non-EVM source bridge transactions
Changelog
CHANGELOG entry: fix: non EVM activity labels
Related issues
Fixes: #44752
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Changes activity classification and display for non-EVM transactions using bridge history lookups; incorrect matching could mislabel sends as bridges, but scope is limited to activity UI/selectors.
Overview
Non-EVM keyring transactions that match cross-chain bridge history are shown as bridges again, with source/destination tokens from the quote instead of a plain send.
selectNonEvmActivityItemsnow resolves bridge history per transaction id viaselectBridgeHistoryItemForTxHashand, whenisCrossChainapplies, overrides the mapped activity totype: 'bridge'with swap tokens and bridge status. Unmatched sends stay sends (covered by new selector tests).Bridge rows in the activity list can show a source chain → destination chain subtitle by deriving chain ids from token
assetIds;getChainIdFromAssetIdreturnsundefinedfor missing ids. BTC bridge e2e expectations were updated from “Sending BTC” to “Bridging BTC”.Reviewed by Cursor Bugbot for commit 4ca022a. Bugbot is set up for automated code reviews on this repo. Configure here.