feat: disable simulation for MetaMask Pay transactions - #34853
feat: disable simulation for MetaMask Pay transactions#34853matthewwalsh0 wants to merge 3 commits into
Conversation
PR template — items to address before "Ready for review"Warnings — informational, address before merging:
See docs/readme/ready-for-review.md for the full Definition of Ready for Review. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Caution MetaMask internal reviewing guidelines:
|
🧪 Flaky unit test detectionRun history flaky detectionHistorical failure rate is a hint, not proof — review each suggestion in context. See the flaky-test-detection skill for the full pattern reference and manual audit workflow. Failures / runs sampled per window:
AI-detected flaky patterns
|
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Performance Test Selection: |
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit c5909ba. Configure here.
|
|
||
| return initMessenger.call('PreferencesController:getState') | ||
| .useTransactionSimulations; | ||
| }, |
There was a problem hiding this comment.
Confirm stuck after skipping simulation
High Severity
isSimulationEnabled now returns false for MetaMask Pay types while confirmation UI still reads useTransactionSimulations as the simulation signal. useIsGaslessLoading treats missing gasFeeTokens as still loading when that preference is on, and the footer disables confirm while that flag is true. For Pay flows with insufficient native balance on gasless-supported chains, gasFeeTokens never arrive, so confirm can stay disabled.
Reviewed by Cursor Bugbot for commit c5909ba. Configure here.
|
|
| Platform | Device | Reason | Recording |
|---|---|---|---|
| Android | Google Pixel 8 Pro (v14.0) | no_performance_metrics | 📹 Watch |
🔬 App profiling check · Current run 31941804590 · Baseline (last run on main (scenario also failing)) run 30897750395 @ 67486d2
⚠️ No green baseline onmain— comparing against the latest usable profiling.
Summary:
ℹ️ API calls unavailable:
Network logs API error: Bad Request
Full metric table (+10% variance rules)
Disclaimer — allowed variance: a +10% margin over the baseline is permitted.
- If
Current <= Baseline + 10%, treated as acceptable noise.- If
Current > Baseline + 10%, Current and variance % are highlighted with⚠️ .
| Metric | Baseline | Current | Δ |
|---|---|---|---|
| CPU avg | 10.44% | 7.28% | -3.16 (-30.3%) |
| CPU max | 18.83% | 25.45% | +6.62 (+35.2%) |
| Memory avg | 555.64 MB | 831.82 MB | +276.18 (+49.7%) |
| Memory max | 609.03 MB | 1006.19 MB | +397.16 (+65.2%) |
| Slow frames | 5.16% | 18.49% | +13.33 (+258.3%) |
| Frozen frames | 0% | 0% | 0 (0%) |
| ANRs | 0 | 0 | 0 (0%) |
| Issues | 2 | 2 | 0 (0%) |
| Critical issues | 1 | 1 | 0 (0%) |
| App size | 328.67 MB | 329.55 MB | +0.88 (+0.3%) |
✅ Passed Tests (6)
| Test | Platform | Device | Duration | Team | Recording |
|---|---|---|---|---|---|
| Money Home after fresh wallet creation with empty balance | Android | Google Pixel 8 Pro (v14.0) | 3.56s | @mm-earn-team | 📹 Watch |
| Money Home after importing SRP with funded balance | Android | Google Pixel 8 Pro (v14.0) | 3.28s | @mm-earn-team | 📹 Watch |
| Predict Available Balance - Complete Flow Performance | Android | Google Pixel 8 Pro (v14.0) | 0.86s | @team-predict | 📹 Watch |
| Perps add funds | Android | Google Pixel 8 Pro (v14.0) | 6.66s | @mm-perps-engineering-team | 📹 Watch |
| Predict Deposit - Complete Flow Performance | Android | Google Pixel 8 Pro (v14.0) | 9.88s | @team-predict | 📹 Watch |
| Predict Market Details - Complete Flow Performance | Android | Google Pixel 8 Pro (v14.0) | 5.55s | @team-predict | 📹 Watch |
Branch: feat/simulation-disabled-mm-pay · Build: E2E · Commit: b715bf6 · View full run





Description
Transaction simulation was previously enabled or disabled solely based on the user's
useTransactionSimulationspreference, with no awareness of the transaction being processed. MetaMask Pay transactions (deposits, orders, conversions, claims, withdrawals) do not benefit from simulation and should never be simulated regardless of that preference.This wires the transaction meta through to the
isSimulationEnabledcallback and returnsfalsewhenever the transaction matches one of the MetaMask Pay transaction types (MM_PAY_TRANSACTION_TYPES), falling through to the existing preference-based behaviour for all other transactions.This depends on the extended
isSimulationEnabledcallback signature in@metamask/transaction-controller, consumed here via a preview build (69.5.2-preview-7585e3a) from MetaMask/core#9800 until that change is released.Changelog
CHANGELOG entry: null
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
N/A
After
N/A
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Medium Risk
Touches confirmation/simulation behavior for money-account and pay flows; dependency is a preview transaction-controller build rather than a stable release.
Overview
Transaction simulation now considers the transaction being confirmed, not only the
useTransactionSimulationspreference.isSimulationEnabledaccepts optionaltransactionMetaand forces simulation off when the type is inMM_PAY_TRANSACTION_TYPES(deposits, withdrawals, conversions, claims, perps/predict flows, etc.). All other transactions still follow the existing preference.This relies on a preview
@metamask/transaction-controller(69.5.2-preview-7585e3a) that passes meta into the callback until the core change ships. Unit tests cover non–MM Pay (simulation on when enabled) and each MM Pay type (simulation off).Reviewed by Cursor Bugbot for commit c5909ba. Bugbot is set up for automated code reviews on this repo. Configure here.