fix: F-2026-18815 | restore recipient ATA create on SVM revert and rescue - #355
Closed
Aman035 wants to merge 2 commits into
Closed
fix: F-2026-18815 | restore recipient ATA create on SVM revert and rescue#355Aman035 wants to merge 2 commits into
Aman035 wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #338. That PR dropped the client-side recipient ATA create on every path, but the gateway only creates it on withdraw.
The regression
The gateway's revert and rescue take their legacy SPL branch, which does a bare
pda_spl_transferintorecipient_token_accountand never creates it. Only theis_pc20branch callsensure_associated_token_account, andbuildRevertAccountspasses no remaining accounts, sois_pc20is always false for us.So after #338 an SPL revert or rescue whose recipient has no ATA for that mint fails on chain. It is reachable in normal use: the recipient is
RevertInstructions.FundRecipient, any address the user picks, falling back to the inbound sender.Fix
buildCreateATAIdempotentInstruction, scoped to instruction ids 3 and 4. Withdraw (1) stays untouched since the gateway creates and meters it.Tests
recipient_token_accountslot.TestBuildWithdrawAndExecuteAccounts_SPLSlotspins the eight SPL slots the gateway needs to create the withdraw ATA itself. Nothing covered them before, so a regression there would only surface on chain.Rent accounting
Revert reimburses the relayer the full signed
gas_fee, so the rent is covered there. Rescue reimburses measuredgas_used, which excludes a client-created ATA, so ~0.00204 SOL per fresh recipient stays on the relayer for that path. Closing it needs the gateway to create and meter the ATA on its legacy SPL branch, the same change it just made for withdraw in524ae41.