Skip to content

feat: implement geoblocking on musd reward claiming#40634

Merged
Jwhiles merged 7 commits intomainfrom
geoblock-musd-claiming
Mar 12, 2026
Merged

feat: implement geoblocking on musd reward claiming#40634
Jwhiles merged 7 commits intomainfrom
geoblock-musd-claiming

Conversation

@Jwhiles
Copy link
Contributor

@Jwhiles Jwhiles commented Mar 5, 2026

Description

This PR uses the geoblocking logic from the MUSD conversion flow to also prevent claiming MUSD rewards in geoblocked regions

Open in GitHub Codespaces

Changelog

CHANGELOG entry: Prevent MUSD reward claiming in Geoblocked regions.

Related issues

Fixes:

Manual testing steps

  1. Enable the earnMerklCampaignClaiming feature flag
  2. Login to an account with rewards to claim from a blocked region (e.g. UK)
  3. Verify that claim button is now shown.

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 geo-blocking checks that short-circuit reward fetching and transaction creation; risk is moderate because it changes who can see/claim rewards and could inadvertently block eligible users if the geo check misbehaves.

Overview
Extends existing mUSD geo-blocking to Merkl rewards by skipping reward lookups and claim transaction creation when useMusdGeoBlocking reports the user is blocked.

Updates unit/integration tests to mock useMusdGeoBlocking consistently and adds coverage ensuring geoblocked users neither call the Merkl API nor dispatch claim transactions.

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

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

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.

@metamaskbotv2
Copy link
Contributor

metamaskbotv2 bot commented Mar 5, 2026

✨ Files requiring CODEOWNER review ✨

👨‍🔧 @MetaMask/metamask-earn (4 files, +97 -4)
  • 📁 ui/
    • 📁 components/
      • 📁 app/
        • 📁 musd/
          • 📁 hooks/
            • 📄 useMerklClaim.test.ts +43 -1
            • 📄 useMerklClaim.ts +7 -0
            • 📄 useMerklRewards.test.ts +43 -2
            • 📄 useMerklRewards.ts +4 -1

@github-actions github-actions bot added the size-S label Mar 5, 2026
@Jwhiles Jwhiles marked this pull request as ready for review March 5, 2026 15:00
@metamaskbotv2
Copy link
Contributor

metamaskbotv2 bot commented Mar 5, 2026

Builds ready [2eb1100]
⚡ Performance Benchmarks
👆 Interaction Benchmarks
🧭 User Journey Benchmarks
🌐 Dapp Page Load Benchmarks

Current Commit: 2eb1100 | Date: 3/5/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.06s (±42ms) 🟡 | historical mean value: 1.06s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 729ms (±64ms) 🟢 | historical mean value: 742ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 85ms (±45ms) 🟢 | historical mean value: 82ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.06s 42ms 1.03s 1.37s 1.11s 1.37s
domContentLoaded 729ms 64ms 701ms 1.31s 765ms 1.31s
firstPaint 85ms 45ms 64ms 520ms 100ms 520ms
firstContentfulPaint 85ms 45ms 64ms 520ms 100ms 520ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 58 Bytes (0%)
  • ui: 14.59 KiB (0.17%)
  • common: 20 Bytes (0%)

@Jwhiles Jwhiles force-pushed the geoblock-musd-claiming branch from 2eb1100 to 468625b Compare March 5, 2026 15:47
@Matt561 Matt561 self-requested a review March 5, 2026 15:55
Matt561
Matt561 previously approved these changes Mar 5, 2026
Copy link
Contributor

@Matt561 Matt561 left a comment

Choose a reason for hiding this comment

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

The bug bot comments seems like a minor quick fix. Otherwise LGTM 👍

Matt561
Matt561 previously approved these changes Mar 5, 2026
shane-t
shane-t previously approved these changes Mar 5, 2026
@Jwhiles Jwhiles dismissed stale reviews from shane-t and Matt561 via fe3851d March 5, 2026 16:36
@Jwhiles Jwhiles force-pushed the geoblock-musd-claiming branch from fe3851d to 203d8a7 Compare March 5, 2026 16:37
nickewansmith
nickewansmith previously approved these changes Mar 5, 2026
@metamaskbotv2
Copy link
Contributor

metamaskbotv2 bot commented Mar 5, 2026

Builds ready [4f99a67]
⚡ Performance Benchmarks
👆 Interaction Benchmarks
🧭 User Journey Benchmarks
🌐 Dapp Page Load Benchmarks

Current Commit: 4f99a67 | Date: 3/5/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.03s (±39ms) 🟡 | historical mean value: 1.05s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 723ms (±36ms) 🟢 | historical mean value: 734ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 79ms (±11ms) 🟢 | historical mean value: 82ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.03s 39ms 1.01s 1.33s 1.06s 1.33s
domContentLoaded 723ms 36ms 703ms 1000ms 750ms 1000ms
firstPaint 79ms 11ms 64ms 180ms 88ms 180ms
firstContentfulPaint 79ms 11ms 64ms 180ms 88ms 180ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 58 Bytes (0%)
  • ui: 14.59 KiB (0.17%)
  • common: 20 Bytes (0%)

@Jwhiles Jwhiles dismissed stale reviews from Gudahtt, Matt561, and nickewansmith via 20fdbdd March 12, 2026 13:57
@Jwhiles Jwhiles force-pushed the geoblock-musd-claiming branch from 177b6d4 to 20fdbdd Compare March 12, 2026 13:57
Copy link

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

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

@metamaskbotv2
Copy link
Contributor

metamaskbotv2 bot commented Mar 12, 2026

Builds ready [20fdbdd]
⚡ Performance Benchmarks
👆 Interaction Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Load New Accountload_new_account361263528114469528
total361263528114469528
Confirm Txconfirm_tx6049600660993560806099
total6049600660993560806099
Bridge User Actionsbridge_load_page23719529641277296
bridge_load_asset_picker26224227713269277
bridge_search_token7617587642764764
total1251123312811812481281
🔌 Startup Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Standard HomeuiStartup13891143168911514441599
load1156946145410912141346
domContentLoaded1148921144910812091327
domInteractive281690172576
firstPaint190611276186199350
backgroundConnect1961792299199215
firstReactRender18123552030
initialActions104123
loadScripts967741126810710301149
setupStore1273341318
numNetworkReqs393193173485
Power User HomeuiStartup5404207113298237571289105
load13061086172812013501586
domContentLoaded12881067166711313281547
domInteractive38202883832116
firstPaint201801372145272341
backgroundConnect195431011105177528434875
firstReactRender27197372936
initialActions108112
loadScripts1057854144610710981297
setupStore1575381727
numNetworkReqs1334131748137255
🧭 User Journey Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Onboarding Import WalletimportWalletToSocialScreen2202192211221221
srpButtonToSrpForm94929629496
confirmSrpToPwForm22212312223
pwFormToMetricsScreen16151601616
metricsToWalletReadyScreen16161711717
doneButtonToHomeScreen61660064117623641
openAccountMenuToAccountListLoaded2918289929521929232952
total3912388739271639263927
Onboarding New WalletcreateWalletToSocialScreen2162152171217217
srpButtonToPwForm1061031102109110
createPwToRecoveryScreen888088
skipBackupToMetricsScreen35353603636
agreeButtonToOnboardingSuccess16151711717
doneButtonToAssetList51046355131526551
total89284693731908937
Asset DetailsassetClickToPriceChart78787907979
total78787907979
Solana Asset DetailsassetClickToPriceChart997814125117141
total997814125117141
Import Srp HomeloginToHomeScreen2328231723431123432343
openAccountMenuAfterLogin563282176782
homeAfterImportWithNewWallet2291221323575423222357
total4701458247937747334793
Send TransactionsopenSendPageFromHome41325494354
selectTokenToSendFormLoaded29214483444
reviewTransactionToConfirmationPage1195927142817812971428
total12591004146716713721467
SwapopenSwapPageFromHome932613840125138
fetchAndDisplaySwapQuotes2709268827281627272728
total2820279028662928222866
🌐 Dapp Page Load Benchmarks

Current Commit: 20fdbdd | Date: 3/12/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.05s (±43ms) 🟡 | historical mean value: 1.05s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 736ms (±41ms) 🟢 | historical mean value: 736ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 82ms (±13ms) 🟢 | historical mean value: 81ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.05s 43ms 1.02s 1.39s 1.07s 1.39s
domContentLoaded 736ms 41ms 708ms 1.05s 755ms 1.05s
firstPaint 82ms 13ms 68ms 204ms 92ms 204ms
firstContentfulPaint 82ms 13ms 68ms 204ms 92ms 204ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs
  • background: 58 Bytes (0%)
  • ui: 303 Bytes (0%)
  • common: 20 Bytes (0%)

@sonarqubecloud
Copy link

@metamaskbotv2
Copy link
Contributor

metamaskbotv2 bot commented Mar 12, 2026

Builds ready [a384f16]
⚡ Performance Benchmarks
👆 Interaction Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Load New Accountload_new_account28826830816298308
total28826830816298308
Confirm Txconfirm_tx604660396051560516051
total604660396051560516051
Bridge User Actionsbridge_load_page23320925218250252
bridge_load_asset_picker27217833659332336
bridge_search_token7567447679760767
total1251110213328513211332
🔌 Startup Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Standard HomeuiStartup14641227191411014941642
load1215102616349912471391
domContentLoaded1209102116269812441371
domInteractive3018119212686
firstPaint174711271175208393
backgroundConnect21820033618218239
firstReactRender21125772036
initialActions106124
loadScripts100782014069510371169
setupStore1474651722
numNetworkReqs393186164080
Power User HomeuiStartup61002262171883195684814301
load13231153194815313451642
domContentLoaded12981131187913213281594
domInteractive38202073133121
firstPaint216851448162286371
backgroundConnect2460303142813140315311070
firstReactRender27194852936
initialActions105113
loadScripts1071910159912210961350
setupStore1575971723
numNetworkReqs22712436759264334
🧭 User Journey Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Onboarding Import WalletimportWalletToSocialScreen2192162233220223
srpButtonToSrpForm93929309393
confirmSrpToPwForm22212202222
pwFormToMetricsScreen15151501515
metricsToWalletReadyScreen16161701717
doneButtonToHomeScreen70860480280801802
openAccountMenuToAccountListLoaded2905289229231129102923
total3978385840898640654089
Onboarding New WalletcreateWalletToSocialScreen2192172222221222
srpButtonToPwForm1071051081107108
createPwToRecoveryScreen888088
skipBackupToMetricsScreen39384013840
agreeButtonToOnboardingSuccess16161701617
doneButtonToAssetList633493947173696947
total1025886133216810841332
Asset DetailsassetClickToPriceChart754999219199
total754999219199
Solana Asset DetailsassetClickToPriceChart1057515631122156
total1057515631122156
Import Srp HomeloginToHomeScreen2265216323467323252346
openAccountMenuAfterLogin52486265062
homeAfterImportWithNewWallet2324228123673523672367
total4678457847416247154741
Send TransactionsopenSendPageFromHome27272702727
selectTokenToSendFormLoaded31303213232
reviewTransactionToConfirmationPage1009695142625611611426
total1076754152826912111528
SwapopenSwapPageFromHome1108513418122134
fetchAndDisplaySwapQuotes269326872705726962705
total2803278028392128102839
🌐 Dapp Page Load Benchmarks

Current Commit: a384f16 | Date: 3/12/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.06s (±41ms) 🟡 | historical mean value: 1.04s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 745ms (±38ms) 🟢 | historical mean value: 734ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 82ms (±14ms) 🟢 | historical mean value: 82ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.06s 41ms 1.02s 1.36s 1.09s 1.36s
domContentLoaded 745ms 38ms 715ms 1.03s 778ms 1.03s
firstPaint 82ms 14ms 68ms 208ms 88ms 208ms
firstContentfulPaint 82ms 14ms 68ms 208ms 88ms 208ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs
  • background: 58 Bytes (0%)
  • ui: 303 Bytes (0%)
  • common: 20 Bytes (0%)

@nickewansmith nickewansmith removed request for a team, Gudahtt and shane-t March 12, 2026 16:08
@Matt561 Matt561 self-requested a review March 12, 2026 16:13
@Jwhiles Jwhiles added this pull request to the merge queue Mar 12, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 12, 2026
@Jwhiles Jwhiles added this pull request to the merge queue Mar 12, 2026
Merged via the queue into main with commit 5314df8 Mar 12, 2026
184 checks passed
@Jwhiles Jwhiles deleted the geoblock-musd-claiming branch March 12, 2026 18:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-13.23.0 Issue or pull request that will be included in release 13.23.0 size-M team-earn

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants