Daniel Karzel
8a7d746e96
Wait for Bob's refund finality
...
For Alice we ensure to wait for redeem/punish finality, so it should be the same for Bob.
2021-01-21 10:36:08 +11:00
Franck Royer
94045b9a69
Use builder in tests
2021-01-20 21:42:35 +11:00
Franck Royer
c11042ff0d
Use builder
terminology instead of factory
...
This is not really a factory as a factory design pattern is about
producing several instances.
In the current usage, we are only interested in one swap instance. Once
the swap instance is created, the factory becomes useless. Hence, it is
more of a builder pattern.
2021-01-20 14:56:06 +11:00
Franck Royer
9148af2dbe
bob::SwapFactory
should be consumed once a swap is returned
2021-01-20 14:51:37 +11:00
Franck Royer
b21dc03ed0
alice::SwapFactory
should be consumed once a swap is returned
2021-01-20 14:51:36 +11:00
Franck Royer
9e3ef7ea24
Remove StartingBalances
from release code
2021-01-20 14:51:35 +11:00
Franck Royer
181999e04f
Remove unnecessary alice
qualifiers in alice::SwapFactor
2021-01-20 14:51:35 +11:00
Franck Royer
f0e6e45d56
Remove unecessary bob
qualifier
2021-01-20 14:51:34 +11:00
Franck Royer
e26629b593
Remove unecessary fields from bob::SwapFactory
2021-01-20 14:51:34 +11:00
Franck Royer
96b1b18037
Keep terminology consistent
...
Also avoid redundant qualifiers.
2021-01-20 14:51:33 +11:00
Daniel Karzel
37f619dbfc
Move StartingBalances into protocol module
2021-01-20 13:29:46 +11:00
Daniel Karzel
acfd43ee79
Rename Test to TestContext and argument to ctx
2021-01-20 10:40:40 +11:00
Daniel Karzel
82974412b2
Remove roles from SwapFactory name as implied by module and cleanup
2021-01-19 09:43:50 +11:00
Daniel Karzel
75f89f3b25
Use Bob swap factory in production
2021-01-19 09:16:05 +11:00
Daniel Karzel
3398ef8236
Use Alice swap factory in production
2021-01-19 09:16:05 +11:00
Daniel Karzel
67e925fe1f
Refactor Bob's peer-id and identity to be handled on the outside
...
Doing this in the behaviour is a weird indirection that is not needed.
2021-01-19 09:16:04 +11:00
Daniel Karzel
0c19af9090
Refactor Alice's peer-id and identity to be handled on the outside
...
Doing this in the behaviour is a weird indirection that is not needed.
2021-01-19 09:16:04 +11:00
Daniel Karzel
8bf467b550
Make the factory code usable in production
...
- Introduce Test abstraction instead of tow harnesses, move test specific data into Test
- Change the abstraction from actors to swap, because we are creating swaps, not actors
- rename actor::swap to run, because we are running a swap
2021-01-19 09:16:04 +11:00
Franck Royer
9a823dca4c
Do not introduced State6
2021-01-18 15:27:38 +11:00
Daniel Karzel
8615aaed6e
Make lock-tx id available in redeem/punish state to be able to assert exact fees
2021-01-18 14:45:47 +11:00
Daniel Karzel
317b251302
Re-arrange order of structs/functions in testutils
...
move important things to the top and harmonize structure for alice and bob.
2021-01-18 14:10:17 +11:00
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
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