Skip to content

Add Across support for Predict withdraw post-quote flows#8593

Open
pedronfigueiredo wants to merge 14 commits intomainfrom
pnf/predict-withdraw-across
Open

Add Across support for Predict withdraw post-quote flows#8593
pedronfigueiredo wants to merge 14 commits intomainfrom
pnf/predict-withdraw-across

Conversation

@pedronfigueiredo
Copy link
Copy Markdown
Contributor

@pedronfigueiredo pedronfigueiredo commented Apr 27, 2026

Why

Predict withdraw funds can originate in the Predict proxy/Safe and need to be withdrawn to the source account before Across can bridge them. This flow has to keep the original withdrawal, any EIP-7702 authorization, and source-token gas payment on MetaMask's source-chain batch instead of embedding them as Across destination actions.

Flow

For Predict withdraw post-quote Across execution, the EOA submits one source-chain batch. The first batch leg calls the Predict Safe/proxy withdrawal so USDC.e moves from the Safe/proxy to the recipient EOA; the Safe/proxy does not initiate the transaction or need native gas. That same EOA then approves the Across spender and deposits/swaps through Across. Across uses the EOA as the quote recipient, while refundAddress is set to the Safe when available so refunds go back to the Safe.

What changed

  • Adds Across support for Predict withdraw post-quote flows using exact-input source-chain quotes with no Across destination actions.
  • Adds predictAcrossWithdraw to TransactionType so the Across bridge leg is typed separately from the original Predict withdrawal.
  • Prepends the original Predict withdrawal before the Across approval/swap leg during submission.
  • Supports source-token gas payment for eligible 7702 accounts, including gas-station pricing, fiat-derived fallback pricing, and source amount re-quoting after reserving max gas.
  • Allows source-chain EIP-7702 authorization lists for Predict withdraw post-quote flows while continuing to reject authorization lists in Across destination actions.
  • Adds focused strategy, quote, and submit coverage for Predict withdraw post-quote flows.

Reviewer notes

  • Source-token gas is only selected when the account can use 7702; non-7702 accounts stay on the native-gas path.
  • The Safe/proxy does not need native tokens for the withdrawal leg; gas is paid by the EOA-submitted outer batch, either with native gas or the selected 7702 source-token gas path.
  • Source-token gas quotes disable native-token fee fallback at submission so execution follows the fee path that was quoted.
  • Forced source-token gas submissions still trigger TransactionController gas-fee-token publishing so the transaction fetches gas fee tokens and is marked for external gas-station signing.
  • Post-quote source-network fee totals add the original withdrawal gas cost while preserving Across approval/swap gas pricing.
  • Submit re-estimates 7702 batch gas when the final batch includes the prepended withdrawal but the quote only priced the Across legs.

Note

Medium Risk
Changes Across quoting and submission logic (including EIP-7702 authorization-list handling and gas-fee-token selection), which can affect transaction batching and fee payment behavior. Risk is mitigated by extensive new unit coverage but touches critical transaction execution paths.

Overview
Adds Across support for Predict withdraw post-quote flows by introducing a new TransactionType.predictAcrossWithdraw and allowing isPostQuote Across requests that quote as exact input with no destination actions, plus optional refundTo forwarded as refundAddress.

Updates Across strategy validation to allow source-chain EIP-7702 authorization lists only for Predict-withdraw post-quote requests, and extends quote normalization to reserve/pay source-chain gas with the source token (with stricter failure behavior for post-quote), including fallback pricing when gas-station pricing is unavailable.

Extends Across submission to prepend the original withdrawal leg into the batch, align gas limits accordingly, optionally re-estimate 7702 batch gas when the final batch shape differs from the quote, and set excludeNativeTokenForFee so execution follows the quoted gas-fee-token path; TransactionController gas-fee-token pre-publish now treats excludeNativeTokenForFee as forcing external signing and nonce clearing.

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

@pedronfigueiredo pedronfigueiredo self-assigned this Apr 27, 2026
Base automatically changed from pnf/gasless-across to main May 4, 2026 09:59
@pedronfigueiredo pedronfigueiredo force-pushed the pnf/predict-withdraw-across branch 2 times, most recently from d11ee7f to 4165ac4 Compare May 6, 2026 14:48
@pedronfigueiredo pedronfigueiredo changed the title Add Across Predict withdraw support Add Across support for Predict withdraw post-quote flows May 6, 2026
@pedronfigueiredo pedronfigueiredo marked this pull request as ready for review May 6, 2026 17:58
@pedronfigueiredo pedronfigueiredo requested review from a team as code owners May 6, 2026 17:58
@pedronfigueiredo pedronfigueiredo force-pushed the pnf/predict-withdraw-across branch from e6e9d0c to f6be627 Compare May 6, 2026 18:00
Comment thread packages/transaction-pay-controller/src/strategy/across/across-submit.ts Outdated
@pedronfigueiredo pedronfigueiredo force-pushed the pnf/predict-withdraw-across branch from a592bc4 to ff863e1 Compare May 7, 2026 12:58
Copy link
Copy Markdown

@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.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ff863e1. Configure here.

@pedronfigueiredo pedronfigueiredo force-pushed the pnf/predict-withdraw-across branch 2 times, most recently from 31eef1c to f1eea84 Compare May 7, 2026 14:51
@pedronfigueiredo pedronfigueiredo force-pushed the pnf/predict-withdraw-across branch from f1eea84 to 294498c Compare May 7, 2026 15:20
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