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
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
f5cfe014be
Fix imports
2021-01-15 10:13:39 +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
rishflab
dcea54dbf1
Move protocol parent states into appropriate module
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
4d9559fc2e
Monero network settings and testnet
2021-01-04 20:30:47 +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
4150e75488
Replace Try_From
state conversion with From
for Bob
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
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
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
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
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
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
Daniel Karzel
773eebc723
Cleanup resume_from_database functions only used in tests
2020-12-18 10:50:32 +11:00
Daniel Karzel
43d05935e7
Remove tor module
2020-12-17 18:50:15 +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
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
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