Franck Royer
ef906876a0
Increase timelocks on testnet
...
To allow time for stagenet Monero transaction to be mined.
2021-01-11 11:35:52 +11:00
Franck Royer
17356eaff9
Do not guard waiting for encrypted signature with arbitrary timeout
...
We already select waiting for this message with the cancellation expiry,
we do not need add another guard that tries to guess how long it would
for the Monero transaction to be finalised.
2021-01-11 11:35:52 +11:00
Franck Royer
95ecb02e7a
Small changes to make debugging easier and tests
2021-01-11 11:35:51 +11:00
Franck Royer
9d8f8b0a1f
P2p socket should be listening for external connections
2021-01-11 11:35:51 +11:00
rishflab
1c644cb377
Rename message behaviours
2021-01-09 11:47:23 +11:00
rishflab
5d7d72c826
Remove unused import
2021-01-09 10:10:48 +11:00
rishflab
387a4da2f6
Make modules private
2021-01-08 12:34:36 +11:00
rishflab
dcea54dbf1
Move protocol parent states into appropriate module
2021-01-08 12:34:36 +11:00
rishflab
f64eede5d8
Move monero ser/deser to monero module
2021-01-08 12:34:36 +11:00
rishflab
e7c00d742e
Re-export bitcoin and monero types
2021-01-08 12:34:36 +11:00
rishflab
c900d12593
Merge xmr_btc crate
...
Created network, storage and protocol modules. Organised
files into the modules where the belong.
xmr_btc crate moved into isolated modulein swap crate.
Remove the xmr_btc module and integrate into swap crate.
Consolidate message related code
Reorganise imports
Remove unused parent Message enum
Remove unused parent State enum
Remove unused dependencies from Cargo.toml
2021-01-08 12:34:33 +11:00
Daniel Karzel
487b880371
Cleanup unused config param that was accidentally introduced
2021-01-07 12:23:29 +11:00
Daniel Karzel
e031681369
Add minimum monero confirmations to config use it for Bob
2021-01-06 17:17:37 +11:00
Daniel Karzel
c6bc45e7a0
Wait for bitcoin tx finality before locking XMR
2021-01-05 14:31:10 +11:00
Daniel Karzel
30dd15774e
Log Bitcoin and Monero transaction IDs on info instead of debug
2021-01-05 14:11:26 +11:00
Daniel Karzel
0977d36703
Set log level to info instead of trace
2021-01-05 14:00:07 +11:00
Daniel Karzel
8a2128e93a
Correct monero-wallet-rpc parameter name
2021-01-05 11:00:15 +11:00
Daniel Karzel
4d9559fc2e
Monero network settings and testnet
2021-01-04 20:30:47 +11:00
Daniel Karzel
1f7e72b230
Log bitcoin harness and monero harness
2021-01-04 20:30:46 +11:00
Franck Royer
dd10e68db4
Merge pull request #113 from comit-network/clippy
2021-01-04 10:10:19 +11:00
Franck Royer
bcbc54b569
Type timelock and block height
...
To ensure no mistake is made (and none were!)
2021-01-04 08:40:53 +11:00
Franck Royer
81cbc24c46
Use action to name trait
2020-12-23 15:40:56 +11:00
Franck Royer
e1e8533862
Embed state mod in database mod
...
The `Swap` struct is now database specific, no need to have a 20 lines
module.
2020-12-23 15:30:23 +11:00
Franck Royer
59708c57e6
Move Alice and Bob db states in separate modules
2020-12-23 15:26:08 +11:00
Franck Royer
b410de01df
Move state.rs under database module
...
The types in state are only used for the database
2020-12-23 15:20:24 +11:00
Franck Royer
8c7964bfee
Rename storage.rs to database.rs to reduce terminology variants
2020-12-23 15:17:27 +11:00
Franck Royer
5ed18469e4
Move db state conversion with db type definition
...
Those conversion are specific to the database and should be defined with
in the database module.
2020-12-23 15:11:09 +11:00
Franck Royer
2a778f5644
Remove overzealous clippy overrides
...
We have overridden a number of clippy warnings such as
"large enum variant".
Considering that we have a number of issues
with the stack size in CI, it is more prudent to follow clippy's advice
and box larger items so that the enum does not take larger space.
Do note that an instance of the enum always takes as much space as its
largest variant.
2020-12-23 15:06:43 +11:00
Franck Royer
cdf2800fa5
Align clippy lints
...
Lints in `main.rs` are not used if there is a `lib.rs` file.
2020-12-23 14:33:29 +11:00
Franck Royer
ece689f5ca
There is only one binary, we should use main.rs
naming convention
2020-12-23 14:22:04 +11:00
Franck Royer
4150e75488
Replace Try_From
state conversion with From
for Bob
2020-12-23 14:12:29 +11:00
Franck Royer
5d1b10cc58
Align Bob DB states with swap states
2020-12-23 14:12:29 +11:00
Franck Royer
e541f7b83d
Replace TryFrom
with From
for Alice states
2020-12-23 14:12:29 +11:00
Franck Royer
69e1c2bb27
Align Alice DB states with swap states
2020-12-23 14:12:29 +11:00
Franck Royer
a31db63e54
Improve state names and display
2020-12-23 14:12:29 +11:00
Franck Royer
f0736d0906
Remove Refund timelock and T0/T1/T2
...
There are no refund timelock, only a cancellation timelock and punish
timelock.
Refund can be done as soon as the cancellation transaction is published.
2020-12-23 14:12:26 +11:00
Franck Royer
405e377f79
Rename EncSign
to EncSig
...
`EncSig` means "encrypted signature", the item,
not be confused with "signing", the action
2020-12-23 13:41:55 +11:00
bors[bot]
9c83ca52ad
Merge #107
...
107: Ensure that Bob can cancel correctly if T1 expired and Alice did not … r=da-kami a=da-kami
Bob has to check for the possibility to cancel in every state after he locked the BTC.
Otherwise Bob will try to perform actions that don't have any point and it might be impossible to use the `resume` command because it will always fail in trying to go on with Alice even though that might not be possible.
Co-authored-by: Daniel Karzel <daniel@comit.network>
2020-12-23 01:16:42 +00:00
Franck Royer
297b15e3ce
Remove async block when it is not needed
2020-12-23 09:17:56 +11:00
Franck Royer
e079b84500
Ensure we wait for other party to complete
...
Before we check the balances.
2020-12-23 09:17:41 +11:00
Franck Royer
1fa812b727
Separate Buy/Sell for resume command
...
To avoid confusing the user on whether person should enter a listen addr
or a connect peer id and address
2020-12-23 09:17:39 +11:00
Daniel Karzel
a692cf9299
Remove all short-codes because they don't add value at the moment
2020-12-22 18:10:13 +11:00
Daniel Karzel
c9d492d155
Only wait for xmr-lock until t1 expired
2020-12-22 17:08:17 +11:00
Daniel Karzel
83ce6f2c85
Ensure that Bob can cancel correctly if T1 expired and Alice did not move
...
Bob has to check for the possibility to cancel in every state after he locked the BTC.
Otherwise Bob will try to perform actions that don't have any point.
2020-12-22 16:27:25 +11:00
Daniel Karzel
8296490764
Merge pull request #111 from comit-network/trace-xmr-btc
...
Fix tracing subscribe filter for xmr-btc`
2020-12-22 16:17:27 +11:00
Daniel Karzel
5f8b7f2624
Fix tracing subscribe filter for xmr-btc`
2020-12-22 14:11:55 +11:00
Franck Royer
40a27a2438
Remove dead code
2020-12-22 13:50:36 +11:00
Franck Royer
df237f82cf
Fix clippy warning
2020-12-22 13:50:28 +11:00
Franck Royer
49b84d84b9
Add address at the start
...
Do not carry peer id around as we currently only expect one peer.
2020-12-22 13:47:05 +11:00
Franck Royer
1e4b115556
Separate Bob restart tests
...
To stabilize CI
2020-12-21 12:19:04 +11:00
Franck Royer
e366d3a73b
Join all futures to avoid hanging tests
2020-12-21 12:17:40 +11:00
Franck Royer
2abf65f3b6
Remove sleep that seems unnecessary
2020-12-21 10:25:36 +11:00
Franck Royer
4a4e23038b
Add logging to investigate add address race condition
2020-12-21 10:25:19 +11:00
Franck Royer
1a4bd0e2b4
Bob refunds swap after restart that requires communication
...
As Bob is dialing Alice, we now ensure that we are connected to Alice
at each step that needs communication.
If we are not connected, we proceed with dialing.
In an attempt to improve libp2p usage, we also add known address of
Alice first and only use peer_id to dial.
This ensures that we use the expected peer id.
2020-12-21 08:31:21 +11:00
Franck Royer
d9ea7ab605
Only carry the tx_lock_id instead of the full state
2020-12-21 08:19:39 +11:00
Franck Royer
edfab58246
Scope alice db
...
To better match the restart scenario
2020-12-21 08:19:39 +11:00
Franck Royer
dc96b3d1e9
Stop running first event loop after Alice restarts
2020-12-21 08:19:39 +11:00
Franck Royer
638143a10d
Replace hard coded port by dynamic available one
...
Fixes #84 .
2020-12-21 08:19:31 +11:00
Franck Royer
2212758d17
Rename refund test as it is alice specific
2020-12-21 08:13:42 +11:00
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
bors[bot]
4f631c0c9b
Merge #98
...
98: Remove tor module r=da-kami a=da-kami
This removes the currently unused `tor module`.
Different `tokio` versions have been causing issues with the `tor` module in the past (i.e. `Cargo.lock` broken problem...). It started causing issues again when adding a dependency to `jsonrpc_client` working on https://github.com/comit-network/xmr-btc-swap/pull/97
We don't support `tor` at the moment and are no planning to add this feature initially as it is not super important to users.
The functionality can easily added again at a later point.
Co-authored-by: Daniel Karzel <daniel@comit.network>
2020-12-18 02:10:25 +00:00
bors[bot]
88c29dbce5
Merge #94
...
94: T1Expired state for Bob and check expiries in states after both locked r=da-kami a=da-kami
Co-authored-by: Daniel Karzel <daniel@comit.network>
2020-12-18 01:20:30 +00:00
Daniel Karzel
4046305474
Merge pull request #88 from comit-network/resume-swap-cli
...
Resume command and global database cl-parameter
2020-12-18 11:42:54 +11:00
Daniel Karzel
20893c1bb1
Cleanup Display for database states
2020-12-18 11:39:21 +11:00
Daniel Karzel
e6493784bf
Change pin_mut!
to select!
2020-12-18 11:37:02 +11:00
Daniel Karzel
773eebc723
Cleanup resume_from_database functions only used in tests
2020-12-18 10:50:32 +11:00
Daniel Karzel
e9681b6e2b
Work in review comments
2020-12-17 19:10:24 +11:00
Daniel Karzel
43d05935e7
Remove tor module
2020-12-17 18:50:15 +11:00
Daniel Karzel
093cbaa4b4
Introduce T1Expired state for Bob properly and check expiries in states after both locked
2020-12-17 15:17:15 +11:00
Daniel Karzel
6d03d1bbff
Resume command and global database cl-parameter
2020-12-15 21:40:52 +11:00
Franck Royer
71cf501c29
Delete bob::negotiate
...
This module was intended to contain helper functions for each step.
However, those are not needed except for the negotiate step.
A dedicated module is not needed for one function.
2020-12-15 16:53:50 +11:00
Franck Royer
19066200d1
Add a TODO to use existing helper functions
...
Helper functions already exist on the xmr-btc crate states, use them
like it is done in the bob module.
2020-12-15 16:51:23 +11:00
Franck Royer
84bec0631b
Rename alice::negotiate to steps
...
This module includes helper function for each state.
2020-12-15 16:49:38 +11:00
Franck Royer
53d13330c2
Remove dupe code
2020-12-15 16:45:06 +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
Franck Royer
8cc470a80e
Use -ed
terminology for cancel state
2020-12-15 11:47:05 +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
3692046758
Bob's recover function
2020-12-15 11:43:27 +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
c4cdd098fd
Use from instead of try_from for Alice state conversion
2020-12-15 10:19:03 +11:00
Franck Royer
caf903acda
wip: Add test for when bob restarts
2020-12-15 10:18:48 +11:00
Franck Royer
905fc6cf35
Save Bob state during swap
2020-12-15 10:18:46 +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