Skip to content

fix(transaction-controller): scope saved gas exclusions to swaps and bridges - #9682

Merged
pedronfigueiredo merged 4 commits into
mainfrom
pnf/saved-gas-fees-internal
Jul 29, 2026
Merged

fix(transaction-controller): scope saved gas exclusions to swaps and bridges#9682
pedronfigueiredo merged 4 commits into
mainfrom
pnf/saved-gas-fees-internal

Conversation

@pedronfigueiredo

@pedronfigueiredo pedronfigueiredo commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

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=false
  • Added coverage for internal wallet transactions and swap/bridge exclusions.

Changelog

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 type could 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.

updateGasFees now ignores saved gas only for swap and bridge transaction types (SWAP_TRANSACTION_TYPES, bridge, bridgeApproval) instead of all internal transactions. Internal simpleSend transfers 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.

@pedronfigueiredo
pedronfigueiredo marked this pull request as ready for review July 28, 2026 16:09
@pedronfigueiredo
pedronfigueiredo requested review from a team as code owners July 28, 2026 16:09
@matthewwalsh0
matthewwalsh0 requested a review from jpuri July 29, 2026 11:01
@pedronfigueiredo
pedronfigueiredo added this pull request to the merge queue Jul 29, 2026
Merged via the queue into main with commit 8d97ab0 Jul 29, 2026
136 checks passed
@pedronfigueiredo
pedronfigueiredo deleted the pnf/saved-gas-fees-internal branch July 29, 2026 12:07
@cursor cursor Bot mentioned this pull request Jul 29, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants