Skip to content

feat: reserve network fees from native Relay Max (CONF-2006) - #10237

Draft
dan437 wants to merge 3 commits into
mainfrom
conf-2006-reserve-relay-fees
Draft

dan437 wants to merge 3 commits into
mainfrom
conf-2006-reserve-relay-fees

Conversation

@dan437

@dan437 dan437 commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Explanation

Relay Max quotes could commit the full native-token balance when the paying account did not support EIP-7702, leaving no funds for source-network fees.

This change re-quotes with the phase-one maximum network fee reserved. ERC-20 payments keep the existing insufficient-native-balance behavior.

References

  • CONF-2006

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Changes max-amount Relay quote math for native-token payments on non-EIP-7702 accounts, which affects how much users can send but improves transaction success.

Overview
Fixes Relay Max quotes that paid with native source tokens on accounts without EIP-7702, where the first quote could spend the entire balance and leave nothing for source-chain gas.

After the initial max quote, the flow now detects native source tokens (chain native address or Relay NATIVE_TOKEN_ADDRESS, e.g. Polygon) and re-quotes with sourceTokenAmount reduced by the phase-one max source-network fee. If reservation is impossible, the adjusted quote fails, or fees eat the whole max, it falls back to the phase-one quote unchanged.

ERC-20 max flows and accounts that support EIP-7702 still use the existing gas-station / native-balance logic; only this native-max + non-7702 branch is new. Tests and the package changelog document the behavior.

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

@dan437
dan437 marked this pull request as ready for review September 15, 2026 09:29
@dan437
dan437 requested review from a team as code owners September 15, 2026 09:29
@cursor

cursor Bot commented Sep 15, 2026

Copy link
Copy Markdown

Current version of PR was reviewed by /review-bugbot on Sep 15, 11:27 GMT+2. It flagged 0 findings.

Bugbot on commit b893649 is skipped.

@dan437
dan437 deployed to default-branch September 15, 2026 09:29 — with GitHub Actions Active
@saitanallensantiago26-beep

This comment was marked as spam.

@dan437 dan437 changed the title feat: reserve Relay fees from native Max (CONF-2006) feat: reserve network fees from native Relay Max (CONF-2006) Sep 15, 2026
@dan437
dan437 marked this pull request as draft September 15, 2026 09:43

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 c40a55d. Configure here.

Comment thread packages/transaction-pay-controller/src/strategy/relay/relay-max-gas-station.ts Outdated
@dan437
dan437 marked this pull request as ready for review September 15, 2026 11:41
@dan437
dan437 deployed to default-branch September 15, 2026 11:41 — with GitHub Actions Active
@dan437
dan437 marked this pull request as draft September 15, 2026 12:00
@matthewwalsh0
matthewwalsh0 requested a review from jpuri September 15, 2026 12:01
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.

3 participants