Skip to content

feat: perps geoblock flag#39999

Merged
gambinish merged 6 commits intoperps/poc-controller-integrationfrom
perps/geoblock-flag
Feb 12, 2026
Merged

feat: perps geoblock flag#39999
gambinish merged 6 commits intoperps/poc-controller-integrationfrom
perps/geoblock-flag

Conversation

@gambinish
Copy link
Copy Markdown
Member

@gambinish gambinish commented Feb 11, 2026

Description

Open in GitHub Codespaces

Changelog

CHANGELOG entry:

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
Touches perps controller initialization/messaging and gates multiple trading-related UI flows based on a new eligibility signal; incorrect wiring could wrongly block or allow perps actions.

Overview
Adds perps geo-blocking support by introducing usePerpsEligibility (subscribes to PerpsController state) and wiring it into key perps actions so trading/deposit/position modifications are disabled when a user is ineligible, with a new tooltip string (perpsGeoBlockedTooltip) shown on disabled CTAs.

Updates perps controller initialization to bridge Redux remoteFeatureFlags into the controller via a delegated RemoteFeatureFlagController messenger, and adds an env-based fallback (MM_PERPS_BLOCKED_REGIONS) for blocked regions when remote flags are unavailable. Routes now ensure perps pages are wrapped in PerpsControllerProvider, and tests are updated/added for the new hook and fallback parsing.

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

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

@metamaskbot metamaskbot added the team-perps Perps team label Feb 11, 2026
@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Feb 11, 2026

✨ Files requiring CODEOWNER review ✨

👨‍🔧 @MetaMask/perps (9 files, +355 -50)
  • 📁 ui/
    • 📁 components/
      • 📁 app/
        • 📁 perps/
          • 📁 edit-margin/
            • 📄 edit-margin-expandable.tsx +12 -2
          • 📁 perps-market-balance-actions/
            • 📄 perps-market-balance-actions.tsx +8 -1
    • 📁 hooks/
      • 📁 perps/
        • 📄 index.ts +2 -0
        • 📄 usePerpsEligibility.test.ts +90 -0
        • 📄 usePerpsEligibility.ts +41 -0
    • 📁 pages/
      • 📁 perps/
        • 📄 perps-market-detail-page.tsx +38 -17
    • 📁 providers/
      • 📁 perps/
        • 📄 getPerpsController.test.ts +39 -0
        • 📄 getPerpsController.ts +122 -27
        • 📄 PerpsControllerProvider.tsx +3 -3

@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Feb 11, 2026

Builds ready [3e500c1]
UI Startup Metrics (1383 ± 120 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup13831150164312014611622
load1193981146311612801384
domContentLoaded1186975145311412661378
domInteractive2716139212282
firstPaint201631437189215334
backgroundConnect2162012659220231
firstReactRender17114051927
initialActions105113
loadScripts983781125211210651168
setupStore1364061521
numNetworkReqs231596221587
BrowserifyPower User HomeuiStartup2702140610861184426034659
load12211046191815612711567
domContentLoaded12041039186215012451546
domInteractive3619150253589
firstPaint1887751090257348
backgroundConnect1022264904816896133067
firstReactRender23165262635
initialActions102111
loadScripts987828156114310261325
setupStore1656991825
numNetworkReqs1144723643137195
WebpackStandard HomeuiStartup84869312441008791070
load740624101887793884
domContentLoaded735620101186788880
domInteractive2616115202374
firstPaint1136140462140224
backgroundConnect271868103046
firstReactRender1493851623
initialActions103111
loadScripts732618100285786878
setupStore1052331116
numNetworkReqs231589201582
WebpackPower User HomeuiStartup1294897270426513691723
load74463811821167401065
domContentLoaded73563211741177261055
domInteractive3618193283699
firstPaint1396853287141303
backgroundConnect1801301304132160337
firstReactRender22173532328
initialActions104111
loadScripts73263011651167241047
setupStore1465381533
numNetworkReqs1354828047160219
FirefoxBrowserifyStandard HomeuiStartup15631330224017815871891
load13501179180511814031599
domContentLoaded13491178180511814031599
domInteractive70341733893147
firstPaint------
backgroundConnect5226190235087
firstReactRender1191611113
initialActions102012
loadScripts13271163176711613801566
setupStore2051843813117
numNetworkReqs241397211685
BrowserifyPower User HomeuiStartup27192066410137928523505
load15301278296724115651963
domContentLoaded15291278296724115621962
domInteractive155351589178135419
firstPaint------
backgroundConnect3301061509280401865
firstReactRender211470141965
initialActions112022
loadScripts14901255293822615311824
setupStore1587800197161614
numNetworkReqs833817934104141
WebpackStandard HomeuiStartup16611423310119917151957
load14471228284817214981607
domContentLoaded14461228284817214971606
domInteractive1012923348132181
firstPaint------
backgroundConnect55251452461114
firstReactRender14112931420
initialActions103112
loadScripts14211205281316914681577
setupStore196198331260
numNetworkReqs231398191774
WebpackPower User HomeuiStartup27962055907373229123483
load16621370636952816952114
domContentLoaded16611370636952816952114
domInteractive16239864158155568
firstPaint------
backgroundConnect38811919873235241003
firstReactRender22167592331
initialActions203122
loadScripts16211301632852816422071
setupStore14112775179152572
numNetworkReqs83382213995163
📊 Page Load Benchmark Results

Current Commit: 3e500c1 | Date: 2/11/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.05s (±72ms) 🟡 | historical mean value: 1.05s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 738ms (±70ms) 🟢 | historical mean value: 733ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 78ms (±12ms) 🟢 | historical mean value: 80ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.05s 72ms 1.01s 1.34s 1.26s 1.34s
domContentLoaded 738ms 70ms 698ms 1.01s 943ms 1.01s
firstPaint 78ms 12ms 60ms 176ms 88ms 176ms
firstContentfulPaint 78ms 12ms 60ms 176ms 88ms 176ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms

@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Feb 12, 2026

Builds ready [9426ff8]
UI Startup Metrics (1378 ± 92 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1378117015929214371520
load118098613808912391322
domContentLoaded117498313738912351315
domInteractive271791182377
firstPaint144611070114181244
backgroundConnect20819424710210230
firstReactRender16103031721
initialActions104113
loadScripts97979311748910391115
setupStore1363851621
numNetworkReqs231592201583
BrowserifyPower User HomeuiStartup18811433582971518083632
load1119993177913911321448
domContentLoaded1104985167113111181425
domInteractive3217139223282
firstPaint195661681167247288
backgroundConnect4172623205483319831
firstReactRender24135392644
initialActions108112
loadScripts89278314281248831186
setupStore1554471731
numNetworkReqs1154724541134180
WebpackStandard HomeuiStartup8687111119989341042
load75564193685827906
domContentLoaded75063792884822900
domInteractive251490182281
firstPaint1096233457135200
backgroundConnect25176192941
firstReactRender1493951623
initialActions106112
loadScripts74763592683820898
setupStore1153141119
numNetworkReqs231597211584
WebpackPower User HomeuiStartup1251953215318413211549
load73263512541197161041
domContentLoaded72362912481207061038
domInteractive35161743033125
firstPaint135651074114153274
backgroundConnect16712981175161267
firstReactRender22163842429
initialActions102111
loadScripts72062712391187041030
setupStore1345171421
numNetworkReqs1224628451151207
FirefoxBrowserifyStandard HomeuiStartup17031458259519517492105
load14831243232916215181744
domContentLoaded14821243232316215161744
domInteractive843625843109141
firstPaint------
backgroundConnect5832194246284
firstReactRender12102021316
initialActions102122
loadScripts14551219229715714951715
setupStore147168181335
numNetworkReqs241294221788
BrowserifyPower User HomeuiStartup26882068351330928153335
load15851295228621616012087
domContentLoaded15841295228121516012087
domInteractive12239791118118336
firstPaint------
backgroundConnect234108830174226782
firstReactRender18137191820
initialActions103122
loadScripts15441274226120615592042
setupStore1599737201194667
numNetworkReqs68381563595135
WebpackStandard HomeuiStartup16191416213012516601866
load1413124516328714561569
domContentLoaded1412124516318714551569
domInteractive973224946131148
firstPaint------
backgroundConnect51211622753111
firstReactRender13111921416
initialActions102012
loadScripts1387122916048014311533
setupStore176166251252
numNetworkReqs241290201782
WebpackPower User HomeuiStartup26992039469545828153529
load16151336242228017022286
domContentLoaded16141335242128017022285
domInteractive14335823156117546
firstPaint------
backgroundConnect220107974157199536
firstReactRender2215122132331
initialActions205123
loadScripts15761321237027116692222
setupStore1879722220265672
numNetworkReqs68391943496130
📊 Page Load Benchmark Results

Current Commit: 9426ff8 | Date: 2/12/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.02s (±36ms) 🟡 | historical mean value: 1.05s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 710ms (±35ms) 🟢 | historical mean value: 733ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 74ms (±11ms) 🟢 | historical mean value: 80ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.02s 36ms 998ms 1.29s 1.04s 1.29s
domContentLoaded 710ms 35ms 691ms 969ms 726ms 969ms
firstPaint 74ms 11ms 56ms 156ms 84ms 156ms
firstContentfulPaint 74ms 11ms 56ms 156ms 84ms 156ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms

@gambinish gambinish marked this pull request as ready for review February 12, 2026 20:23
@gambinish gambinish requested a review from a team as a code owner February 12, 2026 20:23
@gambinish gambinish merged commit 36337a8 into perps/poc-controller-integration Feb 12, 2026
22 of 24 checks passed
@gambinish gambinish deleted the perps/geoblock-flag branch February 12, 2026 20:23
@github-actions github-actions bot locked and limited conversation to collaborators Feb 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants