Commit Graph

34 Commits (master)

Author SHA1 Message Date
Daniel Karzel c0070f8fa7
Move files from `protocol` to appropriate module
Some network and application specific code does not belong in the protocol module and was moved.
Eventloop, recovery and the outside behaviour were moved to the respective application module because they are application specific.

The `swap_setup` was moved into the network module because upon change both sides will have to be changed and should thus stay close together.
3 years ago
Philipp Hoenisch 1706b36800
Log exchange rate at each state. 3 years ago
Thomas Eizinger e266fb07ef
Don't stutter 3 years ago
Daniel Karzel c976358c37
Multiple swaps with the same peer
- Swap-id is exchanged during execution setup. CLI (Bob) sends the swap-id to be used in his first message.
- Transfer poof and encryption signature messages include the swap-id so it can be properly associated with the correct swap.
- ASB: Encryption signatures are associated with swaps by swap-id, not peer-id.
- ASB: Transfer proofs are still associated to peer-ids (because they have to be sent to the respective peer), but the ASB can buffer multiple
- CLI: Incoming transfer proofs are checked for matching swap-id. If a transfer proof with a different swap-id than the current executing swap is received it will be ignored. We can change this to saving into the database.

Includes concurrent swap tests with the same Bob.

- One test that pauses and starts an additional swap after the transfer proof was received. Results in both swaps being redeemed after resuming the first swap.
- One test that pauses and starts an additional swap before the transfer proof is sent (just after BTC locked). Results in the second swap redeeming and the first swap being refunded (because the transfer proof on Bob's side is lost). Once we store transfer proofs that we receive during executing a different swap into the database both swaps should redeem.

Note that the monero harness was adapted to allow creating wallets with multiple outputs, which is needed for Alice.
3 years ago
Thomas Eizinger b9d8cbeaa2
Rename testutils to harness
This allows us to bring in a dependency named `testutils`.
3 years ago
Daniel Karzel d85c0ce57c Re-introduce punish test 3 years ago
Franck Royer 15eb9a2fe4
Remove punish test
The punish test needs re-work due to the fact that Alice runs continuously

Currently focusing on the CLI (Bob), so we can re-introduce this test
once we want to ensure that nectar (Alice) punishes.
3 years ago
Daniel Karzel c9adbde5d5 Add test for Bob's manual cancel and refund 3 years ago
Franck Royer c316ea5244
Upgrade toolchain
Needed to use libp2p-async-await
3 years ago
Franck Royer 108cc1e6cc
Use trait instead of passing struct 3 years ago
Franck Royer b8a9356d1b
Change expiries depending on the test goal 3 years ago
rishflab 1597f5336b
Restart event loop in tests
Alice was attempting to create a new event loop using the same listen addr as the old one which was still running. This commit aborts the event loop before creating a new one.
3 years ago
Daniel Karzel 33a9057b1f Move run_until is_target_state comparison functions into testutils 3 years ago
Daniel Karzel 433704e48c Top to bottom `pub mod` then `mod` then `pub use` then `use` (incl. `use crate` and `use self`) 3 years ago
Franck Royer b21dc03ed0
`alice::SwapFactory` should be consumed once a swap is returned 3 years ago
Daniel Karzel acfd43ee79 Rename Test to TestContext and argument to ctx 3 years ago
Daniel Karzel 3398ef8236 Use Alice swap factory in production 3 years ago
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
3 years ago
Daniel Karzel 8615aaed6e Make lock-tx id available in redeem/punish state to be able to assert exact fees 3 years ago
Daniel Karzel 55024572ae Refactor punish test and punish assertions 3 years ago
Daniel Karzel 664958939d Create network::Seed from swap::Seed instead of abstracting over byte array 3 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`.
3 years ago
rishflab dcea54dbf1 Move protocol parent states into appropriate module 3 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
3 years ago
Daniel Karzel 487b880371 Cleanup unused config param that was accidentally introduced 3 years ago
Daniel Karzel e031681369 Add minimum monero confirmations to config use it for Bob 3 years ago
Franck Royer a31db63e54
Improve state names and display 3 years ago
Franck Royer e366d3a73b
Join all futures to avoid hanging tests 3 years ago
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.
3 years ago
Franck Royer 638143a10d
Replace hard coded port by dynamic available one
Fixes #84.
3 years ago
Daniel Karzel 7cae6a9e4d
Add Bob restart test 4 years ago
Daniel Karzel 91d4d5da25
Cleanup swap execution to not return EventLoopHandle, refactor both_refund test 4 years ago
Daniel Karzel 8c929564ef
Refactor container initialization 4 years ago
Daniel Karzel 4143394767
Add recovery function for Alice 4 years ago