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
Adjusts gas-fee-token selection and Across quote fee calculation logic, which can affect whether transactions proceed and how much gas is reserved/charged. Changes are well-covered by new tests but touch transaction publishing and fee estimation paths.

Overview
Fixes TransactionController pre-publish gas-fee-token handling so excludeNativeTokenForFee forces the external-sign/gas-fee-token path (skipping native-balance checks) and clears nonce when preparing to publish with a selected gas token.

Improves Across post-quote Predict-withdraw fee handling by (1) preferring source gas-fee-token pricing even if native balance is available (with a guard when the account can’t use 7702), (2) adding a fiat-rate-based fallback when the gas station can’t price the source token, and (3) capping inflated prefunded 7702 batch gas estimates to the configured Across fallback and falling back to relaxed per-transaction estimates when batch estimation fails.

Adds extensive unit tests for these edge cases and updates changelogs for both transaction-controller and transaction-pay-controller.

Reviewed by Cursor Bugbot for commit 84b56cb. 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
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