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
borngraced
left a comment
There was a problem hiding this comment.
Great work! first review iteration
# Conflicts: # mm2src/coins/utxo/utxo_standard.rs
|
@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.
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.
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.
| 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.
why not merge the two features?
There was a problem hiding this comment.
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.
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)
MakerCoinSwapOpsV2trait for ETHeth_swap_v2moduleIn addition, added additional
wait_for_maker_payment_spendfunction toMakerCoinSwapOpsV2trait. 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_spendusage inMakerPaymentSpentstate before changing it toCompletedhttps://github.com/KomodoPlatform/komodo-defi-framework/blob/8f983ec362cb00704b27582b8c0dc3e9934aa912/mm2src/mm2_main/src/lp_swap/taker_swap_v2.rs#L2195-L2203
Note
Provided two test features to be able to test maker and taker swap v2 contracts separately on sepolia.