Commit Graph

750 Commits (03078f328c49bc801fe6ffba263a1edbd2bdfbce)
 

Author SHA1 Message Date
Daniel Karzel 802dc61e7e Configuration for RPC urls and Bitcoin wallet name 3 years ago
bors[bot] 9eae0db9ac
Merge #156
156: Improve logging and network error handling r=D4nte a=D4nte



Co-authored-by: Franck Royer <franck@coblox.tech>
3 years ago
Franck Royer f1c07fbb6d
Remove incorrect todo 3 years ago
Franck Royer c25d5ff07e
Improve network logging 3 years ago
bors[bot] f84cd001b5
Merge #143
143: Upgrade to tokio 1.0 r=D4nte a=rishflab

When we were refactoring tests we realised we probably want the ability to abort a `tokio::JoinHandle` to kill the `EventLoop` to simulate a real world crash. tokio 1.0 is needed for this. It is probably about time to upgrade tokio anyway. 

In order to upgrade to tokio 1.0 the following dependencies were also upgraded in the swap crate and monero-harness-rs
* backoff
* libp2p
* request

UPDATE: This should be merged until the following dependencies are uprgraded to Tokio 1.0 or Tokio compat  is used

- [x] bitcoin-harness-rs https://github.com/coblox/bitcoin-harness-rs/pull/20

Co-authored-by: rishflab <rishflab@hotmail.com>
Co-authored-by: Franck Royer <franck@coblox.tech>
3 years ago
Franck Royer f9f17b0e23
Do not consider transfer proof sent until it's ack'd 3 years ago
Franck Royer b968c98805
remove unnecessary logs 3 years ago
Franck Royer cc76b201b5
Do not consider encrypted signature sent until it's ack'd 3 years ago
Franck Royer 5af3532cbf
Fix log messages 3 years ago
Franck Royer 108cc1e6cc
Use trait instead of passing struct 3 years ago
Franck Royer 80810e3605
Updates bors to include all docker tests 3 years ago
Franck Royer 09e0d3b877
Run docker tests in separate GitHub tasks 3 years ago
Franck Royer 704a8e7b01
Add swap id to tracing context 3 years ago
Franck Royer b8a9356d1b
Change expiries depending on the test goal 3 years ago
Franck Royer 5c2f83fd5d
Remove nightly chain 3 years ago
Franck Royer 49b8d19e41
test: Log state on failure 3 years ago
rishflab 0b69573129
Run tests on one thread, increase T1 3 years ago
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.
3 years ago
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
3 years ago
bors[bot] 73f89fefda
Merge #159
159: Introduce "one shots" r=D4nte a=D4nte

Instead of Alice sending messages to Bob by replying on a `RequestResponse` channel, she just acks reception on the channel and open her own channel to send messages to Bob.

This means we do not need to carry the channel around anymore and instead carry Bob's peer id.

We take this opportunity to rename messages as per the sequence diagram.

At this stage we only touch message 4 & 5 as they are the one shots messages of the protocol.

Decoupling message 4 from message 3 (still current called 2) will allow the introduction of an await/async behaviour that handles message 1, 2, 3.

To introduce message 1, 2, 3 we will introduced the async/await behaviour using https://github.com/comit-network/rust-libp2p-async-await

First, we need to upgrade tokio and libp2p.

Please note that thanks to this change, Alice now uses Bob's peer id to send message meaning that recovery is improved (as before we could not save the channel to the db).

Co-authored-by: Franck Royer <franck@coblox.tech>
3 years ago
Franck Royer 2073e88683
Remove wrapping if `ReadOneError` when unnecessary 3 years ago
Franck Royer 2929a8f101
Use the correct protocol support 3 years ago
Franck Royer b62ef9c2d9
Harmonizing naming 3 years ago
Franck Royer 8fd2620b83
Improve names for messages 4 and 5 3 years ago
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.
3 years ago
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.
3 years ago
Franck Royer d2a1937f51
Use `Message4` 3 years ago
Franck Royer 124d6f1ebb
Introduced Message 4 sent by Alice to replace message 2 response 3 years ago
Franck Royer edb93624f3
Introduce one shot code
To allow alice to be the requester for message 4.
3 years ago
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.
3 years ago
bors[bot] 91fe18a796
Merge #154
154: Clean up `lib.rs` r=D4nte a=D4nte

Do not remove it just yet as there are still issues with the CI but proceed with some clean up.

Merging this now to avoid further merge conflicts.

Co-authored-by: Franck Royer <franck@coblox.tech>
3 years ago
Franck Royer 10eeecfe54
Remove dependency of main.rs on lib.rs 3 years ago
Franck Royer f2a25ee49b
Move definitions out of lib.rs 3 years ago
Franck Royer b88a777bae
Remove dead code 3 years ago
bors[bot] e2170e60a7
Merge #155
155: Bob saves lock proof after received so he can resume swap r=da-kami a=da-kami

Introducing a new state was too much so I added the additional required information to the enum state rather than adding another struct. 

As discussed earlier we should cleanup the state machine (enum states vs data structs) at some point :)

Co-authored-by: Daniel Karzel <daniel@comit.network>
3 years ago
Daniel Karzel 33a9057b1f Move run_until is_target_state comparison functions into testutils 3 years ago
Daniel Karzel 3593f5323a Bob saves lock proof after received so he can resume swap 3 years ago
bors[bot] c5cfc2ce20
Merge #153
153: Remove newlines from import statements to avoid problems r=da-kami a=da-kami

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.

Co-authored-by: Daniel Karzel <daniel@comit.network>
3 years ago
Daniel Karzel 433704e48c Top to bottom `pub mod` then `mod` then `pub use` then `use` (incl. `use crate` and `use self`) 3 years ago
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.
3 years ago
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>
3 years ago
bors[bot] fbfc17c489
Merge #142
142: Rename Swap amounts to Swap req/res r=D4nte a=D4nte

As per #140

Question: Do we prefer `Negotiation Request/Response` to `Swap Request/Response`?

Co-authored-by: Franck Royer <franck@coblox.tech>
3 years ago
Franck Royer 8c76abcd37
Remove TODO
This can be tackle when migrating to SQLite
3 years ago
Franck Royer 898b8bf8b0
Remove dead code 3 years ago
Franck Royer ae8134f04e
Replace amounts messages with swap res/req 3 years ago
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)
3 years ago
Daniel Karzel 9fa900dce8
Merge pull request #148 from comit-network/properly-wait-for-tx-finality-for-assertion-on-bitcoin-balance
Wait for Bob's refund finality
3 years ago
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.
3 years ago
bors[bot] d6bf66c1f4
Merge #150
150: Few improvements r=D4nte a=D4nte



Co-authored-by: Franck Royer <franck@coblox.tech>
3 years ago
Franck Royer 94045b9a69
Use builder in tests 3 years ago