Repository navigation
refactor(transaction-pay-controller): extract shared max quote flow - #11440
Open
matthewwalsh0 wants to merge 1 commit into
Open
matthewwalsh0 wants to merge 1 commit into
matthewwalsh0 wants to merge 1 commit into
Conversation
matthewwalsh0
force-pushed
the
feat/gas-station-buffer
branch
from
November 11, 2026 18:03
56020f0 to
771a44d
Compare
matthewwalsh0
force-pushed
the
refactor/shared-max-quote
branch
from
November 11, 2026 18:04
0a7086e to
ff683d5
Compare
Move the max gas station and atomic max promotion logic out of RelayStrategy into provider-agnostic utils (max-quote, max-gas-station), with RelayStrategy supplying quote details and re-quote callbacks.
matthewwalsh0
force-pushed
the
refactor/shared-max-quote
branch
from
November 12, 2026 11:37
ff683d5 to
e12bca0
Compare
matthewwalsh0
marked this pull request as ready for review
November 12, 2026 11:42
3 of 4 tasks
This branch was successfully deployed
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
The max-amount quote flow (atomic-first max quotes, subsidized promotion, and the gas station re-quote) lives in
RelayStrategyand reads Relay's quote shape directly, so it can't be reused byServerStrategy.This moves it into provider-agnostic utilities, with no behaviour change:
utils/max-quote.ts:getMaxQuotesruns the max flow (atomic first when supported, otherwise non-atomic with subsidized promotion, including the MFA keyring guard from fix(transaction-pay-controller): keep max quotes non-atomic for MFA keyrings #11389). Also exportsisAtomicMaxSupportedandisAtomicMaxQuote.utils/max-gas-station.ts:getMaxGasStationQuoteruns the probe → adjusted quote flow with the configurable cost buffer from feat(transaction-pay-controller): add buffer to max gas station cost #11434.getQuoteDetails(gas limits, gas station transactions, gasless, subsidized, target amount),getQuotes,requoteandvalidateAtomicQuote, so the shared code never reads a strategy's original quote.RelayStrategynow callsgetMaxQuotes;relay-max.tsis removed, along with the unusedisMaxGasStationmetadata tag andATOMIC_PROMOTION_FAILURE_PREFIXconstant.ServerStrategyadoption follows separately in #11418.References
Checklist
Note
Medium Risk
Refactors max-amount and gas-station quoting on payment-critical paths; behavior is intended to be unchanged but regression risk is moderate given removed Relay-only implementation and new shared routing.
Overview
Moves Relay-specific max-amount quoting into shared
utils/max-quoteandutils/max-gas-station, and wires Relay through strategy callbacks instead ofrelay-max.ts.The deleted
relay-maxmodule (and its large test file) is replaced bygetMaxQuotes(atomic-first vs promoted subsidized routes, MFA guard, atomic validation errors) andgetMaxGasStationQuote(probe → adjusted re-quote with gas buffer). Relay now implementsgetRelayMaxQuoteDetailsand passesgetQuotes/requote/validateAtomicQuoteinto the shared flow. Quote validation skips quotes already handled as atomic max viaisAtomicMaxQuote, and max call embedding usesisAtomicMaxSupportedinstead of inline feature-flag checks.Cleanup and tests:
ATOMIC_PROMOTION_FAILURE_PREFIXmoves intomax-quote.ts;isMaxGasStationmetadata and related oxlint suppressions are removed. New unit suites cover the shared max and gas-station paths; Relay gains a gasless max quote test and a submit test rename (source gas fee tokenvsmax-gas-station).GasStationStepDatais exported for reuse across strategies.Reviewed by Cursor Bugbot for commit e12bca0. Bugbot is set up for automated code reviews on this repo. Configure here.