-
Notifications
You must be signed in to change notification settings - Fork 98
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
fix(tpu-v2): provide ethcoin support in tpu kickstart process #2300
base: fix-tpu-v2-wait-for-payment-spend
Are you sure you want to change the base?
fix(tpu-v2): provide ethcoin support in tpu kickstart process #2300
Conversation
d08fa86
to
df7778c
Compare
This reverts commit df7778c.
…swap_kickstart_handler_for_taker in swap_kick_starts func
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, 3 minor 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.
Thanks
LGTM
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.
Please ping me once you are done with reviews @borngraced
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!
Can you add test coverage for ETH ? Seems like we have one for UTXOs komodo-defi-framework/mm2src/mm2_main/tests/docker_tests/swap_proto_v2_tests.rs Lines 722 to 723 in ea5f307
|
I can, but it will be on sepolia and use feature flag |
No problem I guess, better than nothing |
…-for-payment-spend-kickstart
…-for-payment-spend-kickstart
6c332f2
to
1e10d83
Compare
1e10d83
to
d48cc25
Compare
…d' into fix-tpu-v2-wait-for-payment-spend-kickstart
Added |
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.
re-approve
let uuids = block_on(start_swaps(&mut mm_bob, &mut mm_alice, &[(ETH, ETH1)], 1.0, 1.0, 77.)); | ||
log!("{:?}", uuids); | ||
let parsed_uuids: Vec<Uuid> = uuids.iter().map(|u| u.parse().unwrap()).collect(); | ||
|
||
for uuid in uuids.iter() { | ||
log_swap_status_before_stop(&mm_bob, uuid, "Maker"); | ||
log_swap_status_before_stop(&mm_alice, uuid, "Taker"); | ||
} |
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.
nit: uuids
is just a single item in a vector. you might want to extract it.
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.
The loop handles unexpected cases where there might be more than one swap.
Logging all uuids (even if vec has one element) ensures we don’t miss anything if something goes wrong, making the test more reliable.
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.
The loop handles unexpected cases where there might be more than one swap.
tbh, i don't think this should be our way to approach things, this will leave us with a lot of dept.
and i don't think there should even be any unexpected cases in a test.
that's my opinion about the reasoning, but the thing is still a nit.
// Restart Bob and Alice | ||
bob_conf.conf["dbdir"] = mm_bob.folder.join("DB").to_str().unwrap().into(); | ||
bob_conf.conf["log"] = mm_bob.folder.join("mm2_dup.log").to_str().unwrap().into(); |
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.
nit: or you might just use MarketMakerIt::seednode_trade_v2
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.
As I see we do this in every kickstart test
komodo-defi-framework/mm2src/mm2_main/tests/docker_tests/swaps_file_lock_tests.rs
Lines 149 to 163 in 5750415
// mm_bob using same DB dir that should kick start the swap | |
bob_conf["dbdir"] = mm_bob.folder.join("DB").to_str().unwrap().into(); | |
bob_conf["log"] = mm_bob.folder.join("mm2_dup.log").to_str().unwrap().into(); | |
// dropping instead of graceful stop to retain swap file locks | |
drop(mm_bob); | |
let mut mm_bob_dup = MarketMakerIt::start(bob_conf, "pass".to_string(), None).unwrap(); | |
let (_bob_dup_dump_log, _bob_dup_dump_dashboard) = mm_dump(&mm_bob_dup.log_path); | |
log!("{:?}", block_on(enable_native(&mm_bob_dup, "MYCOIN", &[], None))); | |
log!("{:?}", block_on(enable_native(&mm_bob_dup, "MYCOIN1", &[], None))); | |
block_on(mm_bob_dup.wait_for_log(50., |log| log.contains(&format!("Swap {} kick started.", uuid)))).unwrap(); | |
// mm_alice using same DB dir that should kick start the swap | |
alice_conf["dbdir"] = mm_alice.folder.join("DB").to_str().unwrap().into(); | |
alice_conf["log"] = mm_alice.folder.join("mm2_dup.log").to_str().unwrap().into(); |
RaiiDump
is used to avoid the issue rust-lang/rust#42474
komodo-defi-framework/mm2src/mm2_test_helpers/src/for_tests.rs
Lines 1205 to 1214 in 5750415
/// When `drop`ped, dumps the given file to the stdout. | |
/// | |
/// Used in the tests, copying the MM log to the test output. | |
/// | |
/// Note that because of https://github.com/rust-lang/rust/issues/42474 it's currently impossible to share the MM log interactively, | |
/// hence we're doing it in the `drop`. | |
pub struct RaiiDump { | |
#[cfg(not(target_arch = "wasm32"))] | |
pub log_path: PathBuf, | |
} |
According the last comments some problems still occur, so its better to follow current approach in tests
alice_conf.conf["dbdir"] = mm_alice.folder.join("DB").to_str().unwrap().into(); | ||
alice_conf.conf["log"] = mm_alice.folder.join("mm2_dup.log").to_str().unwrap().into(); | ||
alice_conf.conf["seednodes"] = vec![mm_bob.ip.to_string()].into(); |
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.
nit: or MarketMakerIt::light_node_trade_v2
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.
btw, why create a different mm2_dup.log
? u could not call mm_dump
if u want.
This pr provides EthCoin support in kickstart handler for taker and maker swaps
added
test_v2_eth_eth_kickstart