-
Notifications
You must be signed in to change notification settings - Fork 94
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
feat(eth-swap): maker tpu v2 implementation #2211
Conversation
# Conflicts: # mm2src/coins/lp_coins.rs
78f6a09
to
7498eec
Compare
…ap ops, remove `swap_contract_addres` from NFT swap args
24004a2
to
f2aee82
Compare
f2aee82
to
5d9d1de
Compare
428480f
to
72ed306
Compare
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.
Great work! first review iteration
# Conflicts: # mm2src/coins/utxo/utxo_standard.rs
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.
last notes
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.
welldone!
@laruh I think there is nothing to test or document by @KomodoPlatform/qa for this PR, if that's the case please add |
#[cfg(any(feature = "sepolia-maker-swap-v2-tests", feature = "sepolia-taker-swap-v2-tests"))] | ||
lazy_static! { | ||
pub static ref SEPOLIA_WEB3: Web3<Http> = Web3::new(Http::new(SEPOLIA_RPC_URL).unwrap()); | ||
pub static ref SEPOLIA_NONCE_LOCK: Mutex<()> = Mutex::new(()); |
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.
does this use any docker instance? why don't we move such tests outside docker (to test_inner)?
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.
Hmm, yes, the Sepolia code doesn’t use Geth-generated addresses.
We could move the code to the sepolia_tests
test crate.
However, there’s still a chance that when we update the Swap V2 smart contracts, for example add burnFee
to the taker swap contract, this contract could start working on the Geth node (we faced similar issue during the NFT maker swap V2 implementation and testing). In that case, the code could be moved back to docker_tests.
Let’s plan this when we update the taker swap v2 contract, if it doesn’t work on Geth, we’ll move taker/maker Sepolia code to a separate test crate.
// Mutex used to prevent nonce re-usage during funding addresses used in tests | ||
pub static ref GETH_NONCE_LOCK: Mutex<()> = Mutex::new(()); | ||
} | ||
|
||
#[cfg(any(feature = "sepolia-maker-swap-v2-tests", feature = "sepolia-taker-swap-v2-tests"))] |
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.
why not merge the two features?
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.
maker and taker methods are belong to different smart contracts. its better to have them separately, when you need to test only maker or only taker functionality
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.
tbh i would consider this (and not really much) only if these smart contracts are changed so often to justify having a feature to run them specifically, otherwise i would just go for merging these feature flags (or even ignoring the sepolia tests instead) and run tests by their names or name prefix.
i see features as more complexities if we can do without it.
* dev: fix(foot-shooting): remove leftover code that panics via RPC (#2270) refactor(MarketCoinOps): make `wait_for_htlc_tx_spend` async (#2265) feat(eth-swap): maker tpu v2 implementation (#2211) fix(nft): add token_id field to the tx history primary key, fix balance (#2209) feat(cosmos): support IBC types in tx history implementation (#2245) fix(hd-wallet): use `CoinBalanceMap` for UTXO and QTUM (#2259) fix(tests): add more sepolia endpoints in tests (#2262) fix(legacy-swap): check for confirmations on recover taker (#2242) fix(legacy-swap): remove the need for takers to confirm their payment (#2249) refactor(P2P): types and modules (#2256) fix(evm): correctly display eth addr in iguana v2 activation result (#2254) feat(utxo): prioritize electrum connections (#1966) refactor(SwapOps): make all methods async (#2251) refactor(SwapOps): make `send_maker_payment` async (#2250) remove old p2p implementation (#2248) feat(cosmos-offline-tests): prepare IBC channels inside the container (#2246)
MakerCoinSwapOpsV2
trait for ETHeth_swap_v2
moduleIn addition, added additional
wait_for_maker_payment_spend
function toMakerCoinSwapOpsV2
trait. It is needed to cover "taker doesnt wait for spend maker payment tx confirmation" issue which we faced in legacy swap protocol #2175 (comment)Later we can add
wait_for_maker_payment_spend
usage inMakerPaymentSpent
state before changing it toCompleted
komodo-defi-framework/mm2src/mm2_main/src/lp_swap/taker_swap_v2.rs
Lines 2195 to 2203 in 8f983ec
Note
Provided two test features to be able to test maker and taker swap v2 contracts separately on sepolia.