Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solana: fix stack access violation #17

Merged
merged 3 commits into from
Nov 12, 2024

Conversation

a5-pickle
Copy link
Contributor

This is a breaking change.

Instead of using init_if_needed for swap ATAs, these ATAs are now expected to be created before invoking any of the swap instructions:

  • initiate_swap_exact_in
  • complete_swap_direct
  • complete_swap_payload
  • complete_swap_relay

Anchor's init (and init_if_needed) macro directives use a good chunk of stack memory. But the stack access errors aren't detected until runtime. To avoid this completely, we require that the create idempotent Associated Token program instruction be called for each of the swap's source and destination token accounts.

The only instruction having this issue was complete_swap_payload. But we made the swap ATA handling consistent among all of the instructions above.

fix stack access violation with complete swap payload

remove init_if_needed for swap ATAs
@tonyjin tonyjin requested review from tonyjin and johnsaigle November 5, 2024 20:16
@tonyjin tonyjin merged commit 058d622 into wormhole-foundation:main Nov 12, 2024
12 checks passed
@tonyjin tonyjin deleted the stack-access-issue branch November 12, 2024 15:52
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