Skip to content

feat(transaction-pay): add ordered strategy fallback orchestration#7868

Merged
pedronfigueiredo merged 1 commit intomainfrom
cor-6992-extract-fallback-mechanism
Feb 23, 2026
Merged

feat(transaction-pay): add ordered strategy fallback orchestration#7868
pedronfigueiredo merged 1 commit intomainfrom
cor-6992-extract-fallback-mechanism

Conversation

@pedronfigueiredo
Copy link
Contributor

@pedronfigueiredo pedronfigueiredo commented Feb 9, 2026

Explanation

As per preemptive validation on #7806

  • Adds ordered strategy retrieval via TransactionPayController:getStrategies while preserving existing getStrategy behavior.
  • Adds compatibility filtering (supports(...)) during strategy selection.
  • Implements quote fallback orchestration:
    • try next strategy when quote retrieval fails
    • try next strategy when quote list is empty
    • skip unsupported strategies
  • Implements publish-hook fallback orchestration:
    • execute primary strategy from existing quote strategy
    • on execution failure, rebuild quote requests and try next compatible strategy
    • throw original primary error if all fallback attempts fail

References

Addresses https://github.com/MetaMask/MetaMask-planning/issues/6992

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Changes core quote-selection and submission routing for pay transactions; incorrect strategy ordering, supports checks, or fallback behavior could alter fees/quotes returned or cause pay flows to fail in edge cases.

Overview
MetaMask Pay now supports ordered strategy orchestration with fallback. TransactionPayController accepts an optional getStrategies callback (while preserving getStrategy) and falls back to a remotely-configured strategyOrder feature flag (defaulting to Relay), filtering invalid values.

Quote updates/refresh now try strategies in priority order via getStrategiesByName, optionally skip incompatible strategies via a new PayStrategy.supports(...) hook, and fall through when a strategy errors, returns no quotes, or fails batch-transaction generation. Publish-time submission now selects the strategy from quotes[0].strategy (instead of re-resolving from controller) to ensure the submit path matches the quote origin.

Written by Cursor Bugbot for commit 7908026. This will update automatically on new commits. Configure here.

@pedronfigueiredo pedronfigueiredo force-pushed the cor-6992-extract-fallback-mechanism branch 6 times, most recently from 23573ac to 55549a1 Compare February 9, 2026 11:34
@pedronfigueiredo pedronfigueiredo force-pushed the cor-6992-extract-fallback-mechanism branch from 55549a1 to e2818b3 Compare February 9, 2026 13:32
@pedronfigueiredo pedronfigueiredo force-pushed the cor-6992-extract-fallback-mechanism branch from e2818b3 to 5158351 Compare February 9, 2026 13:48
@pedronfigueiredo pedronfigueiredo force-pushed the cor-6992-extract-fallback-mechanism branch 3 times, most recently from c450bc6 to 782bc16 Compare February 9, 2026 14:27
@pedronfigueiredo pedronfigueiredo force-pushed the cor-6992-extract-fallback-mechanism branch from 9b2de51 to 44ee983 Compare February 12, 2026 11:02
@pedronfigueiredo pedronfigueiredo force-pushed the cor-6992-extract-fallback-mechanism branch from 44ee983 to eeca0ed Compare February 12, 2026 13:47
@pedronfigueiredo pedronfigueiredo force-pushed the cor-6992-extract-fallback-mechanism branch 2 times, most recently from 9cd0f37 to a6c9af9 Compare February 13, 2026 10:47
@pedronfigueiredo pedronfigueiredo force-pushed the cor-6992-extract-fallback-mechanism branch from a6c9af9 to df9f104 Compare February 16, 2026 10:20
@pedronfigueiredo pedronfigueiredo force-pushed the cor-6992-extract-fallback-mechanism branch 2 times, most recently from 35e9f3f to 08bac6a Compare February 16, 2026 10:27
@pedronfigueiredo pedronfigueiredo force-pushed the cor-6992-extract-fallback-mechanism branch from 08bac6a to 26c090a Compare February 16, 2026 10:51
@pedronfigueiredo pedronfigueiredo force-pushed the cor-6992-extract-fallback-mechanism branch 3 times, most recently from d7d7490 to b6a43e3 Compare February 20, 2026 14:44
});
continue;
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Source amounts strategy mismatch with fallback strategy selection

Medium Severity

The updateSourceAmounts call in #updateTransactionData uses getStrategy (returning the first strategy) to decide whether same-token quotes are required via isQuoteAlwaysRequired. But the new fallback loop in getQuotes may select a different strategy. For a Hyperliquid USDC deposit where the payment token matches the required token, if Bridge is first in the order, isQuoteAlwaysRequired returns false, the source amount is skipped, and no quote requests are built — so even when Relay (which does need that quote) is tried as fallback, requests is already empty and getQuotes returns early with no quotes.

Additional Locations (1)

Fix in Cursor Fix in Web

matthewwalsh0
matthewwalsh0 previously approved these changes Feb 20, 2026
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

@pedronfigueiredo pedronfigueiredo added this pull request to the merge queue Feb 23, 2026
Merged via the queue into main with commit 35e2873 Feb 23, 2026
310 checks passed
@pedronfigueiredo pedronfigueiredo deleted the cor-6992-extract-fallback-mechanism branch February 23, 2026 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants