Skip to content

fix: select gas account for private send when megafuel is suppressed (OK-59993) - #12916

Merged
originalix merged 7 commits into
xfrom
fix/ok-59993-private-send-payer-selection
Aug 20, 2026
Merged

fix: select gas account for private send when megafuel is suppressed (OK-59993)#12916
originalix merged 7 commits into
xfrom
fix/ok-59993-private-send-payer-selection

Conversation

@weatherstar

@weatherstar weatherstar commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

OK-59993


Summary

Follow-up to #12867, addressing the P1 finding from the automated review: #12867 (comment)

Private Send suppresses Megafuel, but selectedPayer was still derived from the raw backend payer. On BNB-chain responses where the fee service returns payer='megafuel' together with an eligible Gas Account quote, the confirm flow cleared Megafuel for display yet kept selectedPayer='user', so the sponsored quote was silently dropped and the tx broadcast user-paid.

Fix

  • Extract the payer derivation into resolveSponsorPayerState() (packages/kit/src/views/SignatureConfirm/utils/gasAccountPayerSelection.ts), which derives effectiveFeePayer (display) and selectedPayer (submit wiring) together from the post-filtered sponsor state so they can no longer drift.
  • When Megafuel is suppressed for Private Send and the server prefers megafuel, an eligible Gas Account quote now falls through to selectedPayer='gasAccount' with its idempotencyKey, and effectiveFeePayer follows — the sponsored coupon shows and the broadcast uses the sponsored submit path (TxConfirmActions requires both payers aligned).
  • All other combinations (custom RPC, batch, scenario-disabled, temporarily-disabled, megafuel actually available) keep their existing behavior.

Tests

  • 16 new unit tests in gasAccountPayerSelection.test.ts covering the preserved behaviors and the Private Send fallback.
  • yarn agent:check --profile pr passes.

OK-59993

@sidmorizon

Copy link
Copy Markdown
Contributor

@codex review

@sidmorizon

Copy link
Copy Markdown
Contributor

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@sidmorizon

Copy link
Copy Markdown
Contributor

@cursoragent review

@cursor

cursor Bot commented Aug 18, 2026

Copy link
Copy Markdown

Taking a look!

Open in Web Open in Cursor 

@sidmorizon sidmorizon left a comment

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.

Review


Generated by Claude Code

Comment thread packages/kit/src/views/SignatureConfirm/components/TxFee/TxFeeInfo.tsx Outdated
- Guard gas account quote eligibility on a non-empty quoteId via
  isGasAccountQuoteEligible(), aligning resolveSponsorPayerState input
  with every downstream quoteId gate (fee display, precheck, broadcast)
- Add unit tests fixing the invariant: quote object without quoteId
  resolves to user/user even on the Private Send megafuel fallback
- Append the bug-fix retrospective entry to case-studies.md
@weatherstar
weatherstar requested a review from sidmorizon August 19, 2026 03:42
An id-less quote with serverPayer='gasAccount' previously kept
effectiveFeePayer at 'gasAccount' while selectedPayer fell back to
'user', showing the sponsored UI while broadcasting user-paid. Reset
effectiveFeePayer to 'user' when the quote is not eligible, and cover
the direct gasAccount path with unit tests.
@originalix
originalix merged commit d1c9cc1 into x Aug 20, 2026
22 checks passed
@originalix
originalix deleted the fix/ok-59993-private-send-payer-selection branch August 20, 2026 05:47
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