Commit Graph

486 Commits (31c63f0c4de954e90a2a0b5ac7ac81d5e68d8c62)
 

Author SHA1 Message Date
Franck Royer 31c63f0c4d
Remove dead code 4 years ago
Franck Royer 0852f90473
Remove unused variant 4 years ago
Franck Royer eecee30d99
Use exact xmr amount, Remove ACK
- Use exact XMR amount
- Remove ACK, this can be added as a feature once needed.
4 years ago
Franck Royer 8ff33bd386
Use exact xmr amount 4 years ago
Franck Royer 6b4a02427a
Use global counter to name messages 4 years ago
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
4 years ago
Franck Royer 1e08a17bd9
Last message is also request response 4 years ago
Lucas Soriano del Pino 07270df12a Clarify diagram 4 years ago
Franck Royer c53d54ddab
Add sequence diagram 4 years ago
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>
4 years ago
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.
4 years ago
bors[bot] ca6ba78862
Merge #123
123: Small fixes after testnet usage r=da-kami a=D4nte



Co-authored-by: Franck Royer <franck@coblox.tech>
4 years ago
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>
4 years ago
Daniel Karzel bfc388d264 Enable tracing in monero-harness 4 years ago
Daniel Karzel 664958939d Create network::Seed from swap::Seed instead of abstracting over byte array 4 years ago
Daniel Karzel f18d01dfaf Deterministic peer id from seed for bob 4 years ago
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`.
4 years ago
Franck Royer 6ffc66867c
Typo
Co-authored-by: Daniel Karzel <daniel.karzel@coblox.tech>
4 years ago
Franck Royer 047f990d05
Improve error reporting on signature verification 4 years ago
Franck Royer ef906876a0
Increase timelocks on testnet
To allow time for stagenet Monero transaction to be mined.
4 years ago
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.
4 years ago
Franck Royer 95ecb02e7a
Small changes to make debugging easier and tests 4 years ago
Franck Royer 9d8f8b0a1f
P2p socket should be listening for external connections 4 years ago
rishflab 64ba8d6a87
Merge pull request #125 from comit-network/reorganise-modules-2
Merge xmr_btc crate
4 years ago
rishflab 1c644cb377 Rename message behaviours 4 years ago
rishflab 5d7d72c826 Remove unused import 4 years ago
rishflab 387a4da2f6 Make modules private 4 years ago
rishflab a3e896684c Delete leftover xmr_btc crate 4 years ago
rishflab dcea54dbf1 Move protocol parent states into appropriate module 4 years ago
rishflab f64eede5d8 Move monero ser/deser to monero module 4 years ago
rishflab e7c00d742e Re-export bitcoin and monero types 4 years ago
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
4 years ago
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>
4 years ago
Daniel Karzel 487b880371 Cleanup unused config param that was accidentally introduced 4 years ago
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>
4 years ago
Daniel Karzel e031681369 Add minimum monero confirmations to config use it for Bob 4 years ago
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>
4 years ago
Daniel Karzel c6bc45e7a0 Wait for bitcoin tx finality before locking XMR 4 years ago
Daniel Karzel 30dd15774e Log Bitcoin and Monero transaction IDs on info instead of debug 4 years ago
Daniel Karzel 0977d36703 Set log level to info instead of trace 4 years ago
Daniel Karzel 72aa517af8 Work in review comments 4 years ago
Daniel Karzel 8a2128e93a Correct monero-wallet-rpc parameter name 4 years ago
Daniel Karzel 4d9559fc2e Monero network settings and testnet 4 years ago
Daniel Karzel 1f7e72b230 Log bitcoin harness and monero harness 4 years ago
Franck Royer dd10e68db4
Merge pull request #113 from comit-network/clippy 4 years ago
bors[bot] 97eb24a26c
Merge #114
114: Type timelock and block height r=D4nte a=D4nte

To ensure no mistake is made (and none were!)

Co-authored-by: Franck Royer <franck@coblox.tech>
4 years ago
Franck Royer bcbc54b569
Type timelock and block height
To ensure no mistake is made (and none were!)
4 years ago
Franck Royer 81cbc24c46
Use action to name trait 4 years ago
Franck Royer e1e8533862
Embed state mod in database mod
The `Swap` struct is now database specific, no need to have a 20 lines
 module.
4 years ago
Franck Royer 59708c57e6
Move Alice and Bob db states in separate modules 4 years ago