chore(runway): cherry-pick fix: account for POL non-zero native address cp-7.69.0#27119
Merged
joaoloureirop merged 1 commit intoMar 9, 2026
Merged
Conversation
…ss cp-7.69.0 (#27052) ## **Description** Fixes a bug in the bridge token selector where Polygon's native token (POL) appeared twice in the list — once with balance at the top and once without balance at the bottom. Selecting the balance entry as a destination token caused the quote to show 0 and the rate to display "--". **Root cause**: Polygon's native token uses address `0x0000000000000000000000000000000000001010` in wallet state (from `getNativeTokenAddress`), but the bridge API expects `AddressZero` (`0x0000...0000`) for all native assets. The bridge-controller's `isNativeAddress()` does not recognize `0x...1010` as native, so: 1. `tokenToIncludeAsset` sent the wrong asset ID (`erc20:0x...1010` instead of `slip44:966`) to the API, which couldn't deduplicate it with its own native POL entry. 2. When the user selected POL with `0x...1010`, quote matching in `useBridgeQuoteData` failed because the returned quote used `AddressZero` for `destAsset.address`. **Fix**: Extracted the existing normalization logic from `useTokenAddress` into a reusable pure function `normalizeTokenAddress`, and applied it in `useTokensWithBalance` when building `BridgeToken` objects from wallet state. This ensures POL enters the bridge flow with `AddressZero` from the start, fixing both the duplicate listing and the quote/rate mismatch. ## **Changelog** CHANGELOG entry: Fixed a bug where Polygon's native token (POL) appeared twice in the bridge token selector and selecting it showed incorrect quote data. ## **Related issues** Fixes: ## **Manual testing steps** ```gherkin Feature: Bridge token selector - Polygon native token Scenario: user selects POL as destination token on Polygon Given user has a POL balance on Polygon And user opens the bridge token selector for destination When user filters by Polygon network Then POL appears only once in the token list with balance displayed Scenario: user gets a valid quote after selecting POL destination Given user has a source token with balance And user has selected POL on Polygon as the destination token When the quote loads Then the destination input shows a non-zero amount And the rate displays a valid exchange rate (not "--") ``` ## **Screenshots/Recordings** ### **Before** ### **After** ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I've included tests if applicable - [x] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Medium risk because it changes how token addresses are represented in the bridge token list and downstream API/quote matching, which could affect token identification on Polygon. Scope is small and isolated to bridge token normalization. > > **Overview** > Fixes Polygon native token (POL) handling in the bridge UI by normalizing Polygon’s non-zero native token address to the zero address the bridge API expects. > > Extracts the Polygon-specific normalization from `useTokenAddress` into a reusable `normalizeTokenAddress` utility and applies it when constructing tokens in `useTokensWithBalance`, preventing duplicate POL entries and quote mismatches caused by inconsistent native-address representations. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit b0deef0. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
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. |
Contributor
🔍 Smart E2E Test Selection⏭️ Smart E2E selection skipped - base branch is not main (base: release/7.69.0) All E2E tests pre-selected. |
|
Contributor
The committed fixture schema is out of date. To update, comment: |
joaoloureirop
approved these changes
Mar 9, 2026
Collaborator
|
No release label on PR. Adding release label release-7.69.0 on PR, as PR was cherry-picked in branch 7.69.0. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Fixes a bug in the bridge token selector where Polygon's native token
(POL) appeared twice in the list — once with balance at the top and once
without balance at the bottom. Selecting the balance entry as a
destination token caused the quote to show 0 and the rate to display
"--".
Root cause: Polygon's native token uses address
0x0000000000000000000000000000000000001010in wallet state (fromgetNativeTokenAddress), but the bridge API expectsAddressZero(
0x0000...0000) for all native assets. The bridge-controller'sisNativeAddress()does not recognize0x...1010as native, so:tokenToIncludeAssetsent the wrong asset ID (erc20:0x...1010instead of
slip44:966) to the API, which couldn't deduplicate it withits own native POL entry.
0x...1010, quote matching inuseBridgeQuoteDatafailed because the returned quote usedAddressZerofordestAsset.address.Fix: Extracted the existing normalization logic from
useTokenAddressinto a reusable pure functionnormalizeTokenAddress,and applied it in
useTokensWithBalancewhen buildingBridgeTokenobjects from wallet state. This ensures POL enters the bridge flow with
AddressZerofrom the start, fixing both the duplicate listing and thequote/rate mismatch.
Changelog
CHANGELOG entry: Fixed a bug where Polygon's native token (POL) appeared
twice in the bridge token selector and selecting it showed incorrect
quote data.
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Docs and MetaMask Mobile
Coding
Standards.
if applicable
guidelines).
Not required for external contributors.
Pre-merge reviewer checklist
app, test code being changed).
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
Note
Medium Risk
Medium risk because it changes how token addresses are represented in
the bridge token list and downstream API/quote matching, which could
affect token identification on Polygon. Scope is small and isolated to
bridge token normalization.
Overview
Fixes Polygon native token (POL) handling in the bridge UI by
normalizing Polygon’s non-zero native token address to the zero address
the bridge API expects.
Extracts the Polygon-specific normalization from
useTokenAddressinto a reusable
normalizeTokenAddressutility and applies it whenconstructing tokens in
useTokensWithBalance, preventing duplicate POLentries and quote mismatches caused by inconsistent native-address
representations.
Written by Cursor
Bugbot for commit
b0deef0. This will update automatically
on new commits. Configure
here.