Commit Graph

542 Commits

Author SHA1 Message Date
Franck Royer
31c63f0c4d
Remove dead code 2021-01-14 11:40:34 +11:00
Franck Royer
0852f90473
Remove unused variant 2021-01-14 11:36:38 +11:00
Franck Royer
eecee30d99
Use exact xmr amount, Remove ACK
- Use exact XMR amount
- Remove ACK, this can be added as a feature once needed.
2021-01-14 10:46:50 +11:00
Franck Royer
8ff33bd386
Use exact xmr amount 2021-01-14 10:45:29 +11:00
Franck Royer
6b4a02427a
Use global counter to name messages 2021-01-14 10:28:46 +11:00
Franck Royer
c55f3e3403
Remove Req-Res and update for single market maker use case
- Bob initiate swap with BTC Amount
- Alice acks with approx. xmr amount
- Rework terminology, make a difference between negotiations and
execution setup
- Remove request response channels in favor of one shots
- Give exact amount to Bob once assets are locked
2021-01-13 16:58:21 +11:00
bors[bot]
9d307a4bea
Merge #138
138: Add sequence diagram r=D4nte a=D4nte



Co-authored-by: Franck Royer <franck@coblox.tech>
Co-authored-by: Lucas Soriano del Pino <l.soriano.del.pino@gmail.com>
2021-01-13 03:43:11 +00:00
Franck Royer
1e08a17bd9
Last message is also request response 2021-01-13 14:42:38 +11:00
Lucas Soriano del Pino
07270df12a Clarify diagram 2021-01-13 11:36:02 +11:00
Franck Royer
c53d54ddab
Add sequence diagram 2021-01-13 11:12:57 +11:00
Daniel Karzel
f8848aca55 Describe additional state for ToDo that might cause trouble
If we wait for lock transaction confirmations immediately after sending the transaction without saving this state to the DB this might cause locking the money twice.
An additional state is needed for such a scenario.
2021-01-12 14:39:17 +11:00
Daniel Karzel
59f01ad680 Remove Todo that was already actioned
This ToDo does not add any value, I would not know what to do here.
2021-01-12 14:39:17 +11:00
Daniel Karzel
60f3923a63 Set tracing level to Info in production code
Trace / Debug should be used when there is a problem. They print way too much in production.
2021-01-12 14:39:17 +11:00
Daniel Karzel
00b4f3110f Remove ToDo that is already actioned
We already have a second watcher for the cancel timelock, so refund is already actioned.
2021-01-12 14:39:17 +11:00
Daniel Karzel
ab9117aa4c Log Alice's lock tx proof receive on Bob's side 2021-01-12 14:39:17 +11:00
bors[bot]
2790dec6dc
Merge #119
119: Remember the block-height before XMR lock for generated monero wallet r=da-kami a=da-kami

The first approach https://github.com/comit-network/xmr-btc-swap/pull/121 was using `get_transfer_by_txid` that allows extrancting the exact tx-lock 1st confirmation block height. 
But that introduced an additional error scenario, and I actually ran into that error scenario (`transaction not found`) once I ran it on `stagenet`. Might be that `get_transfer_by_txid` requires running the node in a specific way (like `txindex` on bitcoin).  
I am not sure at this stage and don't want to invest more time.

Long story short: 
I opted for just recording the height before watching for XMR locked. This means that we record a height right after sending the Bitcoin lock tx. (Because we start watching for XMR lock right after that.) 
Bob's new wallet unnecessarily scans an additional 7+ blocks (assuming inclusion in the next Bitcoin block and one confirmation for Monero lock) every time which is a matter of milliseconds. Not worth optimising this further at this stage. This solution is more resilient as well, because it does not add another error scenario.

Co-authored-by: Daniel Karzel <daniel@comit.network>
2021-01-12 02:20:41 +00:00
Daniel Karzel
af45206fde Remember the block-height before XMR lock for generated monero wallet restore height
Speeds up wallet creation, because only the blocks after the recorded height will be scanned.
2021-01-12 13:18:49 +11:00
bors[bot]
ca6ba78862
Merge #123
123: Small fixes after testnet usage r=da-kami a=D4nte



Co-authored-by: Franck Royer <franck@coblox.tech>
2021-01-11 04:25:26 +00:00
bors[bot]
485220929e
Merge #127
127: Deterministic peer id for alice and bob r=da-kami a=da-kami

The first commit introduces a seed file similar to Nectar. Note, that the parameter --database was changed to --data-dir where the database is stored in the sub-folder database inside that data directory. This is breaking change, run commands will have to be adapted.
I opted for keeping the structure of generating an overall seed and then deriving the network seed from it (as in Nectar, where we use the seed for wallet creation as well). I feel this is cleaner than just using the seed for the network only.

The second commit applies the deterministic peer id to Bob as well. We don't have to do this because in the current setup Bob can have a new identity every time. I would still harmonize this to avoid confusion in the future. I don't see a reason why Bob's setup should be different from Alice here.

Co-authored-by: Daniel Karzel <daniel@comit.network>
2021-01-11 03:07:11 +00:00
Daniel Karzel
bfc388d264 Enable tracing in monero-harness 2021-01-11 12:55:19 +11:00
Daniel Karzel
664958939d Create network::Seed from swap::Seed instead of abstracting over byte array 2021-01-11 12:03:29 +11:00
Daniel Karzel
f18d01dfaf Deterministic peer id from seed for bob 2021-01-11 12:03:29 +11:00
Daniel Karzel
0a21040e08 Deterministic peer id from seed for alice
This includes the introduction of the --data-dir parameter instead of the --database.
Both the seed file and the database are stored in the data-dir, the database in sub-folder `database`.
2021-01-11 12:00:48 +11:00
Franck Royer
6ffc66867c
Typo
Co-authored-by: Daniel Karzel <daniel.karzel@coblox.tech>
2021-01-11 11:39:21 +11:00
Franck Royer
047f990d05
Improve error reporting on signature verification 2021-01-11 11:39:18 +11:00
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
64ba8d6a87
Merge pull request #125 from comit-network/reorganise-modules-2
Merge xmr_btc crate
2021-01-10 10:07:24 +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
a3e896684c Delete leftover xmr_btc crate 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
bors[bot]
a0d859147a
Merge #124
124: Cleanup unused config param that was accidentally introduced r=da-kami a=da-kami



Co-authored-by: Daniel Karzel <daniel@comit.network>
2021-01-07 23:04:31 +00:00
Daniel Karzel
487b880371 Cleanup unused config param that was accidentally introduced 2021-01-07 12:23:29 +11:00
bors[bot]
903469f62a
Merge #118
118: Add minimum monero confirmations to config use it for Bob r=da-kami a=da-kami

After discussion with @bonomat about enforced `10` confirmations until a tx is spendable on Monero I gave it a try with only `1` confirmation on regtest happy-path-test and `5` for `stagenet` and did not encounter problems. Both swaps passed without problems so I am proposing to merge these changes. 

One additional change crept in: Changed the average blocktime for `stagenet` to `4` mins, because the blocktime fluctuates a lot. See: https://monero-stagenet.exan.tech/

Co-authored-by: Daniel Karzel <daniel@comit.network>
2021-01-06 06:19:47 +00:00
Daniel Karzel
e031681369 Add minimum monero confirmations to config use it for Bob 2021-01-06 17:17:37 +11:00
bors[bot]
184f179044
Merge #115
115: Monero wallet network, Testnet r=da-kami a=da-kami

Add network for monero and switch application to run on Bitcoin `testnet3` and Monero `stagenet`.

Co-authored-by: Daniel Karzel <daniel@comit.network>
2021-01-05 03:42:51 +00: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
72aa517af8 Work in review comments 2021-01-05 11:26:00 +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