Skip to content

fix(transaction-pay-controller): ignore synthetic across gas legs#8527

Merged
pedronfigueiredo merged 4 commits intomainfrom
pnf/across-perps-gas-leg-fix
Apr 21, 2026
Merged

fix(transaction-pay-controller): ignore synthetic across gas legs#8527
pedronfigueiredo merged 4 commits intomainfrom
pnf/across-perps-gas-leg-fix

Conversation

@pedronfigueiredo
Copy link
Copy Markdown
Contributor

@pedronfigueiredo pedronfigueiredo commented Apr 20, 2026

Problem observed in testing

The perps direct deposit flow could include a synthetic gas-funding leg, generated internally for native ETH on Arbitrum, with targetAmountMinimum: '0'. That leg was optional and not the real asset the user was trying to deposit, but the Across strategy support check still evaluated it as if it were a required quote leg. As a result, a valid perps deposit request could be marked unsupported before quote resolution, because the optional gas leg made the whole request set fail strategy validation.

The fix was to make Across treat those zero-minimum synthetic gas legs consistently everywhere. A shared helper was introduced to identify “real” Across quote requests, and both quote fetching and strategy support now filter out requests where targetAmountMinimum === '0' unless it is a max-amount flow. In practice, that means the real deposit leg can proceed while the optional gas top-up leg no longer disqualifies the route. The turn also added a regression test covering exactly that case: one real perps deposit leg plus one synthetic native-token gas leg, and the strategy now correctly returns supported.

Summary

  • ignore synthetic zero-target gas legs when evaluating Across support
  • share the same request filter between Across support checks and quote building
  • add coverage for perps direct deposits that include a synthetic gas leg

Testing

  • yarn jest --config packages/transaction-pay-controller/jest.config.js --watchman=false packages/transaction-pay-controller/src/strategy/across/AcrossStrategy.test.ts --coverage=false

Note

Medium Risk
Changes Across strategy request filtering, which affects whether routes are considered supported and which legs are quoted; mistakes could cause valid quotes to be skipped or unsupported routes to be attempted.

Overview
Fixes Across strategy validation/quoting to ignore synthetic “gas” legs (requests with targetAmountMinimum: '0') so they don’t cause perps direct deposits to be marked unsupported.

Introduces a shared isAcrossQuoteRequest helper and applies it consistently in both AcrossStrategy.supports and getAcrossQuotes, and adds regression tests covering mixed real+synthetic legs, all-synthetic legs, and isMaxAmount zero-minimum behavior.

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

@pedronfigueiredo pedronfigueiredo force-pushed the pnf/across-perps-gas-leg-fix branch from 343d279 to 52950da Compare April 20, 2026 17:07
export function isAcrossQuoteRequest(request: QuoteRequest): boolean {
return (
request.isMaxAmount === true ||
(request.targetAmountMinimum !== undefined &&
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: (request.targetAmountMinimum ?? '0') !== '0'
Any real amount maps to true.

@pedronfigueiredo pedronfigueiredo added this pull request to the merge queue Apr 21, 2026
Merged via the queue into main with commit fa76127 Apr 21, 2026
350 checks passed
@pedronfigueiredo pedronfigueiredo deleted the pnf/across-perps-gas-leg-fix branch April 21, 2026 14:55
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.

2 participants