Conversation
…nd network configuration
…ferencedCurrency hook
…tamask-extension into vs/speedup-cancel-ui
…tamask-extension into vs/speedup-cancel-ui
…tamask-extension into vs/speedup-cancel-ui
…context - Introduced `useCancelSpeedupGasState` to manage effective transaction state and actions for cancel/speedup. - Added `useCancelSpeedupInitialGas` to handle initial gas estimation logic when the cancel/speedup modal is opened. - Refactored gas fee modal context to support transaction meta and edit gas modes. - Updated `GasFeesSection` to utilize new hooks for fee calculations. - Improved modal components to handle gas fee editing more effectively. - Added optional Dapp swap context for better integration in various flows. - Enhanced tests for new hooks and components to ensure proper functionality.
|
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. |
✨ Files requiring CODEOWNER review ✨✅ @MetaMask/confirmations (25 files, +1285 -225)
👨🔧 @MetaMask/core-extension-ux (1 files, +1 -13)
🧪 @MetaMask/qa (1 files, +87 -0)
|
Builds ready [59d206a]
⚡ Performance Benchmarks (1366 ± 110 ms)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
…ansaction components
Builds ready [95e802a]
⚡ Performance Benchmarks
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
|
@metamaskbot update-policies |
|
Policies updated. 🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff ✅ lavamoat/browserify/beta/policy.json changes match main/policy.json policy changes |
This reverts commit a612768.
Builds ready [a612768]
⚡ Performance Benchmarks
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [7eaeb1c]
⚡ Performance Benchmarks
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
| 16, | ||
| ).gte(new BigNumber(minMaxPriorityFeePerGas, 16)) | ||
| ? txParams.maxPriorityFeePerGas | ||
| : minMaxPriorityFeePerGas; |
There was a problem hiding this comment.
BigNumber hex comparison always returns NaN, ignoring higher gas
High Severity
In getGasValuesForReplacement, toPrefixedHexString() returns 0x-prefixed strings (e.g. "0x12"), which are then passed to new BigNumber(value, 16). Per bignumber.js docs, the 0x prefix is only valid when no base is specified — with base 16, the x character is invalid, causing both operands to be NaN. Since NaN.gte(NaN) is always false, the txParams values are never selected even when they exceed the minimum replacement gas. This means user-chosen higher gas fees are silently downgraded to previousGas × rate.
Additional Locations (1)
| await waitFor(() => { | ||
| expect(screen.getByTestId('edit-gas-fees-row')).toHaveTextContent( | ||
| EXPECTED_ETH_FEE_1, | ||
| ); |
There was a problem hiding this comment.
Tests weakened to match any digit, hiding gas bugs
Medium Severity
The tests for gas fee display previously asserted exact expected ETH fee values (EXPECTED_ETH_FEE_1, EXPECTED_ETH_FEE_2) but now only check that the row contains any digit via expect(row.textContent).toMatch(/\d/u). This regex matches any string with at least one digit, making the assertions trivially true and unable to catch regressions in gas fee calculation logic (including the BigNumber bug in getGasValuesForReplacement).
Additional Locations (1)
Triggered by project rule: MetaMask Extension - Cursor Rules
|
Builds ready [2f07699]
⚡ Performance Benchmarks
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
|
close PR it will be handle here |





Description
This PR modernizes the cancel/speed-up transaction UI to use the same GasFeeModal context and gas-details patterns as the main confirmation flow, and fixes the "useConfirmContext must be used within ConfirmContextProvider" error when opening the gas modal from cancel-speedup.
What was done
transactionMetaandeditGasMode.GasFeeModalWrapperwraps modal content inConfirmContextProviderwithcurrentConfirmationOverride={transactionMeta}when opened from cancel-speedup so gas modals can useuseConfirmContext().GasFeeModalContextProvider(transactionMeta, editGasMode),useCancelSpeedupGasState, anduseCancelSpeedupInitialGas. Renders shared gas UI (e.g. GasFeesSection) and opens the gas modal via context.AdvancedEIP1559Modal,AdvancedGasPriceModal, anduseGasFeeEstimateLevelOptionsuseuseConfirmContext()again; nouseTransactionForGasModalin the modal flow.ConfirmContextProvidersupports optionalcurrentConfirmationOverride; when set, route sync and navigate-on-dismiss are skipped so the gas modal can be used outside the confirm route.useCancelSpeedupGasStateprovides effective transaction and actions;useCancelSpeedupInitialGasruns the initial gas rule (medium vs tenPercentIncreased) when the cancel-speedup modal is open.Changelog
CHANGELOG entry: Fixed gas edit opening from cancel/speed-up transaction flow and aligned cancel-speedup gas UI with the main confirmation flow.
Related issues
Fixes: https://github.com/MetaMask/MetaMask-planning/issues/7051
Manual testing steps
Screenshots/Recordings
cancel_new_ex.webm
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Touches cancel/speed-up transaction replacement gas calculation and modal context wiring, which can impact transaction submission and gas editing behavior. Changes are well-covered with new unit/E2E tests but still affect a user-critical path.
Overview
Cancel/speed-up confirmations now use the same gas modal/context patterns as the main confirmation flow.
CancelSpeedupis refactored to useGasFeeModalContextProvider(and a newConfirmContextProvideroverride path) so opening the gas editor from the cancel/speed-up modal no longer throwsuseConfirmContextprovider errors.Replacement transaction gas is made safer. A new
getGasValuesForReplacementutility is used byuseTransactionFunctionsto ensure cancel/speed-up submissions use at leastpreviousGas × (CANCEL_RATE/SPEED_UP_RATE)for EIP-1559 fees, and the confirm button is disabled untilpreviousGasis captured.Supporting UI/hooks updated and tests expanded.
GasTimingaddsuserFeeLevelOverrideand labels for dapp-suggested/10% increase;NetworkStatistics/StatusSlidercan fall back touseGasFeeEstimateswhen context estimates are missing;useFeeCalculationscan run outside swap context viauseDappSwapContextOptional. New unit tests cover the new hooks and gas replacement logic, and E2E speed-up/cancel tests are updated with a dedicated modal page object.Written by Cursor Bugbot for commit 2f07699. This will update automatically on new commits. Configure here.