feat: route test and try_from_tagged_swap_context#41
Draft
Arrowana wants to merge 2 commits intoblueshift-gg:masterfrom
Draft
feat: route test and try_from_tagged_swap_context#41Arrowana wants to merge 2 commits intoblueshift-gg:masterfrom
Arrowana wants to merge 2 commits intoblueshift-gg:masterfrom
Conversation
Contributor
|
The protocol tag makes sense, would solve the same problem with Damm V2 swaps |
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.
Summary
It is insufficient to drive swapping with program id since:
A. a program might have a new swap instruction, which requires different accounts and data see any major protocol Meteora DLMM, Orca Whirlpool...
B. One single program can ship with multiple "swap" ixs (swap, deposit, withdraw...), example Jupiter perps, at which point there is a sort of tangle between data and accounts.
try_from_swap_contextdoes not have access to data.To support backward compatibility at runtime between clients and programs then those need to be addressed
Another solution is not to tag the exact desired swap and encapsulate that into the data which we would pass to the swap context, however this seems tricky for A. there will be ambiguity should a protocol ever change, as a result we just pay 1 byte to ensure uniform behaviour and future proofing every single swap.
As a result we use
SwapProtocolTagto match the swap.Changes
Testing
make formatmake clippymake testmake test-upstream(if relevant)Protocol integration checklist (if applicable)