forked from jl777/SuperNET
-
Notifications
You must be signed in to change notification settings - Fork 118
feat(tpu-v2): provide swap protocol versioning #2324
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
Merged
shamardy
merged 16 commits into
dev
from
fix-tpu-v2-wait-for-payment-spend-swap-version
Feb 12, 2025
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
65a8df9
swap_version field
laruh 7e4ca64
add swap_version field in MySwapForRpc structure,
laruh d768995
review: use const fn
laruh 41c7037
review: call const legacy func in use_trading_proto_v2 fnc
laruh 53a1200
review: use const fn in more places
laruh 8bf8cbb
review: rename function
laruh 5e56b2f
review: provide set_legacy_swap_v func
laruh d19867c
review: compare references
laruh e3c9b26
review: remove const in tests
laruh 306e15b
review: create swap_versioning module
laruh 5a3dfed
review: make is_legacy func const
laruh 0b8deab
review: make SwapVersion::version u8
laruh fe1bfc3
keep backward compatibility for old swaps in database
laruh 731e605
review: fix consts names
laruh 8b76118
review: write rmp tests for TakerRequest and MakerReserved.
laruh ae307e6
review: get alice bob swap versions from match and order for legacy k…
laruh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be useful to add the version to
stats_swapstable as well. It should be done in another PR though as this is should be merged soon.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed that currently we don't need the swap version in
my_swapstable as we haveswap_typehttps://github.com/KomodoPlatform/komodo-defi-framework/blob/731e605fc2b53b9f4afa9e13e3682c5be7ed9cf6/mm2src/mm2_main/src/database/my_swaps.rs#L89 https://github.com/KomodoPlatform/komodo-defi-framework/blob/39515a9f3ea1089bb462e99c8cafb1049a920dbd/mm2src/mm2_main/src/lp_swap.rs#L152-L154 but version can be different from type in the future, for instanceMAKER_SWAP_V2_TYPEwhich s TPU Maker can have multiple versions but one type. Just thought to mention this and the redundancy we have.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I see these TYPE consts were provided to separate legacy and swap_v2 taker/maker data formats in database. I think it is something different from swap protocol version.
Well may be in practice we will see, will taker/maker types be different from swap protocol version or not.
ps: This field is useful for
MySwapForRpc, as it can be retrieved from bothget_taker_swap_data_for_rpcandget_maker_swap_data_for_rpc. Having a readyswap_versionfield simplifies the process of determining the swap version.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand, that's why I said currently :)
What I meant was that we could have converted this type to the version without adding a new column for now, that's all. But I like having version explicitly and resolving this comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving it only for
stats_swaps#2324 (comment)