Skip to content

fix(perps): Adjust incorrect market categories#27910

Merged
abretonc7s merged 6 commits into
mainfrom
fix/perps/tat-2499-0325-1917
Mar 26, 2026
Merged

fix(perps): Adjust incorrect market categories#27910
abretonc7s merged 6 commits into
mainfrom
fix/perps/tat-2499-0325-1917

Conversation

@abretonc7s

@abretonc7s abretonc7s commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Description

URNM (Sprott Uranium Miners ETF) was listed as 'equity' in HIP3_ASSET_MARKET_TYPES when it should be 'commodity', and USAR (US equity fund) was listed as 'commodity' when it should be 'equity'. This caused both instruments to appear under the wrong filter tab and display the wrong badge. Fixed by correcting the two values in the config constant — the single source of truth for HIP-3 market classification.

Changelog

CHANGELOG entry: Fixed incorrect market category assignments for URNM (now Commodity) and USAR (now Stock) in the Perps market list.

Related issues

Fixes: TAT-2499

Manual testing steps

Feature: Market category filter tabs
  Scenario: URNM appears under Commodities
    Given I am on the Perps market list
    When I tap the "Commodities" filter tab
    Then URNM should appear in the list with a COMMODITY badge

  Scenario: USAR appears under Stocks
    Given I am on the Perps market list
    When I tap the "Stocks" filter tab
    Then USAR should appear in the list with a STOCK badge

  Scenario: URNM does not appear under Stocks
    Given I am on the Perps market list
    When I tap the "Stocks" filter tab
    Then URNM should NOT be visible

  Scenario: USAR does not appear under Commodities
    Given I am on the Perps market list
    When I tap the "Commodities" filter tab
    Then USAR should NOT be visible

Screenshots/Recordings

Before

See .task/fix/tat-2499-0325-1917/artifacts/before.mp4

After

See .task/fix/tat-2499-0325-1917/artifacts/after.mp4

Validation Recipe

Automated validation recipe (validate-recipe.sh)
{
  "pr": "27910",
  "title": "URNM and USAR market categories corrected",
  "jira": "TAT-2499",
  "acceptance_criteria": [
    "URNM is categorised as commodity (not equity)",
    "USAR is categorised as equity/stock (not commodity)",
    "Fix is at the config layer, not UI layer"
  ],
  "validate": {
    "static": ["yarn lint:tsc"],
    "runtime": {
      "pre_conditions": ["wallet.unlocked", "perps.feature_enabled"],
      "steps": [
        {
          "id": "nav-market-list",
          "description": "Navigate to market trending list",
          "action": "navigate",
          "target": "PerpsTrendingView"
        },
        {
          "id": "wait-market-list",
          "description": "Wait for market list route to be active",
          "action": "wait_for",
          "route": "PerpsTrendingView"
        },
        {
          "id": "assert-urnm-is-commodity",
          "description": "Assert URNM has marketType=commodity in controller state (the fix)",
          "action": "eval_async",
          "expression": "Engine.context.PerpsController.getMarketDataWithPrices().then(function(markets){var urnm=markets.find(function(market){return market.symbol==='xyz:URNM'});return JSON.stringify({found:!!urnm,marketType:urnm?urnm.marketType:null})})",
          "assert": {
            "operator": "eq",
            "field": "marketType",
            "value": "commodity"
          }
        },
        {
          "id": "assert-usar-is-equity",
          "description": "Assert USAR has marketType=equity in controller state (the fix)",
          "action": "eval_async",
          "expression": "Engine.context.PerpsController.getMarketDataWithPrices().then(function(markets){var usar=markets.find(function(market){return market.symbol==='xyz:USAR'});return JSON.stringify({found:!!usar,marketType:usar?usar.marketType:null})})",
          "assert": {
            "operator": "eq",
            "field": "marketType",
            "value": "equity"
          }
        },
        {
          "id": "nav-commodities-filter",
          "description": "Select Commodities filter tab to verify URNM appears there",
          "action": "flow_ref",
          "ref": "market-discovery",
          "params": {
            "symbol": "xyz:URNM",
            "category": "commodities"
          }
        },
        {
          "id": "assert-urnm-badge-commodity",
          "description": "Verify URNM badge shows commodity type in market detail",
          "action": "eval_async",
          "expression": "Engine.context.PerpsController.getMarketDataWithPrices().then(function(markets){var urnm=markets.find(function(market){return market.symbol==='xyz:URNM'});return JSON.stringify({found:!!urnm,marketType:urnm?urnm.marketType:null,isHip3:urnm?urnm.isHip3:null})})",
          "assert": {
            "operator": "eq",
            "field": "marketType",
            "value": "commodity"
          }
        },
        {
          "id": "nav-stocks-filter",
          "description": "Select Stocks filter tab to verify USAR appears there",
          "action": "flow_ref",
          "ref": "market-discovery",
          "params": {
            "symbol": "xyz:USAR",
            "category": "stocks"
          }
        },
        {
          "id": "assert-usar-badge-equity",
          "description": "Verify USAR badge shows equity type in market detail",
          "action": "eval_async",
          "expression": "Engine.context.PerpsController.getMarketDataWithPrices().then(function(markets){var usar=markets.find(function(market){return market.symbol==='xyz:USAR'});return JSON.stringify({found:!!usar,marketType:usar?usar.marketType:null,isHip3:usar?usar.isHip3:null})})",
          "assert": {
            "operator": "eq",
            "field": "marketType",
            "value": "equity"
          }
        },
        {
          "id": "screenshot-final",
          "description": "Capture final state for human review",
          "action": "screenshot",
          "filename": "after-fix-usar-in-stocks"
        }
      ]
    }
  }
}

Pre-merge author checklist

  • I've followed MetaMask Contributor Docs and Coding Standards
  • I've completed the PR template to the best of my ability
  • I've included tests if applicable
  • I've documented my code using JSDoc format if applicable
  • I've applied the right labels on the PR

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

Low Risk
Low risk: updates two static HIP3_ASSET_MARKET_TYPES entries and adds a small unit test to prevent regressions; no runtime logic or security-sensitive code changes.

Overview
Fixes HIP-3 perps market classification by swapping the HIP3_ASSET_MARKET_TYPES mappings for xyz:URNM (now commodity) and xyz:USAR (now equity), which affects filter tabs and badges.

Adds hyperLiquidConfig.test.ts to assert correct market-type mappings for these symbols and a few representative equity/commodity/forex entries.

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

@abretonc7s abretonc7s added DO-NOT-MERGE Pull requests that should not be merged team-perps Perps team labels Mar 25, 2026
@github-actions

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.

@abretonc7s

Copy link
Copy Markdown
Contributor Author

Bug Fix Report — TAT-2499

Summary

URNM (Sprott Uranium Miners ETF) was incorrectly categorised as an equity/stock, causing it to appear under the Stocks filter tab instead of Commodities. USAR (a US equity fund) was incorrectly categorised as a commodity, causing it to appear under the Commodities tab instead of Stocks. Two character-level value corrections in the HIP3_ASSET_MARKET_TYPES config map fix both misclassifications.

Root Cause

File: app/controllers/perps/constants/hyperLiquidConfig.ts

Lines 343 and 358 in the HIP3_ASSET_MARKET_TYPES constant had URNM and USAR swapped:

// BEFORE (buggy):
'xyz:URNM': 'equity',    // line 343 — wrong, should be commodity
...
'xyz:USAR': 'commodity', // line 358 — wrong, should be equity

// AFTER (fixed):
'xyz:URNM': 'commodity', // Sprott Uranium Miners ETF — commodity
...
'xyz:USAR': 'equity',    // US equity fund — equity/stock

Data flow: HIP3_ASSET_MARKET_TYPES is the single source of truth for HIP-3 market classification. It is imported in HyperLiquidProvider.ts and passed to transformMarketData() (in app/controllers/perps/utils/marketDataTransform.ts), which stamps each market's marketType field. That field drives: (1) filter tab grouping on the market list screen, (2) badge display (STOCK/COMMODITY) on market detail screens, and (3) Explore section grouping on Perps Home.

Reproduction Commit

SHA: 172cd34c3cdebug(pr-27910): add reproduction marker

Metro log excerpt (pre-fix — bug confirmed):

(NOBRIDGE) DEBUG  [PR-27910] BUG_MARKER: URNM marketType=equity (expected commodity), USAR marketType=commodity (expected equity)

Metro log excerpt (post-fix — correct):

(NOBRIDGE) DEBUG  [PR-27910] BUG_MARKER: URNM marketType=commodity (expected commodity), USAR marketType=equity (expected equity)

Changes

File Change
app/controllers/perps/constants/hyperLiquidConfig.ts Fixed xyz:URNM from 'equity''commodity' and xyz:USAR from 'commodity''equity'
app/controllers/perps/constants/hyperLiquidConfig.test.ts New test file — 5 tests asserting correct classification of URNM, USAR, and spot-checking other known equities/commodities/forex

Test Plan

Automated

  • Tests: yarn jest app/controllers/perps/constants/hyperLiquidConfig.test.ts --no-coverage → 5/5 PASS
  • Lint: yarn lint:fix → no errors
  • TypeScript: No new type errors introduced
  • Recipe: validate-recipe.sh .task/fix/tat-2499-0325-1917/artifacts/ → 9/9 PASS
    • assert-urnm-is-commodity: marketType=commodity
    • assert-usar-is-equity: marketType=equity
    • nav-commodities-filter: URNM found in commodities filter ✅
    • nav-stocks-filter: USAR found in stocks filter ✅

Manual Gherkin

Feature: Market category filter tabs
  Scenario: URNM appears under Commodities
    Given I am on the Perps market list
    When I tap the "Commodities" filter tab
    Then URNM should appear in the list
    And URNM should display a COMMODITY badge

  Scenario: USAR appears under Stocks
    Given I am on the Perps market list
    When I tap the "Stocks" filter tab
    Then USAR should appear in the list
    And USAR should display a STOCK badge

  Scenario: URNM does not appear under Stocks
    Given I am on the Perps market list
    When I tap the "Stocks" filter tab
    Then URNM should NOT appear in the list

  Scenario: USAR does not appear under Commodities
    Given I am on the Perps market list
    When I tap the "Commodities" filter tab
    Then USAR should NOT appear in the list

Evidence

  • Before video: .task/fix/tat-2499-0325-1917/artifacts/before.mp4 — recipe fails on assert-urnm-is-commodity (returns equity)
  • After video: .task/fix/tat-2499-0325-1917/artifacts/after.mp4 — recipe passes 9/9

Ticket

@abretonc7s abretonc7s marked this pull request as ready for review March 25, 2026 12:03
@abretonc7s abretonc7s requested a review from a team as a code owner March 25, 2026 12:03

@cursor cursor Bot left a comment

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.

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.

Comment thread app/controllers/perps/constants/hyperLiquidConfig.ts Outdated
Fixes section comment mismatch flagged by cursor[bot] (comment #2987753819).
URNM (commodity) was listed among equity entries; USAR (equity) was listed
under the commodities section comment. Moved both to their correct sections.
@github-actions github-actions Bot added the risk-low Low testing needed · Low bug introduction risk label Mar 26, 2026
@abretonc7s abretonc7s removed the DO-NOT-MERGE Pull requests that should not be merged label Mar 26, 2026
@abretonc7s abretonc7s enabled auto-merge March 26, 2026 07:32
@github-actions github-actions Bot added risk-low Low testing needed · Low bug introduction risk and removed risk-low Low testing needed · Low bug introduction risk labels Mar 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePerps, SmokeWalletPlatform, SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 92%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are limited to two asset classification corrections in the HIP3_ASSET_MARKET_TYPES static configuration map within the Perps controller:

  1. 'xyz:URNM' reclassified from 'equity' to 'commodity' (Sprott Uranium Miners ETF)
  2. 'xyz:USAR' reclassified from 'commodity' to 'equity' (US equity fund)

A new unit test file (hyperLiquidConfig.test.ts) was added to verify these classifications.

These are data-only corrections with no structural, API, or UI changes. The constants are used by HyperLiquidProvider.ts for market type classification in the Perps feature. SmokePerps is selected as the primary tag since this directly affects Perps market data. Per SmokePerps tag dependencies, SmokeWalletPlatform (Trending section embeds Perps) and SmokeConfirmations (Add Funds deposits are on-chain transactions) are also required.

Performance Test Selection:
Static configuration constant changes (data-only corrections to asset type classifications) have no performance impact. No UI rendering, state management, or data loading changes were made.

View GitHub Actions results

@github-actions

Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
18 value mismatches detected (expected — fixture represents an existing user).
View details

@sonarqubecloud

Copy link
Copy Markdown

@abretonc7s abretonc7s added this pull request to the merge queue Mar 26, 2026
Merged via the queue into main with commit 0978f3f Mar 26, 2026
100 checks passed
@abretonc7s abretonc7s deleted the fix/perps/tat-2499-0325-1917 branch March 26, 2026 14:50
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 26, 2026
@metamaskbot metamaskbot added the release-7.72.0 Issue or pull request that will be included in release 7.72.0 label Mar 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.72.0 Issue or pull request that will be included in release 7.72.0 risk-low Low testing needed · Low bug introduction risk size-S team-perps Perps team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants