fix(transaction-controller): scope saved gas exclusions to swaps and bridges - #9682
Merged
Conversation
# Conflicts: # packages/transaction-controller/CHANGELOG.md
pedronfigueiredo
marked this pull request as ready for review
July 28, 2026 16:09
pedronfigueiredo
temporarily deployed
to
default-branch
July 28, 2026 16:09 — with
GitHub Actions
Inactive
jpuri
approved these changes
Jul 29, 2026
This was referenced Jul 30, 2026
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.
Summary
Saved gas preferences were excluded from every transaction with
isInternal: true. This also excluded wallet-initiated transfers, which are marked internal by the extension API even though they should use saved gas settings.This changes the exclusion to a dedicated transaction-type list containing swaps and bridge transactions. Wallet transfers can now apply saved gas preferences while swaps and bridges remain protected from underpriced saved fees.
Related PRs
Testing
yarn jest --config packages/transaction-controller/jest.config.js --runInBand packages/transaction-controller/src/utils/gas-fees.test.ts --coverage=falseChangelog
Added an Unreleased changelog entry for
@metamask/transaction-controller.Note
Medium Risk
Changes which transactions receive saved gas fees at submit time; wallet sends gain user prefs while swap/bridge behavior stays guarded, but any misclassified
typecould get the wrong fee path.Overview
Saved gas preferences were skipped for every transaction with
isInternal: true, which incorrectly blocked wallet-initiated transfers (often marked internal) from using the user’s advanced gas settings.updateGasFeesnow ignores saved gas only for swap and bridge transaction types (SWAP_TRANSACTION_TYPES,bridge,bridgeApproval) instead of all internal transactions. InternalsimpleSendtransfers can apply saved fees again; aggregator/relay-driven swaps and bridges still avoid user-saved fees that could underprice them.Tests cover internal wallet sends applying saved gas and parameterized cases for swap/bridge types still ignoring them.
Reviewed by Cursor Bugbot for commit 61d4074. Bugbot is set up for automated code reviews on this repo. Configure here.