Skip to content

Fix Across Predict withdraw gas payment edges#8762

Open
pedronfigueiredo wants to merge 1 commit into
pnf/predict-withdraw-across-submitfrom
pnf/predict-withdraw-across-gas
Open

Fix Across Predict withdraw gas payment edges#8762
pedronfigueiredo wants to merge 1 commit into
pnf/predict-withdraw-across-submitfrom
pnf/predict-withdraw-across-gas

Conversation

@pedronfigueiredo
Copy link
Copy Markdown
Contributor

@pedronfigueiredo pedronfigueiredo commented May 11, 2026

Summary

This is PR 4 of 4 in the core stack for Predict withdraws over Across.

  • Fixes TransactionController gas-fee-token publishing when native token usage is explicitly excluded.
  • Handles Across gas-station edge cases for post-quote Predict withdraws, including source-token gas pricing fallback when the gas station cannot price the token directly.
  • Caps prefunded post-quote Predict withdraw gas estimates at the configured Across fallback when batch simulation inflates the estimate.
  • Keeps transaction-pay-controller coverage at 100% and exercises the transaction-controller gas-fee-token path.

Stack

  1. Add Across Predict withdraw plumbing #8759: plumbing to identify Predict Across withdraws
  2. Add Across Predict withdraw quote support #8760: quote support
  3. Add Across Predict withdraw submit support #8761: submit support
  4. This PR: gas payment edge cases

Validation

  • yarn workspace @metamask/transaction-pay-controller run jest --no-coverage src/strategy/across/across-quotes.test.ts src/strategy/across/across-submit.test.ts src/strategy/across/AcrossStrategy.test.ts
  • yarn workspace @metamask/transaction-controller run jest --no-coverage src/utils/gas-fee-tokens.test.ts
  • yarn changelog:validate
  • yarn workspace @metamask/transaction-pay-controller run test
  • yarn workspace @metamask/transaction-controller run test

Note

Medium Risk
Touches gas-fee token selection and Across quote gas/fee calculations; mistakes could cause incorrect fee-token usage or failed submissions, but changes are localized and well-covered by new tests.

Overview
Fixes TransactionController pre-publish handling of selected gas fee tokens to respect excludeNativeTokenForFee (skip native-balance checks, force isExternalSign, and clear nonce) and adds coverage for this path.

Improves transaction-pay-controller Across post-quote Predict-withdraw quoting by capping inflated prefunded 7702 batch gas to the configured Across fallback, falling back to relaxed per-transaction estimates when batch simulation fails, and preferring source-token gas pricing for Predict-withdraws (including a fiat-rate-derived fallback when gas-station can’t price the source token). It also hardens gas-station token lookup when gas-fee-token estimation fails.

Reviewed by Cursor Bugbot for commit edb756c. Bugbot is set up for automated code reviews on this repo. Configure here.

@pedronfigueiredo pedronfigueiredo force-pushed the pnf/predict-withdraw-across-gas branch from aeb6df5 to b942291 Compare May 11, 2026 11:30
@pedronfigueiredo pedronfigueiredo self-assigned this May 11, 2026
@pedronfigueiredo pedronfigueiredo marked this pull request as ready for review May 11, 2026 13:33
@pedronfigueiredo pedronfigueiredo requested review from a team as code owners May 11, 2026 13:33
@pedronfigueiredo pedronfigueiredo force-pushed the pnf/predict-withdraw-across-submit branch from 0e2bce3 to 013d596 Compare May 11, 2026 13:55
@pedronfigueiredo pedronfigueiredo force-pushed the pnf/predict-withdraw-across-gas branch from b942291 to 84b56cb Compare May 11, 2026 13:57
@pedronfigueiredo pedronfigueiredo force-pushed the pnf/predict-withdraw-across-submit branch from 013d596 to 2b8de19 Compare May 12, 2026 09:59
@pedronfigueiredo pedronfigueiredo force-pushed the pnf/predict-withdraw-across-gas branch from 84b56cb to 02d07d3 Compare May 12, 2026 10:01
pull Bot pushed a commit to dmrazzy/core that referenced this pull request May 12, 2026
## Summary

This is PR 1 of 4 in the core stack for Predict withdraws over Across.

- Adds `TransactionType.predictAcrossWithdraw`.
- Treats `isPostQuote` requests as actionable for Across support checks.
- Allows source-chain authorization lists only for post-quote Predict
withdraw detection, where the original withdraw is not encoded as an
Across destination action.
- Generalizes transaction-pay refund documentation from Relay-only
language to quote-provider language.

## Stack

1. This PR: plumbing to identify Predict Across withdraws
2. MetaMask#8760: quote support
3. MetaMask#8761: submit support
4. MetaMask#8762: gas payment edge cases

## Validation

- `yarn workspace @metamask/transaction-pay-controller run jest
--no-coverage src/strategy/across/AcrossStrategy.test.ts`
- Full stack validation was run on the final stacked branch:
  - `yarn changelog:validate`
  - `yarn workspace @metamask/transaction-pay-controller run test`
  - `yarn workspace @metamask/transaction-controller run test`

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes Across quote eligibility logic to treat `isPostQuote` requests
as actionable and to allow EIP-7702 `authorizationList` only for a
specific Predict-withdraw post-quote path; misclassification could
incorrectly enable/disable Across quoting for some transactions.
> 
> **Overview**
> Introduces a new `TransactionType.predictAcrossWithdraw` to tag
Predict withdraws that will use Across.
> 
> Updates `AcrossStrategy.supports` to treat `isPostQuote` quote
requests as actionable and only accept them when the original
transaction is a Predict withdraw, plus adds
`hasUnsupportedTransactionAuthorizationList` to block EIP-7702
`authorizationList` usage except for the Predict-withdraw post-quote
detection case. Tests were extended to cover post-quote Predict withdraw
handling.
> 
> Minor docs/logic tweaks: `isAcrossQuoteRequest` now includes
`isPostQuote`, and `refundTo` comments were generalized from
Relay-specific wording to quote-provider wording.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
fc6f92e. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@pedronfigueiredo pedronfigueiredo force-pushed the pnf/predict-withdraw-across-submit branch from 2b8de19 to 0d353f0 Compare May 12, 2026 13:24
@pedronfigueiredo pedronfigueiredo force-pushed the pnf/predict-withdraw-across-gas branch from 02d07d3 to 17befc5 Compare May 12, 2026 13:25
@pedronfigueiredo pedronfigueiredo force-pushed the pnf/predict-withdraw-across-submit branch from 0d353f0 to 131e283 Compare May 12, 2026 16:26
@pedronfigueiredo pedronfigueiredo force-pushed the pnf/predict-withdraw-across-gas branch from 17befc5 to edb756c Compare May 12, 2026 16:26
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.

1 participant