bors[bot]
3db71997d3
Merge #99
...
99: Cleanup resume_from_database functions only used in tests r=da-kami a=da-kami
Follow up of https://github.com/comit-network/xmr-btc-swap/pull/88
Co-authored-by: Daniel Karzel <daniel@comit.network>
2020-12-18 03:01:18 +00:00
Daniel Karzel
773eebc723
Cleanup resume_from_database functions only used in tests
2020-12-18 10:50:32 +11:00
Daniel Karzel
43d05935e7
Remove tor module
2020-12-17 18:50:15 +11:00
rishflab
9d266fc648
Add balance assertions to restart tests
2020-12-15 13:11:16 +11:00
Franck Royer
5ba830f3bf
Replace swap recover
terminology with resume
2020-12-15 11:52:00 +11:00
Daniel Karzel
b83ab71669
Split up tests into separate files to overcome CI failure
2020-12-15 11:43:28 +11:00
Daniel Karzel
7cae6a9e4d
Add Bob restart test
2020-12-15 11:43:28 +11:00
Daniel Karzel
4ec2da29a0
Modularize Bob's test setup (separate init for state, event_loop)
2020-12-15 11:43:28 +11:00
Daniel Karzel
9a930af33f
Remove duplicated restart+refund test, move tests into separate files
2020-12-15 11:43:28 +11:00
Daniel Karzel
91d4d5da25
Cleanup swap execution to not return EventLoopHandle, refactor both_refund test
2020-12-15 11:43:28 +11:00
Daniel Karzel
bf39c34ada
Alice restart and refund test if restarted before encsig learner
2020-12-15 11:43:27 +11:00
Daniel Karzel
8c929564ef
Refactor container initialization
2020-12-15 11:43:27 +11:00
rishflab
143d8bc07d
Move message0 response handler out of NB
2020-12-15 11:43:24 +11:00
Daniel Karzel
4143394767
Add recovery function for Alice
2020-12-15 11:40:40 +11:00
rishflab
4b00141c29
Fix happy path test
2020-12-15 11:40:36 +11:00
Franck Royer
7092af457a
Introduced DB for Alice & Bob
2020-12-15 11:38:36 +11:00
Franck Royer
4ce8695dfc
Align with origin/database
2020-12-15 11:29:38 +11:00
Franck Royer
1a5b9f9fa9
Update tests after rebase
2020-12-15 10:19:45 +11:00
Franck Royer
caf903acda
wip: Add test for when bob restarts
2020-12-15 10:18:48 +11:00
Franck Royer
7e0a1ffe84
Remove generator for bob
2020-12-15 10:14:43 +11:00
Franck Royer
c6af5eb9ac
Introduce test where alice restarts before all communications are done
2020-12-15 10:10:43 +11:00
Franck Royer
3580b7ed2c
Add test where Alice restart after encsign is learned
2020-12-15 10:10:42 +11:00
Franck Royer
a22efaa7bc
Remove unneeded peer id argument
2020-12-15 10:10:42 +11:00
Franck Royer
9323f22009
Reorder calls
2020-12-15 10:10:42 +11:00
Franck Royer
a24d1a49b9
Remove unneeded as_ref_calls
2020-12-15 10:10:42 +11:00
Franck Royer
1c7cc7ee46
Scope futures' instanciation
2020-12-15 10:10:42 +11:00
Franck Royer
6226e5789f
Introduce test where alice restart mid-swap
2020-12-15 10:10:42 +11:00
Franck Royer
71a0832ef4
Add zero const to monero::Amount
2020-12-15 10:10:42 +11:00
Franck Royer
64b021daf4
Save Alice states in db
2020-12-15 10:10:40 +11:00
Franck Royer
11cea9ba69
Remove passing alice peer id
...
The usage of the peer id is incorrect as we do not even check it when
dialing. For now, we can ignore it.
We can then re-introduce it and use it properly at a later stage.
2020-12-15 09:15:38 +11:00
rishflab
082f4eb005
Use unused port in refund test
2020-12-11 17:36:28 +11:00
rishflab
7af4b6980a
Test Alice refunds after Bob refund
...
Reworked Alice XmrLocked state transition handler to handle the
scenario when Alice received the encsig but Bob refunds.
Previously Alice was trying to redeem after receiving the encsig
without checking if t1 had elapsed.
2020-12-11 17:05:34 +11:00
rishflab
773390886b
Test that Bob refunds if Alice fails to act
2020-12-11 16:59:29 +11:00
rishflab
f806ad7231
Assert balances after punish
2020-12-11 16:59:29 +11:00
bors[bot]
9fecf7008e
Merge #61
...
61: Prepare CLI for mainnet swap r=da-kami a=da-kami
Co-authored-by: Daniel Karzel <daniel@comit.network>
2020-12-11 03:48:01 +00:00
Daniel Karzel
03b8e5f52e
Upgrade CLI for mainnet test
2020-12-11 14:46:29 +11:00
Daniel Karzel
aad7a22f81
Utility function for initializing tracing for tests
2020-12-11 13:35:47 +11:00
Franck Royer
c0478d7191
Move expiries to config
...
So they can be different for mainnet and regtest
2020-12-10 14:43:17 +11:00
rishflab
9ba89194b0
Rename swarm driver to event loop
2020-12-10 13:29:53 +11:00
rishflab
f5d3d54b13
Prevent premature Bob t1 timeout
...
Bob was hitting the t1 timeout and entering cancel
instead of redeem. This was resolved by increasing
the timeouts to 50.
2020-12-10 13:29:53 +11:00
rishflab
27d1334726
Init Alice behaviour with state0
...
Previously state0 had to be set after creating Alice's behaviour.
With the event loop we no longer has access to the swarm so
set_state0() has to be called indirectly through a channel. This
means it is difficult to guarantee state0 is being set due to the
asynchronous nature of channels. This was solved by initialising
Alice with state0.
2020-12-10 13:29:53 +11:00
rishflab
3d8866f1a0
Convert event loop to use fused futures select
...
Co-authored-by: Daniel Karzel <daniel@comit.network>
2020-12-10 13:29:53 +11:00
rishflab
58da1df9dc
Create SwarmDriverHandle to resolve ownership issues
2020-12-10 11:24:08 +11:00
rishflab
6f7408ecce
Drive swarm in seperate async task
...
Previously the libp2p swarm had to be manually polled within the
protocol execution code to execute actions such as sending a
message. The swarm is now wrapped in SwarmDriver which polls the
swarm in a seperate task
2020-12-10 11:24:05 +11:00
rishflab
bd8e6e36e0
Fix monero blocktime config
2020-12-09 15:10:29 +11:00
Daniel Karzel
1a2857af29
Properly init tracing per test and reverse the filter to be exclusive
...
Tracing should be initialized by test and the `_guard` kept alive within the test.
Re-using this code in different tests does not really have any additional value.
Instead of specifying what messages we want to include, I went for a filter that excludes noise.
That way we get more useful logging.
2020-12-09 11:48:53 +11:00
rishflab
883a913f30
Remove nonsensical monero * monero multiplication
2020-12-08 16:12:00 +11:00
rishflab
627b1a9f00
Remove unnecessary execution restart
2020-12-07 14:03:50 +11:00
rishflab
8592ef5f79
Address PR feedback
...
Add context to logging statements. Use amount type for monero in tests. Remove stale
code and comments.
2020-12-07 13:55:13 +11:00
rishflab
b4ac69fa9c
Reduce stack size to prevent CI resource issues
2020-12-07 09:44:26 +11:00