fix(transaction-controller): harden gas fee token preflight - #10071
Merged
Conversation
jpuri
added a commit
that referenced
this pull request
Sep 2, 2026
jpuri
marked this pull request as draft
September 2, 2026 04:58
jpuri
marked this pull request as ready for review
September 2, 2026 05:06
jpuri
enabled auto-merge
September 2, 2026 05:06
10 tasks
OGPoyraz
removed their request for review
September 3, 2026 10:00
dan437
previously approved these changes
Sep 4, 2026
Avoid treating native balance as sufficient when gas estimates are still pending, and do not leave isExternalSign enabled when the selected gas fee token fails preflight validation.
jpuri
force-pushed
the
fix/gas-fee-token-preflight-predict-claim
branch
from
September 7, 2026 04:38
447935c to
3556002
Compare
dan437
approved these changes
Sep 7, 2026
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Sep 7, 2026
## Explanation Release @metamask/transaction-controller. ## References https://consensyssoftware.atlassian.net/browse/CONF-1725 ## Checklist - [X] I've updated the test suite for new or updated code as appropriate - [X] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [X] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md) - [X] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > The release propagates a transaction-controller fix in gas preflight and external-sign handling, which affects signing and fee flows across many packages even though the diff is mostly version bumps. > > **Overview** > This release cuts **`@metamask/transaction-controller` `69.8.1`** and rolls it through the monorepo as **`1238.0.0`**. > > The patch fixes **gas fee token preflight**: pending gas estimates are no longer treated as zero-cost native gas, and **`isExternalSign` is cleared when preflight validation fails** ([#10071](#10071)). Dependent packages (assets, bridge, wallet, phishing, smart transactions, and others) only bump their **`@metamask/transaction-controller`** range to **`^69.8.1`** and record the bump in their changelogs; **`yarn.lock`** is updated accordingly. There is no new application logic outside **`transaction-controller`** in this diff. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit a795ef5. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
Predict claim on Mobile (Polygon Safe wallets) can fail during gas-station preflight when a gas fee token (e.g. pUSD) is pre-selected but Sentinel returns an empty
gasFeeTokenslist and native POL is insufficient.Two controller bugs contribute to confusing failures and bad publish fallbacks:
isNativeBalanceSufficientForGastreated missingmaxFeePerGas/gasPriceas zero, sogas × 0 = 0made every wallet look able to pay native gas. That could clearselectedGasFeeTokenwhile gas estimates were still in flight (common withskipInitialGasEstimate), leading to publishes withintrinsic gas too low: gas 0.checkGasFeeTokenBeforePublishsetisExternalSign: trueand cleared nonce before validating the selected token. When validation failed (Gas fee token not found and insufficient native balance), transaction metadata could remain in external-sign mode even though signing was never completed.This PR hardens both paths:
balance.ts: return insufficient whengasor fee fields are unset, so pre-selected gas fee tokens are not cleared prematurely.gas-fee-tokens.ts: only enable external sign after the selected token is confirmed in freshly fetchedgasFeeTokens; on failure, persist refreshed tokens but resetisExternalSigntofalsebefore throwing.No breaking API changes. Scope is limited to
@metamask/transaction-controllerpublish-time gas-fee-token gating.References
https://consensyssoftware.atlassian.net/browse/CONF-1725
Checklist
Note
Medium Risk
Changes publish-path balance and gas-fee-token validation; incorrect behavior could block valid publishes or alter signing mode, but scope is limited to preflight gating with targeted tests.
Overview
Hardens publish-time gas fee token gating in
@metamask/transaction-controllerso pre-selected tokens are not dropped and external-sign state is not left inconsistent when preflight fails.isNativeBalanceSufficientForGasnow returns insufficient whengasor fee fields (maxFeePerGas/gasPrice) are unset, instead of treating missing values as zero. That stops in-flight gas estimates (e.g. withskipInitialGasEstimate) from looking like free native gas and clearing a selected gas fee token too early.checkGasFeeTokenBeforePublishonly setsisExternalSign: trueand clears nonce after confirming the selected token appears in freshly fetchedgasFeeTokens. If the token is missing, it persists the refreshed token list, resetsisExternalSigntofalse, then throws—avoiding metadata stuck in external-sign mode after a failed preflight.Tests and an Unreleased changelog entry cover the new behavior.
Reviewed by Cursor Bugbot for commit 3556002. Bugbot is set up for automated code reviews on this repo. Configure here.