Skip to content

feat: Integrate perps infrastructure and streaming bridge#40769

Merged
aganglada merged 78 commits intomainfrom
feat/integrate-perps-controller-infrastructure-stream
Mar 20, 2026
Merged

feat: Integrate perps infrastructure and streaming bridge#40769
aganglada merged 78 commits intomainfrom
feat/integrate-perps-controller-infrastructure-stream

Conversation

@gambinish
Copy link
Copy Markdown
Member

@gambinish gambinish commented Mar 10, 2026

Description

This PR is scoped to the controller infrastructure and streaming bridge layer of the Perps integration. It builds on a prerequisite PR that installed @metamask/perps-controller and removed the local development alias — this PR assumes the real package is already present.

Broken out from intitial feature branch PR: #40078

Controller infrastructure (app/scripts/controllers/perps/):

  • infrastructure.ts — wires platform-specific dependencies (KeyringController signing, MetaMetrics, Sentry, performance monitoring) for injection into PerpsController
  • perps-stream-bridge.ts — per-UI-connection WebSocket subscription lifecycle manager; bridges background controller streams to the UI outStream and tears down cleanly on disconnect, testnet toggle, or stream end
  • infrastructure.test.ts + perps-stream-bridge.test.ts — comprehensive unit test coverage

Controller registration (app/scripts/metamask-controller.js):

  • PerpsControllerInit registered via app/scripts/controller-init/perps-controller-init.ts
  • Messenger defined in app/scripts/controller-init/messengers/perps-controller-messenger.ts
  • Background API surface exposed: perpsInit, streaming activation, trading/data methods, preference helpers

Related PRs:

Open in GitHub Codespaces

Changelog

CHANGELOG entry: Integrates perps controller v1 with messenger streams and API

Related issues

Fixes:

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

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
Adds a new background controller, RPC surface, and WebSocket streaming bridge gated by PERPS_ENABLED, which can impact controller initialization and connection lifecycle if misconfigured. Risk is mitigated by compile-time gating, conservative eligibility checks, and extensive unit tests around init/stream teardown.

Overview
Introduces a build-time PERPS_ENABLED gate for Perps support and wires PerpsController into controller initialization only when enabled, including default env/build config updates.

Adds PerpsControllerInit plus a restricted PerpsController messenger and background API mapping (most methods delegate directly; perpsDepositWithConfirmation returns lastDepositTransactionId, and perpsGetUserHistory proxies to the active provider). Eligibility monitoring is started/stopped based on PreferencesController.useExternalServices and network request lifecycle.

Adds createPerpsInfrastructure (logger/Sentry hook, version-gated feature flags, formatting helpers, and stubbed metrics/tracing/cache/rewards) and a PerpsStreamBridge that manages per-UI-connection static/dynamic subscriptions and emits perpsStreamUpdate messages only while the perps view is active.

Updates build/tooling to accommodate perps dependencies (Lavamoat policies, sourcemap validator skip for perps dynamic import(), webpack warning ignore, additional ignored module patterns), bumps @metamask/perps-controller to ^1.3.0, and updates tests/fixtures to include PerpsController state where applicable.

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

@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Mar 10, 2026

✨ Files requiring CODEOWNER review ✨

👨‍🔧 @MetaMask/extension-platform (4 files, +24 -0)
  • 📁 development/
    • 📁 build/
      • 📄 scripts.js +1 -0
      • 📄 set-environment-variables.js +1 -0
    • 📁 webpack/
      • 📄 sourcemap-validator.ts +19 -0
      • 📄 webpack.config.ts +3 -0

👨‍🔧 @MetaMask/perps (4 files, +1335 -0)
  • 📁 app/
    • 📁 scripts/
      • 📁 controllers/
        • 📁 perps/
          • 📄 infrastructure.test.ts +79 -0
          • 📄 infrastructure.ts +170 -0
          • 📄 perps-stream-bridge.test.ts +763 -0
          • 📄 perps-stream-bridge.ts +323 -0

📜 @MetaMask/policy-reviewers (8 files, +912 -0)
  • 📁 lavamoat/
    • 📁 browserify/
      • 📁 beta/
        • 📄 policy.json +129 -0
      • 📁 experimental/
        • 📄 policy.json +129 -0
      • 📁 flask/
        • 📄 policy.json +129 -0
      • 📁 main/
        • 📄 policy.json +129 -0
    • 📁 webpack/
      • 📁 mv2/
        • 📁 beta/
          • 📄 policy.json +99 -0
        • 📁 experimental/
          • 📄 policy.json +99 -0
        • 📁 flask/
          • 📄 policy.json +99 -0
        • 📁 main/
          • 📄 policy.json +99 -0

Tip

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


👨‍🔧 @itsyoboieltr (4 files, +24 -0)
  • 📁 development/
    • 📁 build/
      • 📄 scripts.js +1 -0
      • 📄 set-environment-variables.js +1 -0
    • 📁 webpack/
      • 📄 sourcemap-validator.ts +19 -0
      • 📄 webpack.config.ts +3 -0

aganglada
aganglada previously approved these changes Mar 10, 2026
@gambinish gambinish force-pushed the feat/integrate-perps-controller-infrastructure-stream branch from d9da503 to bf9f17c Compare March 10, 2026 20:51
@gambinish gambinish requested a review from Gudahtt March 10, 2026 21:07
@gambinish gambinish changed the title feat: integrate perps infrastructure and streaming bridge feat: Integrate perps infrastructure and streaming bridge Mar 10, 2026
@gambinish gambinish requested a review from aganglada March 10, 2026 21:10
Gudahtt
Gudahtt previously approved these changes Mar 19, 2026
Copy link
Copy Markdown
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

aganglada
aganglada previously approved these changes Mar 19, 2026
@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Mar 19, 2026

Builds ready [445be1c]
⚡ Performance Benchmarks
👆 Interaction Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Load New Accountload_new_account28227029110289291
total28227029110289291
Confirm Txconfirm_tx6043603360641360406064
total6043603360641360406064
Bridge User Actionsbridge_load_page24223125510250255
bridge_load_asset_picker2602482647264264
bridge_search_token7617547665765766
total1259124512721212701272
🔌 Startup Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Standard HomeuiStartup14901244197211815301685
load12341027169010312671411
domContentLoaded12271022164510012551405
domInteractive31171242426101
firstPaint174711235166214366
backgroundConnect22219746928226241
firstReactRender20133962232
initialActions103113
loadScripts102381914339810531195
setupStore1477581524
numNetworkReqs393186163777
Power User HomeuiStartup5868209718305290766349054
load13611187196514713991671
domContentLoaded13391174193113913741652
domInteractive43212654635111
firstPaint225911943192285333
backgroundConnect227834114404274333285908
firstReactRender26174952737
initialActions105113
loadScripts1105955165312911281381
setupStore1765282029
numNetworkReqs2349138660271333
🧭 User Journey Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Onboarding Import WalletimportWalletToSocialScreen2192182200219220
srpButtonToSrpForm96929929899
confirmSrpToPwForm23222412424
pwFormToMetricsScreen16161701717
metricsToWalletReadyScreen16151711717
doneButtonToHomeScreen63053472479722724
openAccountMenuToAccountListLoaded3046292931519631133151
total40473875420611141204206
Onboarding New WalletcreateWalletToSocialScreen2182172180218218
srpButtonToPwForm1121091194113119
createPwToRecoveryScreen989099
skipBackupToMetricsScreen38374123941
agreeButtonToOnboardingSuccess16161711717
doneButtonToAssetList56349567874578678
total91172510671159891067
Asset DetailsassetClickToPriceChart50485125151
total50485125151
Solana Asset DetailsassetClickToPriceChart1083618460164184
total1083618460164184
Import Srp HomeloginToHomeScreen2349220724569123842456
openAccountMenuAfterLogin594786165386
homeAfterImportWithNewWallet15952562614102323542614
total411127615504111248825504
Send TransactionsopenSendPageFromHome27193562835
selectTokenToSendFormLoaded33274363443
reviewTransactionToConfirmationPage994848113912111291139
total1074910125613611931256
SwapopenSwapPageFromHome1394220757181207
fetchAndDisplaySwapQuotes2693268127141226992714
total2859282128882528682888
🌐 Dapp Page Load Benchmarks

Current Commit: 445be1c | Date: 3/19/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.06s (±45ms) 🟡 | historical mean value: 1.04s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 745ms (±41ms) 🟢 | historical mean value: 732ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 81ms (±10ms) 🟢 | historical mean value: 85ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.06s 45ms 1.03s 1.37s 1.11s 1.37s
domContentLoaded 745ms 41ms 722ms 1.04s 784ms 1.04s
firstPaint 81ms 10ms 64ms 160ms 96ms 160ms
firstContentfulPaint 81ms 10ms 64ms 160ms 96ms 160ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.12 MiB (21.68%)
  • ui: 36.12 KiB (0.42%)
  • common: 18.34 KiB (0.16%)

assetsUnifyFlag,
ASSETS_UNIFY_STATE_VERSION_1,
);
const shouldInitPerpsController = isPerpsFeatureEnabled(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot conditionally instantiate the controller using a remote feature flag. The shape of our controller state cannot change at runtime, but feature flags can.

Copy link
Copy Markdown
Member

@Gudahtt Gudahtt Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use a build flag for something like this, but not a remote flag that can change at runtime.

For runtime changes you could disable the controller conditionally but we need to instantiate it at least.

Copy link
Copy Markdown
Member Author

@gambinish gambinish Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've refactored this to initialize the controller conditionally based on the PERPS_ENABLED build flag here: 4b6042d

This turned out a bit more complicated than I initially thought. We now have 2 main guards in place:

  1. Build flag PERPS_ENABLED that prevents the controller from initializing during build time in designated environments.
  2. Remote flag perpsEnabled that prevents the UI from rendering at run time, controlled by LaunchDarkly

We definitely don't want the UI to render if the build time flag is false, and the controller isn't initialized. It probably doesn't matter as much in the inverse scenario, where the UI is hidden but we initialize the controller. The newly renamed getIsPerpsExperienceAvailable selector gates on both.

On that note, these flags were annoyingly similar in naming conventions, and hard to distinguish which is used where. So, this commit also includes changes to rename some of our selectors and helpers to hopefully make this more clear.

This caused a larger file diff and more codeowners, but I think it made sense to do it.

@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Mar 19, 2026

Builds ready [a646f34]
⚡ Performance Benchmarks
👆 Interaction Benchmarks
🧭 User Journey Benchmarks

⚠️ Missing data: chrome/browserify/userJourneyAssets, chrome/browserify/userJourneyTransactions

🌐 Dapp Page Load Benchmarks

Current Commit: a646f34 | Date: 3/19/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.03s (±41ms) 🟡 | historical mean value: 1.05s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 726ms (±39ms) 🟢 | historical mean value: 741ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 79ms (±11ms) 🟢 | historical mean value: 86ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.03s 41ms 1.01s 1.35s 1.07s 1.35s
domContentLoaded 726ms 39ms 701ms 1.03s 755ms 1.03s
firstPaint 79ms 11ms 64ms 172ms 92ms 172ms
firstContentfulPaint 79ms 11ms 64ms 172ms 92ms 172ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.12 MiB (19.51%)
  • ui: 13 Bytes (0%)
  • common: -16 Bytes (0%)

@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Mar 19, 2026

Builds ready [ae702a9]
⚡ Performance Benchmarks
👆 Interaction Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Load New Accountload_new_account27626228810281288
total27626228810281288
Confirm Txconfirm_tx603260196043960386043
total603260196043960386043
Bridge User Actionsbridge_load_page24121627021260270
bridge_load_asset_picker2412372484242248
bridge_search_token7537477585758758
total1233120712672712651267
🔌 Startup Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Standard HomeuiStartup14971222192011015491697
load1239101515179412921422
domContentLoaded1231100915089212851404
domInteractive3018128202684
firstPaint167721273136220321
backgroundConnect22120427012224249
firstReactRender21126882235
initialActions107113
loadScripts102680813029210771193
setupStore1373961726
numNetworkReqs393186164077
Power User HomeuiStartup5784225613329203665418771
load13251184182713713531633
domContentLoaded13041158179513013301596
domInteractive40202413536115
firstPaint211851609161269320
backgroundConnect18223149988184728814897
firstReactRender25185462636
initialActions107113
loadScripts1072933153412110961365
setupStore1675581835
numNetworkReqs19112333442210285
🧭 User Journey Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Onboarding Import WalletimportWalletToSocialScreen2222182253225225
srpButtonToSrpForm9793100299100
confirmSrpToPwForm23222302323
pwFormToMetricsScreen16151601616
metricsToWalletReadyScreen17161711717
doneButtonToHomeScreen53751156419548564
openAccountMenuToAccountListLoaded3033292031098831063109
total39453823404710040324047
Onboarding New WalletcreateWalletToSocialScreen2202172222222222
srpButtonToPwForm1101081132110113
createPwToRecoveryScreen981211012
skipBackupToMetricsScreen41394324243
agreeButtonToOnboardingSuccess18162121821
doneButtonToAssetList474299683143563683
total88469210721309581072
Asset DetailsassetClickToPriceChart655174107374
total655174107374
Solana Asset DetailsassetClickToPriceChart985116045140160
total985116045140160
Import Srp HomeloginToHomeScreen24552270284721625282847
openAccountMenuAfterLogin654981127581
homeAfterImportWithNewWallet35026544464356444
total29152682327822429113278
Send TransactionsopenSendPageFromHome28223552935
selectTokenToSendFormLoaded35284153941
reviewTransactionToConfirmationPage1032854129317511861293
total1099912134317212621343
SwapopenSwapPageFromHome813112233104122
fetchAndDisplaySwapQuotes269226832704826992704
total2773272228063528032806
🌐 Dapp Page Load Benchmarks

Current Commit: ae702a9 | Date: 3/19/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.09s (±77ms) 🟡 | historical mean value: 1.05s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 776ms (±75ms) 🟢 | historical mean value: 742ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 85ms (±10ms) 🟢 | historical mean value: 87ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.09s 77ms 1.05s 1.40s 1.33s 1.40s
domContentLoaded 776ms 75ms 734ms 1.07s 1.01s 1.07s
firstPaint 85ms 10ms 68ms 160ms 96ms 160ms
firstContentfulPaint 85ms 10ms 68ms 160ms 96ms 160ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.12 MiB (19.51%)
  • ui: 13 Bytes (0%)
  • common: -6.87 KiB (-0.06%)

"mainnet": false,
"testnet": false
},
"hip3ConfigVersion": 1,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E2E fixture has wrong hip3ConfigVersion default value

Low Severity

The hip3ConfigVersion in default-fixture.json is set to 1, while the onboarding-fixture.json and the unit test mock for getDefaultPerpsControllerState both use 0. Since both fixtures represent initial PerpsController state and the controller's default state function returns 0, the default fixture likely has an incorrect value. This inconsistency could cause E2E tests using the default fixture to operate with non-default state, potentially masking bugs related to hip3 config version handling.

Additional Locations (1)
Fix in Cursor Fix in Web

@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Mar 19, 2026

Builds ready [4b6042d]
⚡ Performance Benchmarks
👆 Interaction Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Load New Accountload_new_account33426648991308489
total33426648991308489
Confirm Txconfirm_tx6074604261022360976102
total6074604261022360976102
Bridge User Actionsbridge_load_page26524528920289289
bridge_load_asset_picker25220729530263295
bridge_search_token77075779113771791
total1279125413092112981309
🔌 Startup Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Standard HomeuiStartup15101251204111615701679
load12591019170411013341419
domContentLoaded12501012166410713291411
domInteractive3117140242694
firstPaint169741220160214354
backgroundConnect22920633318235262
firstReactRender20135462131
initialActions105123
loadScripts1039810144710711131197
setupStore1473451722
numNetworkReqs393191163780
Power User HomeuiStartup5795190818178260375389625
load13701197184714814011705
domContentLoaded13501186179714013791660
domInteractive41222233335110
firstPaint259981680231286444
backgroundConnect208731114690201927525089
firstReactRender26174562738
initialActions105113
loadScripts1108958149912911421406
setupStore216412401935
numNetworkReqs1425127044159239
🧭 User Journey Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Onboarding Import WalletimportWalletToSocialScreen2182162201219220
srpButtonToSrpForm94949409494
confirmSrpToPwForm21212202222
pwFormToMetricsScreen15151601516
metricsToWalletReadyScreen16151601616
doneButtonToHomeScreen5165115224522522
openAccountMenuToAccountListLoaded2922291029421229222942
total3810378938361938193836
Onboarding New WalletcreateWalletToSocialScreen2192182201220220
srpButtonToPwForm1101081121111112
createPwToRecoveryScreen989099
skipBackupToMetricsScreen39394114041
agreeButtonToOnboardingSuccess17161701717
doneButtonToAssetList50549053718498537
total90088793420892934
Asset DetailsassetClickToPriceChart834114337104143
total834114337104143
Solana Asset DetailsassetClickToPriceChart1196516841161168
total1196516841161168
Import Srp HomeloginToHomeScreen2396237424182124162418
openAccountMenuAfterLogin58536545765
homeAfterImportWithNewWallet41532650766436507
total29372759310112329773101
Send TransactionsopenSendPageFromHome32224793747
selectTokenToSendFormLoaded32313413434
reviewTransactionToConfirmationPage1101871145722712791457
total1171935150121313341501
SwapopenSwapPageFromHome1015714429116144
fetchAndDisplaySwapQuotes269526882708826992708
total279627922805628052805
🌐 Dapp Page Load Benchmarks

Current Commit: 4b6042d | Date: 3/19/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.04s (±41ms) 🟡 | historical mean value: 1.05s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 731ms (±39ms) 🟢 | historical mean value: 739ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 80ms (±10ms) 🟢 | historical mean value: 85ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.04s 41ms 1.02s 1.35s 1.07s 1.35s
domContentLoaded 731ms 39ms 711ms 1.02s 756ms 1.02s
firstPaint 80ms 10ms 64ms 168ms 88ms 168ms
firstContentfulPaint 80ms 10ms 64ms 168ms 88ms 168ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.12 MiB (19.51%)
  • ui: 248 Bytes (0%)
  • common: -6.75 KiB (-0.06%)

Copy link
Copy Markdown

@cursor cursor bot left a comment

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.

There are 4 total unresolved issues (including 3 from previous reviews).

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.

@sonarqubecloud
Copy link
Copy Markdown

Comment on lines +20 to +24
export const getIsPerpsExperienceAvailable = createSelector(
getRemoteFeatureFlags,
(remoteFeatureFlags) =>
isPerpsFeatureEnabled(remoteFeatureFlags.perpsEnabledVersion),
getIsPerpsIncludedInBuild() &&
isPerpsRemoteConfigSatisfied(remoteFeatureFlags.perpsEnabledVersion),
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This selector is what we would use in the UI to not render until both the controller is initialized and the remote flag is true

@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Mar 19, 2026

Builds ready [224d079]
⚡ Performance Benchmarks
👆 Interaction Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Load New Accountload_new_account32028136533336365
total32028136533336365
Confirm Txconfirm_tx6049600860882960756088
total6049600860882960756088
Bridge User Actionsbridge_load_page21419923112226231
bridge_load_asset_picker2572472698259269
bridge_search_token75774877511754775
total1227121712481212251248
🔌 Startup Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Standard HomeuiStartup14951262208111315401693
load12381036174610112711402
domContentLoaded1231103217399912641388
domInteractive3218168262692
firstPaint1537438078214311
backgroundConnect21920128511222231
firstReactRender21144762232
initialActions107124
loadScripts102683015239910651180
setupStore1472651623
numNetworkReqs393185163781
Power User HomeuiStartup5121204917529222561417998
load12741105204915713041589
domContentLoaded12561096202715012781552
domInteractive39203524432121
firstPaint229731476158276408
backgroundConnect199727914132198829474464
firstReactRender24174452636
initialActions109112
loadScripts1040892181414210551332
setupStore1564981537
numNetworkReqs1337026739140220
🧭 User Journey Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Onboarding Import WalletimportWalletToSocialScreen2192182201219220
srpButtonToSrpForm96959719797
confirmSrpToPwForm22222302323
pwFormToMetricsScreen16161601616
metricsToWalletReadyScreen16161701717
doneButtonToHomeScreen54252157021554570
openAccountMenuToAccountListLoaded3138310431652531573165
total3991391040565540284056
Onboarding New WalletcreateWalletToSocialScreen2202182232223223
srpButtonToPwForm1081041123111112
createPwToRecoveryScreen888088
skipBackupToMetricsScreen38373913839
agreeButtonToOnboardingSuccess15151601616
doneButtonToAssetList49647252018503520
total88786291318893913
Asset DetailsassetClickToPriceChart624878127178
total624878127178
Solana Asset DetailsassetClickToPriceChart914018855117188
total914018855117188
Import Srp HomeloginToHomeScreen22142088236310523062363
openAccountMenuAfterLogin59517486474
homeAfterImportWithNewWallet1469232236599022372365
total374224644802104645974802
Send TransactionsopenSendPageFromHome28243033030
selectTokenToSendFormLoaded29243543335
reviewTransactionToConfirmationPage1089846142019911551420
total1153899152021612201520
SwapopenSwapPageFromHome99941024102102
fetchAndDisplaySwapQuotes268426812687326852687
total2792275228382928062838
🌐 Dapp Page Load Benchmarks

Current Commit: 224d079 | Date: 3/19/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.08s (±77ms) 🟡 | historical mean value: 1.05s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 766ms (±74ms) 🟢 | historical mean value: 738ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 84ms (±11ms) 🟢 | historical mean value: 86ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.08s 77ms 1.03s 1.39s 1.32s 1.39s
domContentLoaded 766ms 74ms 725ms 1.06s 993ms 1.06s
firstPaint 84ms 11ms 64ms 168ms 104ms 168ms
firstContentfulPaint 84ms 11ms 64ms 168ms 104ms 168ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.12 MiB (19.51%)
  • ui: 247 Bytes (0%)
  • common: 102 Bytes (0%)

Copy link
Copy Markdown
Contributor

@ccharly ccharly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for accounts files:

ui/components/multichain/account-overview/account-overview-tabs.tsx

'data.ProfileMetricsController.syncQueue',
// non-EVM account IDs ARE NOT deterministic and each keyring has metadata (with source of randomness)
'data.KeyringController.vault',
// PerpsController is conditionally included in build via PERPS_ENABLED env var
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fixture validation won't use different values for PERPS_ENABLED between runs though, so I'm not sure why this would be a relevant reason to exclude this.

Also this may be related to the Cursor comment about the fixture state being incorrect.

"permissionActivityLog": "object",
"permissionHistory": "object"
},
"PerpsController": "object",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This shows that perps data would not be included in Sentry debug snapshots. We should update SENTRY_BACKGROUND_STATE in app/scripts/constants/sentry-state.ts to expose data that is PII-free, so that we have more data to use when diagnosing Sentry errors

Copy link
Copy Markdown
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

I found two potential problems (potential out-of-sync fixtures, and lack of Perps data in Sentry snapshots), but I'm OK with those being addressed in a follow up PR if you'd prefer

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-13.25.0 Issue or pull request that will be included in release 13.25.0 size-XL team-perps Perps team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants