Skip to content

chore(perps): update controller and extension integration support#41854

Closed
abretonc7s wants to merge 1 commit into
mainfrom
fix/tat-2699-controller-decimal-base
Closed

chore(perps): update controller and extension integration support#41854
abretonc7s wants to merge 1 commit into
mainfrom
fix/tat-2699-controller-decimal-base

Conversation

@abretonc7s

@abretonc7s abretonc7s commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Description

This PR is the clean non-UI base branch for the perps controller upgrade in TAT-2699.

It upgrades the extension to @metamask/perps-controller@3.1.1 and keeps only the non-UI integration support required for that upgrade (StorageService wiring, Jest support, and LavaMoat updates).

All user-facing perps decimal/display changes were split out to the stacked PR #41853.

Changelog

CHANGELOG entry: null

Related issues

Fixes: TAT-2699

Related:

Manual testing steps

  1. Verify the extension builds with @metamask/perps-controller@3.1.1.
  2. Verify the perps controller initializes correctly in extension.
  3. Verify the non-UI integration changes (StorageService, Jest support, LavaMoat) behave as expected.
  4. Run the targeted non-UI validation for infrastructure/init.

Screenshots/Recordings

Before

N/A for this non-UI base PR. UI-facing screenshot evidence lives in #41853.

After

N/A for this non-UI base PR. UI-facing screenshot evidence lives in #41853.

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.

Create a clean base branch from current main that contains only the perps controller upgrade, decimal-logic changes, and required non-UI integration support so the UI formatting work can live entirely on the stacked branch.

Constraint: Base PR must contain no ui/ changes at all
Rejected: Continue using the original long-lived branch as PR A | three-dot history still surfaces UI files without a force-push or a replacement PR
Confidence: high
Scope-risk: moderate
Directive: Keep this branch non-UI; all ui/ changes should stack on top in the formatting branch
Tested: Targeted Jest for perps infrastructure + perps-controller-init; ESLint on touched non-UI files
Not-tested: Full repo-wide CI and full branch-wide validation
@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.

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​metamask/​perps-controller@​3.0.0 ⏵ 3.1.169 -110083 +196 +1100
Updated@​metamask/​profile-metrics-controller@​3.0.4 ⏵ 3.0.3991007595100
Updated@​metamask/​notification-services-controller@​23.1.0 ⏵ 22.0.099 +11008895 -2100

View full report

@metamaskbotv2

metamaskbotv2 Bot commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

✨ Files requiring CODEOWNER review ✨

👨‍🔧 @MetaMask/perps (2 files, +168 -27)
  • 📁 app/
    • 📁 scripts/
      • 📁 controllers/
        • 📁 perps/
          • 📄 infrastructure.test.ts +109 -5
          • 📄 infrastructure.ts +59 -22

📜 @MetaMask/policy-reviewers (12 files, +40 -84)
  • 📁 lavamoat/
    • 📁 browserify/
      • 📁 beta/
        • 📄 policy.json +2 -10
      • 📁 experimental/
        • 📄 policy.json +2 -10
      • 📁 flask/
        • 📄 policy.json +2 -10
      • 📁 main/
        • 📄 policy.json +2 -10
    • 📁 webpack/
      • 📁 mv2/
        • 📁 beta/
          • 📄 policy.json +2 -10
        • 📁 experimental/
          • 📄 policy.json +2 -10
        • 📁 flask/
          • 📄 policy.json +2 -10
        • 📁 main/
          • 📄 policy.json +2 -10
      • 📁 mv3/
        • 📁 beta/
          • 📄 policy.json +6 -1
        • 📁 experimental/
          • 📄 policy.json +6 -1
        • 📁 flask/
          • 📄 policy.json +6 -1
        • 📁 main/
          • 📄 policy.json +6 -1

Tip

Follow the policy review process outlined in the LavaMoat Policy Review Process doc before expecting an approval from Policy Reviewers.

@abretonc7s abretonc7s changed the title fix(perps): update controller and decimal logic chore(perps): update controller and extension integration support Apr 16, 2026

@MajorLift MajorLift 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.

Extension platform is working hard to speed up CI and these changes would slow it down significantly for little to no added value.

As discussed, the test fail can be fixed simply by mocking @metamask/perps-controller in app/scripts/controllers/perps/infrastructure.test.ts (some accompanying changes to tests may be needed):

jest.mock('@metamask/perps-controller', () => ({
  formatPerpsFiat: jest.fn((value: number) => `$${value.toFixed(2)}`),
  formatPercentage: jest.fn((percent: number) => `+${percent.toFixed(2)}%`),
  PRICE_RANGES_UNIVERSAL: [{ threshold: 0, decimals: 2 }],
}));

See thread: https://github.com/MetaMask/metamask-extension/pull/41558/files#r3094208429

Comment thread jest.config.js
Comment on lines +80 to +82
transformIgnorePatterns: [
'/node_modules/(?!(?:@metamask/perps-controller|@nktkas/hyperliquid|@noble|micro-eth-signer|micro-packed|@scure)/)',
],

@MajorLift MajorLift Apr 16, 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.

Suggested change
transformIgnorePatterns: [
'/node_modules/(?!(?:@metamask/perps-controller|@nktkas/hyperliquid|@noble|micro-eth-signer|micro-packed|@scure)/)',
],

Comment on lines +71 to +73
transformIgnorePatterns: [
'/node_modules/(?!(?:@metamask/perps-controller|@nktkas/hyperliquid|@noble|micro-eth-signer|micro-packed|@scure)/)',
],

@MajorLift MajorLift Apr 16, 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.

No integration tests are even affected. There's just no reason for this.

Suggested change
transformIgnorePatterns: [
'/node_modules/(?!(?:@metamask/perps-controller|@nktkas/hyperliquid|@noble|micro-eth-signer|micro-packed|@scure)/)',
],

@MajorLift

Copy link
Copy Markdown
Contributor

@metamaskbot update-policies

@metamaskbot

Copy link
Copy Markdown
Collaborator

Policy update failed. You can review the logs or retry the policy update here

@abretonc7s

Copy link
Copy Markdown
Contributor Author

Superseded by #41558 (merged) and #41855 (active UI PR). Closing the duplicate split attempt.

@abretonc7s abretonc7s closed this Apr 18, 2026
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.

3 participants