Commit Graph

2161 Commits

Author SHA1 Message Date
Daniel Karzel
7832ee94f3 Remove unused code and only expose necessary functionality 2021-01-18 14:10:17 +11:00
Daniel Karzel
8ef8240771 Refactor refund test 2021-01-18 14:10:16 +11:00
Daniel Karzel
55024572ae Refactor punish test and punish assertions 2021-01-18 14:10:16 +11:00
Daniel Karzel
73a2841ec5 Refactor happy path bob restart tests 2021-01-18 14:10:00 +11:00
Daniel Karzel
8a2eb07928 Harmonize names and structure
Simple renames and structure changes, no logical changes.
2021-01-15 19:34:51 +11:00
Daniel Karzel
bede1c13dd Refactor Bob's side (happy path + alice restart)
Refactor Bob's test setup in the same way as Alice's.
Introduce BobHarness that allows creating and restarting as well as asserting redeemed for Bob.
2021-01-15 19:29:26 +11:00
Daniel Karzel
59f9a1c286 Fix usage of StartingBalance in Alice and Bob 2021-01-15 19:03:11 +11:00
Daniel Karzel
87edec0d50 Rename Alice's factory to harness and include redeem assertions
This makes the redeem assertion reusable for all tests with a redeem scenario.
Since the factory was not a clean factory before and is now doing even more it was renamed to harness.
2021-01-15 18:46:14 +11:00
Daniel Karzel
152c8d7eba Refactor Alice restart test by introducing factory for creating Alices
The factory keeps all static state of Alice to be able to simulate a restart.
2021-01-15 18:14:19 +11:00
Daniel Karzel
b031bc5e42 Re-export run_until 2021-01-15 11:49:47 +11:00
rishflab
537d05e01e Add reusable test function
We introduce a reusable test function to make it easier to add new tests and make our existing tests more readable.
2021-01-15 11:26:32 +11:00
rishflab
9cbf6e9774 Re-export event loop handles 2021-01-15 10:42:49 +11:00
rishflab
6040f2ae63 Re-export event loops 2021-01-15 10:31:25 +11:00
rishflab
e8fdf62623 Re-export swap function 2021-01-15 10:20:18 +11:00
rishflab
f5cfe014be Fix imports 2021-01-15 10:13:39 +11:00
bors[bot]
a4cd75d394
Merge #141
141: Clean-up r=D4nte a=D4nte

Remove dead code I noticed while starting to work on network revamp.

Co-authored-by: Franck Royer <franck@coblox.tech>
2021-01-14 02:10:10 +00:00
Franck Royer
39d95e141d
Merge pull request #140 from comit-network/revamp-network 2021-01-14 13:09:21 +11:00
Franck Royer
6003f87301
In phase A, message can be send simultaneously so calling them both 0. 2021-01-14 11:52:16 +11:00
Franck Royer
c5bfbf8da9
Clarify who is user/SP 2021-01-14 11:48:49 +11:00
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