Commit Graph

370 Commits

Author SHA1 Message Date
Daniel Karzel
802dc61e7e Configuration for RPC urls and Bitcoin wallet name 2021-01-29 17:21:19 +11:00
Franck Royer
f1c07fbb6d
Remove incorrect todo 2021-01-29 16:13:25 +11:00
Franck Royer
c25d5ff07e
Improve network logging 2021-01-29 16:13:25 +11:00
Franck Royer
f9f17b0e23
Do not consider transfer proof sent until it's ack'd 2021-01-29 15:41:50 +11:00
Franck Royer
b968c98805
remove unnecessary logs 2021-01-29 15:41:50 +11:00
Franck Royer
cc76b201b5
Do not consider encrypted signature sent until it's ack'd 2021-01-29 15:41:50 +11:00
Franck Royer
5af3532cbf
Fix log messages 2021-01-29 15:41:50 +11:00
Franck Royer
108cc1e6cc
Use trait instead of passing struct 2021-01-29 15:41:49 +11:00
Franck Royer
704a8e7b01
Add swap id to tracing context 2021-01-29 13:29:24 +11:00
Franck Royer
b8a9356d1b
Change expiries depending on the test goal 2021-01-29 13:29:24 +11:00
Franck Royer
49b8d19e41
test: Log state on failure 2021-01-29 11:36:13 +11:00
rishflab
0b69573129
Run tests on one thread, increase T1 2021-01-29 11:36:13 +11:00
rishflab
1597f5336b
Restart event loop in tests
Alice was attempting to create a new event loop using the same listen addr as the old one which was still running. This commit aborts the event loop before creating a new one.
2021-01-29 11:36:13 +11:00
rishflab
77fc5743a2
Upgrade tokio to 1.0
Upgrade bitcoin harness dependency to latest commit

Upgrade backoff to fix failing tests. The previous version of backoff had a broken version of the retry function. Upgraded to a newer comit which fixes this problem.

Upgrade hyper to 0.14 as the 0.13 was bringing in tokio 0.2.24

Upgraded bitcoin harness to version that uses tokio 1.0 and reqwest 0.11

Upgrade reqwest to 0.11. Reqwest 0.11 uses tokio 1.0

Upgrade libp2p to 0.34 in preparation for tokio 1.0 upgrade
2021-01-29 11:36:10 +11:00
Franck Royer
2073e88683
Remove wrapping if ReadOneError when unnecessary 2021-01-27 14:33:43 +11:00
Franck Royer
2929a8f101
Use the correct protocol support 2021-01-27 14:27:59 +11:00
Franck Royer
b62ef9c2d9
Harmonizing naming 2021-01-27 14:25:45 +11:00
Franck Royer
8fd2620b83
Improve names for messages 4 and 5 2021-01-27 14:16:31 +11:00
Franck Royer
33db688e3a
Bob peer id can be retrieved from the DB
This remove branches where Alice resumes from the DB but cannot contact
Bob.
2021-01-22 17:19:20 +11:00
Franck Royer
a910bc2046
Box all messages in enum
The messages are very different, best to box them and save size on the
stack as an enum takes as much space on the stack than its bigger
variant.
2021-01-22 17:19:20 +11:00
Franck Royer
d2a1937f51
Use Message4 2021-01-22 17:19:20 +11:00
Franck Royer
124d6f1ebb
Introduced Message 4 sent by Alice to replace message 2 response 2021-01-22 17:00:40 +11:00
Franck Royer
edb93624f3
Introduce one shot code
To allow alice to be the requester for message 4.
2021-01-22 16:57:34 +11:00
Franck Royer
9a5e35c1bd
Rename bob::Message2 to Message5
As per the proposed changed in the sequence diagram.
The aim is to have a unique terminology per message instead of having
the same name for 2 consequent messages that share the same behaviour.

Note that the aim is to remove the shared `RequestResponse` behaviours.
2021-01-22 16:57:32 +11:00
Franck Royer
10eeecfe54
Remove dependency of main.rs on lib.rs 2021-01-22 09:00:49 +11:00
Franck Royer
f2a25ee49b
Move definitions out of lib.rs 2021-01-22 09:00:46 +11:00
Franck Royer
b88a777bae
Remove dead code 2021-01-22 08:59:09 +11:00
Daniel Karzel
33a9057b1f Move run_until is_target_state comparison functions into testutils 2021-01-21 23:39:55 +11:00
Daniel Karzel
3593f5323a Bob saves lock proof after received so he can resume swap 2021-01-21 23:35:54 +11:00
Daniel Karzel
433704e48c Top to bottom pub mod then mod then pub use then use (incl. use crate and use self) 2021-01-21 19:10:51 +11:00
Daniel Karzel
44c4b5dcea Remove newlines from import statements to avoid problems
Rust fmt automatically groups the imports (from top to bottom) as `pub use` `use crate` and `use`.
There is no need to introduce sections which cause annoyance when auto importing using the IDE.
2021-01-21 19:10:51 +11:00
bors[bot]
4e858197c9
Merge #149
149: Fix Alice redeem scenario r=da-kami a=da-kami

Follow up of #144, partial fix of https://github.com/comit-network/xmr-btc-swap/issues/137

 Fix Alice redeem scenario

- Properly check the timelocks before trying to redeem
- Distinguish different failure scenarios and reactions to it.
    - if we fail to construct the redeem transaction: wait for cancel.
    - if we fail to publish the redeem transaction: wait for cancel but let the user know that restarting the application will result in retrying to publish the tx.
    - if we succeed to publish the tx but then fail when waiting for finality, print error to the user (secreat already leaked, the user has to check manually if the tx was included)



Co-authored-by: Daniel Karzel <daniel@comit.network>
2021-01-21 06:27:38 +00:00
Franck Royer
8c76abcd37
Remove TODO
This can be tackle when migrating to SQLite
2021-01-21 12:27:32 +11:00
Franck Royer
898b8bf8b0
Remove dead code 2021-01-21 12:27:32 +11:00
Franck Royer
ae8134f04e
Replace amounts messages with swap res/req 2021-01-21 12:27:30 +11:00
Daniel Karzel
6a75c840b5 Fix Alice redeem scenario
- Properly check the timelocks before trying to redeem
- Distinguish different failure scenarios and reactions to it.
    - if we fail to construct the redeem transaction: wait for cancel.
    - if we fail to publish the redeem transaction: wait for cancel but let the user know that restarting the application will result in retrying to publish the tx.
    - if we succeed to publish the tx but then fail when waiting for finality, print error to the user (secreat already leaked, the user has to check manually if the tx was included)
2021-01-21 12:13:02 +11:00
Daniel Karzel
8a7d746e96 Wait for Bob's refund finality
For Alice we ensure to wait for redeem/punish finality, so it should be the same for Bob.
2021-01-21 10:36:08 +11:00
Franck Royer
94045b9a69
Use builder in tests 2021-01-20 21:42:35 +11:00
Franck Royer
c44b867d01
Delay the wrapping in Arc 2021-01-20 14:56:10 +11:00
Franck Royer
83b72c0a45
Make make_init_state and init_loop associated to alice::SwapFactory 2021-01-20 14:56:10 +11:00
Franck Royer
c11042ff0d
Use builder terminology instead of factory
This is not really a factory as a factory design pattern is about
producing several instances.

In the current usage, we are only interested in one swap instance. Once
the swap instance is created, the factory becomes useless. Hence, it is
more of a builder pattern.
2021-01-20 14:56:06 +11:00
Franck Royer
9148af2dbe
bob::SwapFactory should be consumed once a swap is returned 2021-01-20 14:51:37 +11:00
Franck Royer
652bfa14a9
Remove unnecessary pub qualifiers 2021-01-20 14:51:36 +11:00
Franck Royer
b21dc03ed0
alice::SwapFactory should be consumed once a swap is returned 2021-01-20 14:51:36 +11:00
Franck Royer
9b32409b8d
Remove unnecessary allow(clippy) 2021-01-20 14:51:35 +11:00
Franck Royer
9e3ef7ea24
Remove StartingBalances from release code 2021-01-20 14:51:35 +11:00
Franck Royer
181999e04f
Remove unnecessary alice qualifiers in alice::SwapFactor 2021-01-20 14:51:35 +11:00
Franck Royer
3bc76a91c6
Make init_state associated to bob::SwapFactory 2021-01-20 14:51:34 +11:00
Franck Royer
f0e6e45d56
Remove unecessary bob qualifier 2021-01-20 14:51:34 +11:00
Franck Royer
dbc633ea06
Remove unecessary connect qualifier 2021-01-20 14:51:34 +11:00