Skip to content

fix: check chainRanking for enabled swaps networks#25765

Merged
bfullam merged 2 commits intomainfrom
swaps-chainRanking-enabled-check
Feb 6, 2026
Merged

fix: check chainRanking for enabled swaps networks#25765
bfullam merged 2 commits intomainfrom
swaps-chainRanking-enabled-check

Conversation

@bfullam
Copy link
Copy Markdown
Contributor

@bfullam bfullam commented Feb 6, 2026

Description

The isActiveSrc and isActiveDest properties on the chains feature flag are being deprecated. If a chain exists in the chainRanking array, it is now assumed to be enabled as both source and destination. This PR migrates all selectors that previously checked chains[chainId].isActiveSrc / chains[chainId].isActiveDest to instead check for the chain's presence in chainRanking.

This eliminates a pain point where adding a new network required an entry in both chainRanking and chains — now chainRanking is the single source of truth for whether a network is enabled.

Changes:

  • selectIsBridgeEnabledSourceFactory — checks chainRanking presence instead of chains[chainId].isActiveSrc
  • selectEnabledSourceChains — same migration
  • Removed selectEnabledDestChains, selectIsBridgeEnabledDest, and selectIsSwapsLive selectors (no longer needed with the new model)
  • Removed unused imports (PopularList, selectHasCreatedSolanaMainnetAccount)
  • Updated tests to match new behavior: disabling a chain means removing it from chainRanking

Changelog

CHANGELOG entry: null

Related issues

Fixes:

Manual testing steps

Feature: Bridge chain enablement via chainRanking

  Scenario: user opens swap/bridge for a supported network
    Given the user has a wallet with tokens on Ethereum Mainnet
    When user opens the swap or bridge view
    Then Ethereum Mainnet is available as a source network

  Scenario: user opens swap/bridge for a network not in chainRanking
    Given the user has a wallet on a network not listed in chainRanking
    When user opens the swap or bridge view
    Then that network is not available as a source network

  Scenario: user selects destination token on a newly added network
    Given a new network has been added to chainRanking
    When user opens the bridge token selector for destination
    Then the new network appears and its default destination token loads correctly

Screenshots/Recordings

Not applicable — no UI changes.

Before

N/A

After

N/A

Pre-merge author checklist

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
Changes core selector logic that gates which networks appear/enabled for bridge/swap, and removes selectors that may have downstream callers if not fully migrated.

Overview
Switches bridge/swap network enablement checks to rely solely on feature-flag chainRanking membership, replacing deprecated chains[caipId].isActiveSrc/isActiveDest lookups.

Removes destination/live enablement selectors (selectEnabledDestChains, selectIsBridgeEnabledDest, selectIsSwapsLive) and related imports, and updates unit tests to reflect the new behavior (a chain is disabled by removing it from chainRanking, and unknown chains now return false rather than undefined).

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 6, 2026

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.

@metamaskbot metamaskbot added the team-swaps-and-bridge Swaps and Bridge team label Feb 6, 2026
@github-actions github-actions bot added the size-M label Feb 6, 2026
@bfullam bfullam marked this pull request as ready for review February 6, 2026 10:58
@bfullam bfullam enabled auto-merge February 6, 2026 10:59
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 6, 2026

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeTrade, SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

E2E Test Selection:
The PR modifies the bridge Redux slice by changing how chains are determined to be enabled for bridging. Key changes:

  1. Modified selectors: selectIsBridgeEnabledSourceFactory and selectEnabledSourceChains now use chainRanking array presence instead of isActiveSrc flag to determine if a chain is enabled for bridging.

  2. Removed selectors: selectEnabledDestChains, selectIsBridgeEnabledDest, and selectIsSwapsLive were removed. Grep search confirmed these are NOT used anywhere else in the codebase, so their removal is safe.

  3. Impact: The modified selectors are used by useSwapBridgeNavigation, useNonEvmAccounts, and useSortedSourceNetworks hooks, which are core to the bridge/swap UI functionality.

SmokeTrade is selected because it tests swap and bridge functionality directly affected by these changes. SmokeConfirmations is required as a dependent tag since swap/bridge flows require transaction confirmations.

The risk is medium because while the logic change could affect which chains appear as available for bridging, the removed selectors are unused and the test file is properly updated to match the new logic.

Performance Test Selection:
The changes are to Redux selectors that determine which chains are enabled for bridging. This is a logic/filtering change, not a performance-impacting change. The selectors use memoization (createSelector) and the changes don't affect rendering performance, data loading patterns, or UI responsiveness. No performance tests are needed.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Feb 6, 2026

@bfullam bfullam added this pull request to the merge queue Feb 6, 2026
Merged via the queue into main with commit 84ad8ef Feb 6, 2026
92 checks passed
@bfullam bfullam deleted the swaps-chainRanking-enabled-check branch February 6, 2026 11:55
@github-actions github-actions bot locked and limited conversation to collaborators Feb 6, 2026
@metamaskbot metamaskbot added the release-7.66.0 Issue or pull request that will be included in release 7.66.0 label Feb 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.66.0 Issue or pull request that will be included in release 7.66.0 size-M team-swaps-and-bridge Swaps and Bridge team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants