Repository navigation
refactor(transaction-pay-controller): extract post-quote gas helpers from the Relay strategy - #10805
Merged
Merged
Conversation
3 of 4 tasks
Base automatically changed from
refactor/transaction-pay-polymarket-utils
to
main
October 13, 2026 16:07
…from the Relay strategy
matthewwalsh0
force-pushed
the
refactor/transaction-pay-post-quote
branch
from
October 14, 2026 13:29
f35a6de to
ea9634a
Compare
… the quote gas module
matthewwalsh0
force-pushed
the
refactor/transaction-pay-post-quote
branch
from
October 14, 2026 13:49
3ed4f55 to
f5b1abf
Compare
matthewwalsh0
marked this pull request as ready for review
October 14, 2026 16:30
Member
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
jpuri
approved these changes
Oct 15, 2026
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
Post-quote gas handling lives inside the Relay strategy, but the server strategy needs the same logic to support Predict withdraws. This moves it into shared helpers with no change in behaviour.
estimateSourceGasestimates source-chain gas for a quote's transactions, including the original transaction prepended in post-quote flows, the fixed allowances when it cannot be estimated, and an optionalfromoverride.reservePostQuoteGasre-quotes with the gas cost reserved from the source amount, using a strategy-provided re-quote callback.References
Checklist
Note
Medium Risk
Touches quote amounts and gas limits for post-quote and EIP-7702 batch paths; behavior is intended to be unchanged but mistakes could affect funding and gas-fee-token eligibility.
Overview
Refactors post-quote gas logic out of the Relay strategy into shared utilities so other pay strategies (e.g. server/Predict withdraw) can reuse the same behavior without duplicating it.
reservePostQuoteGascentralizes the two-phase post-quote flow: when gas must be paid from the committed source balance (gas fee token or native source), it buffers the estimated gas cost, subtracts it fromsourceTokenAmountwhen needed, and re-quotes via a callback—with the same fallbacks (sufficient headroom, insufficient amount after subtraction, lost gas-fee-token eligibility, re-quote errors).estimateSourceGascentralizes source-chain gas estimation for quote steps plus transactions prepended at submit time: batch-estimating the original transaction with relay steps for post-quote EIP-7702 detection, optionalfromOverridefor Safe-style flows, and fixed allowances when the original tx cannot be included (payment override, account override, missingto/gas).The Relay strategy now delegates to these helpers instead of large inline blocks in
relay-quotes.ts; dedicated unit tests cover the extracted logic.Reviewed by Cursor Bugbot for commit f5b1abf. Bugbot is set up for automated code reviews on this repo. Configure here.