test: Integration tests for Bob and Alice swaps#845
test: Integration tests for Bob and Alice swaps#845codebestia wants to merge 6 commits intoeigenwallet:masterfrom
Conversation
|
Did you run them? |
|
Hello @binarybaron |
swap/tests/bob_xmr_validation.rs
Outdated
| let (bob_swap, bob_join_handle) = ctx.bob_swap().await; | ||
| let bob_swap_id = bob_swap.id; | ||
| let bob_swap = tokio::spawn(bob::run_until(bob_swap, |s| { | ||
| matches!(s, BobState::WaitingForCancelTimelockExpiration { .. }) |
There was a problem hiding this comment.
We need to ensure that Bob goes into XmrLockTransactionCandidate and then into WaitingForCancelTimelockExpiration.
| let bob_state = bob_swap.await??; | ||
| assert!(matches!( | ||
| bob_state, | ||
| BobState::WaitingForCancelTimelockExpiration { .. } |
There was a problem hiding this comment.
Same here: We need to ensure that Bob goes into XmrLockTransactionCandidate and then into WaitingForCancelTimelockExpiration.
swap/tests/bob_xmr_validation.rs
Outdated
| let bob_swap_id = bob_swap.id; | ||
|
|
||
| let bob_swap = tokio::spawn(bob::run_until(bob_swap, |s| { | ||
| matches!(s, BobState::WaitingForCancelTimelockExpiration { .. }) |
There was a problem hiding this comment.
Same here: We need to ensure that Bob goes into XmrLockTransactionCandidate and then into WaitingForCancelTimelockExpiration.
swap/tests/bob_xmr_validation.rs
Outdated
| let bob_state = bob_swap.await??; | ||
| assert!(matches!( | ||
| bob_state, | ||
| BobState::WaitingForCancelTimelockExpiration { .. } |
There was a problem hiding this comment.
Same here: We need to ensure that Bob goes into XmrLockTransactionCandidate and then into WaitingForCancelTimelockExpiration.
swap/tests/bob_xmr_validation.rs
Outdated
| } | ||
|
|
||
| #[tokio::test] | ||
| async fn given_correct_xmr_amount_bob_redeems_btc() { |
There was a problem hiding this comment.
Can be removed as this is already tested in swap/tests/happy_path.rs.
| state3.xmr = state3.xmr.checked_sub(one_piconero).unwrap(); | ||
|
|
||
| Self::BtcLocked { state3 } | ||
| } |
|
The new test also needs to be added to |
|
Hello @binarybaron |
|
@binarybaron Could you take a look at this PR? |
|
Please stop tagging me. I will review it once we find time. |



Overview
Adds integration tests to validate Bob's Monero (XMR) amount verification logic during atomic swaps. These tests ensure Bob correctly validates the XMR amount Alice locks before proceeding, protecting against incorrect or malicious amounts.
Related Issue
Closes #828