Commit Graph

508 Commits (1876d17ba456bcbc03b8854f5ed2444243ade75a)

Author SHA1 Message Date
Daniel Karzel e56c48ee23 Remove unused type 4 years ago
Daniel Karzel 3398ef8236 Use Alice swap factory in production 4 years ago
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.
4 years ago
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.
4 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
4 years ago
Daniel Karzel e4795fa4ee Fix recursive call to swap by using run_until
We should call run_until instead of swap.
4 years ago
bors[bot] 35c42263df
Merge #145
145: Make lock-tx id available in redeem/punish state to be able to assert exact fees r=da-kami a=da-kami

We can do exact assertions for Bob's redeem as well, but have to store Bob's tx_lock id in the respective final state. Make tx_lock available in BtcRedeemed and BtcPunished to have better assertions / harmonize test behaviour.

Storing this information is strictly speaking not needed for the production environment. But it is static information that can be seen as additional information that can be handy for a user. We could potentially extract it inside the tests as well (for redeem without restart would be a bit tricky), but I think this solution is more elegant. 

Co-authored-by: Daniel Karzel <daniel@comit.network>
Co-authored-by: Franck Royer <franck@coblox.tech>
Co-authored-by: bors[bot] <26634292+bors[bot]@users.noreply.github.com>
4 years ago
bors[bot] a7f68e4aa1
Merge #144
144: Test refactor r=da-kami a=da-kami

This PR is pure refactoring, keeping the logic of the tests we had before. No production code is touched besides re-exports in early commits (no logic changes).

In the follow ups improvements will be introduced, that touch the production code as well.

All remaining tasks actioned since Friday: 

- [x] `happy_path_bob _restart` (trivial)
- [x] add refund assertions to harnesses (trivial)
- [x] convert all refund scenarios currently being tested (trivial)
- [x] remove dead test init code once all old tests are converted
- [ ] ~~(optional) move alice and bob harness code into separate files~~ -> might action this once re-using test code in production.

Out of scope, follow up:
- [x] https://github.com/comit-network/xmr-btc-swap/pull/145 - We can do exact assertions for Bob's redeem as well, but have to store Bob's `tx_lock` id in the respective final state. Make `tx_lock` available in `BtcRedeemed` and `BtcPunished` to have better assertions / harmonize test behaviour. 
- [ ] update the production code to use the `Alice` and `Bob` structs to bundle the params - update tests to use the production struct.
- [ ] Re-use test swap setup in production (i.e. `Alice-/BobHarness::new`) to setup the swap.
- [ ] add additional tests
- [ ] re-try moving the tests from `test` to `src` (if the peer_id was the only problem this should be trivial now - but should be done after the refactor is finished)
- [ ] creating new wallets upon restart
- [ ] aborting the old event loop after restart

Co-authored-by: rishflab <rishflab@hotmail.com>
Co-authored-by: Daniel Karzel <daniel@comit.network>
4 years ago
Franck Royer 9a823dca4c
Do not introduced State6 4 years ago
bors[bot] 974b6ebf6f
Merge #136
136: Testnet resume fixes r=da-kami a=da-kami

Add a few log statements on Bob's side to make the user experience better.
Update / remove ToDos.

I set the log level to `Info` in main again, `Debug` heavily clutters the output. In order to make `Debug` more usable we might want to review printing all those `rpc` messages. But this goes beyond the scope of this PR.


Co-authored-by: Daniel Karzel <daniel@comit.network>
4 years ago
Daniel Karzel d4316f0cfe Print each monero confirmation for Bob
This is to provide more context to the user.
4 years ago
Daniel Karzel 8615aaed6e Make lock-tx id available in redeem/punish state to be able to assert exact fees 4 years ago
Daniel Karzel 317b251302 Re-arrange order of structs/functions in testutils
move important things to the top and harmonize structure for alice and bob.
4 years ago
Daniel Karzel 7832ee94f3 Remove unused code and only expose necessary functionality 4 years ago
Daniel Karzel 8ef8240771 Refactor refund test 4 years ago
Daniel Karzel 55024572ae Refactor punish test and punish assertions 4 years ago
Daniel Karzel 73a2841ec5 Refactor happy path bob restart tests 4 years ago
Daniel Karzel 8a2eb07928 Harmonize names and structure
Simple renames and structure changes, no logical changes.
4 years ago
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.
4 years ago
Daniel Karzel 59f9a1c286 Fix usage of StartingBalance in Alice and Bob 4 years ago
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.
4 years ago
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.
4 years ago
Daniel Karzel b031bc5e42 Re-export run_until 4 years ago
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.
4 years ago
rishflab 9cbf6e9774 Re-export event loop handles 4 years ago
rishflab 6040f2ae63 Re-export event loops 4 years ago
rishflab e8fdf62623 Re-export swap function 4 years ago
rishflab f5cfe014be Fix imports 4 years ago
Franck Royer 31c63f0c4d
Remove dead code 4 years ago
Franck Royer 0852f90473
Remove unused variant 4 years ago
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.
4 years ago
Daniel Karzel 59f01ad680 Remove Todo that was already actioned
This ToDo does not add any value, I would not know what to do here.
4 years ago
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.
4 years ago
Daniel Karzel 00b4f3110f Remove ToDo that is already actioned
We already have a second watcher for the cancel timelock, so refund is already actioned.
4 years ago
Daniel Karzel ab9117aa4c Log Alice's lock tx proof receive on Bob's side 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
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 1c644cb377 Rename message behaviours 4 years ago
rishflab 5d7d72c826 Remove unused import 4 years ago
rishflab 387a4da2f6 Make modules private 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
Daniel Karzel 487b880371 Cleanup unused config param that was accidentally introduced 4 years ago
Daniel Karzel e031681369 Add minimum monero confirmations to config use it for Bob 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 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
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
Franck Royer b410de01df
Move state.rs under database module
The types in state are only used for the database
4 years ago
Franck Royer 8c7964bfee
Rename storage.rs to database.rs to reduce terminology variants 4 years ago
Franck Royer 5ed18469e4
Move db state conversion with db type definition
Those conversion are specific to the database and should be defined with
in the database module.
4 years ago
Franck Royer 2a778f5644
Remove overzealous clippy overrides
We have overridden a number of clippy warnings such as
"large enum variant".

Considering that we have a number of issues
 with the stack size in CI, it is more prudent to follow clippy's advice
 and box larger items so that the enum does not take larger space.

Do note that an instance of the enum always takes as much space as its
largest variant.
4 years ago
Franck Royer cdf2800fa5
Align clippy lints
Lints in `main.rs` are not used if there is a `lib.rs` file.
4 years ago
Franck Royer ece689f5ca
There is only one binary, we should use `main.rs` naming convention 4 years ago
Franck Royer 4150e75488
Replace `Try_From` state conversion with `From` for Bob 4 years ago
Franck Royer 5d1b10cc58
Align Bob DB states with swap states 4 years ago
Franck Royer e541f7b83d
Replace `TryFrom` with `From` for Alice states 4 years ago
Franck Royer 69e1c2bb27
Align Alice DB states with swap states 4 years ago
Franck Royer a31db63e54
Improve state names and display 4 years ago
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.
4 years ago
Franck Royer 405e377f79
Rename `EncSign` to `EncSig`
`EncSig` means "encrypted signature", the item,
not be confused with "signing", the action
4 years ago
bors[bot] 9c83ca52ad
Merge #107
107: Ensure that Bob can cancel correctly if T1 expired and Alice did not … r=da-kami a=da-kami

Bob has to check for the possibility to cancel in every state after he locked the BTC.
Otherwise Bob will try to perform actions that don't have any point and it might be impossible to use the `resume` command because it will always fail in trying to go on with Alice even though that might not be possible.

Co-authored-by: Daniel Karzel <daniel@comit.network>
4 years ago
Franck Royer 297b15e3ce
Remove async block when it is not needed 4 years ago
Franck Royer e079b84500
Ensure we wait for other party to complete
Before we check the balances.
4 years ago
Franck Royer 1fa812b727
Separate Buy/Sell for resume command
To avoid confusing the user on whether person should enter a listen addr
or a connect peer id and address
4 years ago
Daniel Karzel a692cf9299 Remove all short-codes because they don't add value at the moment 4 years ago
Daniel Karzel c9d492d155 Only wait for xmr-lock until t1 expired 4 years ago
Daniel Karzel 83ce6f2c85 Ensure that Bob can cancel correctly if T1 expired and Alice did not move
Bob has to check for the possibility to cancel in every state after he locked the BTC.
Otherwise Bob will try to perform actions that don't have any point.
4 years ago
Daniel Karzel 8296490764
Merge pull request #111 from comit-network/trace-xmr-btc
Fix tracing subscribe filter for xmr-btc`
4 years ago
Daniel Karzel 5f8b7f2624 Fix tracing subscribe filter for xmr-btc` 4 years ago
Franck Royer 40a27a2438
Remove dead code 4 years ago
Franck Royer df237f82cf
Fix clippy warning 4 years ago
Franck Royer 49b84d84b9
Add address at the start
Do not carry peer id around as we currently only expect one peer.
4 years ago
Franck Royer 1e4b115556
Separate Bob restart tests
To stabilize CI
4 years ago
Franck Royer e366d3a73b
Join all futures to avoid hanging tests 4 years ago
Franck Royer 2abf65f3b6
Remove sleep that seems unnecessary 4 years ago
Franck Royer 4a4e23038b
Add logging to investigate add address race condition 4 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.
4 years ago
Franck Royer d9ea7ab605
Only carry the tx_lock_id instead of the full state 4 years ago
Franck Royer edfab58246
Scope alice db
To better match the restart scenario
4 years ago
Franck Royer dc96b3d1e9
Stop running first event loop after Alice restarts 4 years ago
Franck Royer 638143a10d
Replace hard coded port by dynamic available one
Fixes #84.
4 years ago
Franck Royer 2212758d17
Rename refund test as it is alice specific 4 years ago
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>
4 years ago
bors[bot] 4f631c0c9b
Merge #98
98: Remove tor module r=da-kami a=da-kami

This removes the currently unused `tor module`.
Different `tokio` versions have been causing issues with the `tor` module in the past (i.e. `Cargo.lock` broken problem...). It started causing issues again when adding a dependency to `jsonrpc_client` working on https://github.com/comit-network/xmr-btc-swap/pull/97

We don't support `tor` at the moment and are no planning to add this feature initially as it is not super important to users. 
The functionality can easily added again at a later point.

Co-authored-by: Daniel Karzel <daniel@comit.network>
4 years ago
bors[bot] 88c29dbce5
Merge #94
94: T1Expired state for Bob and check expiries in states after both locked r=da-kami a=da-kami



Co-authored-by: Daniel Karzel <daniel@comit.network>
4 years ago
Daniel Karzel 4046305474
Merge pull request #88 from comit-network/resume-swap-cli
Resume command and global database cl-parameter
4 years ago
Daniel Karzel 20893c1bb1 Cleanup Display for database states 4 years ago
Daniel Karzel e6493784bf Change `pin_mut!` to `select!` 4 years ago
Daniel Karzel 773eebc723 Cleanup resume_from_database functions only used in tests 4 years ago
Daniel Karzel e9681b6e2b Work in review comments 4 years ago
Daniel Karzel 43d05935e7 Remove tor module 4 years ago
Daniel Karzel 093cbaa4b4 Introduce T1Expired state for Bob properly and check expiries in states after both locked 4 years ago
Daniel Karzel 6d03d1bbff Resume command and global database cl-parameter 4 years ago
Franck Royer 71cf501c29
Delete `bob::negotiate`
This module was intended to contain helper functions for each step.

However, those are not needed except for the negotiate step.
A dedicated module is not needed for one function.
4 years ago
Franck Royer 19066200d1
Add a TODO to use existing helper functions
Helper functions already exist on the xmr-btc crate states, use them
like it is done in the bob module.
4 years ago
Franck Royer 84bec0631b
Rename alice::negotiate to steps
This module includes helper function for each state.
4 years ago
Franck Royer 53d13330c2
Remove dupe code 4 years ago
rishflab 9d266fc648 Add balance assertions to restart tests 4 years ago
Franck Royer 5ba830f3bf
Replace swap `recover` terminology with `resume` 4 years ago
Franck Royer 8cc470a80e
Use `-ed` terminology for cancel state 4 years ago
Daniel Karzel b83ab71669
Split up tests into separate files to overcome CI failure 4 years ago
Daniel Karzel 7cae6a9e4d
Add Bob restart test 4 years ago
Daniel Karzel 4ec2da29a0
Modularize Bob's test setup (separate init for state, event_loop) 4 years ago
Daniel Karzel 9a930af33f
Remove duplicated restart+refund test, move tests into separate files 4 years ago
Daniel Karzel 91d4d5da25
Cleanup swap execution to not return EventLoopHandle, refactor both_refund test 4 years ago
Daniel Karzel 3692046758
Bob's recover function 4 years ago
Daniel Karzel bf39c34ada
Alice restart and refund test if restarted before encsig learner 4 years ago
Daniel Karzel 8c929564ef
Refactor container initialization 4 years ago
rishflab 143d8bc07d
Move message0 response handler out of NB 4 years ago
Daniel Karzel 4143394767
Add recovery function for Alice 4 years ago
rishflab 4b00141c29
Fix happy path test 4 years ago
Franck Royer 7092af457a
Introduced DB for Alice & Bob 4 years ago
Franck Royer 4ce8695dfc
Align with origin/database 4 years ago
Franck Royer 1a5b9f9fa9
Update tests after rebase 4 years ago
Franck Royer c4cdd098fd
Use from instead of try_from for Alice state conversion 4 years ago
Franck Royer caf903acda
wip: Add test for when bob restarts 4 years ago
Franck Royer 905fc6cf35
Save Bob state during swap 4 years ago
Franck Royer 7e0a1ffe84
Remove generator for bob 4 years ago
Franck Royer c6af5eb9ac
Introduce test where alice restarts before all communications are done 4 years ago
Franck Royer 3580b7ed2c
Add test where Alice restart after encsign is learned 4 years ago
Franck Royer a22efaa7bc
Remove unneeded peer id argument 4 years ago
Franck Royer 9323f22009
Reorder calls 4 years ago
Franck Royer a24d1a49b9
Remove unneeded `as_ref_calls` 4 years ago
Franck Royer 1c7cc7ee46
Scope futures' instanciation 4 years ago
Franck Royer 6226e5789f
Introduce test where alice restart mid-swap 4 years ago
Franck Royer 71a0832ef4
Add zero const to monero::Amount 4 years ago
Franck Royer 64b021daf4
Save Alice states in db 4 years ago
Franck Royer 238f6a989d
Extract spend key as soon as possible 4 years ago
Franck Royer c095693a5f
Refund swap if resumed from a step that requires further communication 4 years ago
Franck Royer 11cea9ba69
Remove passing alice peer id
The usage of the peer id is incorrect as we do not even check it when
dialing. For now, we can ignore it.
We can then re-introduce it and use it properly at a later stage.
4 years ago
rishflab d8d6477ee9 Remove and fix comments 4 years ago
rishflab 082f4eb005 Use unused port in refund test 4 years ago
rishflab 7af4b6980a Test Alice refunds after Bob refund
Reworked Alice XmrLocked state transition handler to handle the
scenario when Alice received the encsig but Bob refunds.
Previously Alice was trying to redeem after receiving the encsig
without checking if t1 had elapsed.
4 years ago
rishflab 773390886b Test that Bob refunds if Alice fails to act 4 years ago
rishflab 78c6a1a78f Add Bob refund execution 4 years ago
rishflab f806ad7231 Assert balances after punish 4 years ago
bors[bot] 9fecf7008e
Merge #61
61: Prepare CLI for mainnet swap r=da-kami a=da-kami



Co-authored-by: Daniel Karzel <daniel@comit.network>
4 years ago
Daniel Karzel 03b8e5f52e Upgrade CLI for mainnet test 4 years ago
Daniel Karzel aad7a22f81 Utility function for initializing tracing for tests 4 years ago
Franck Royer c0478d7191
Move expiries to config
So they can be different for mainnet and regtest
4 years ago
Franck Royer ef6e8fc723
Clean-up unused code 4 years ago
Franck Royer e71bf7d8e9
Add comment regarding processing in network behaviour 4 years ago
Franck Royer 2c9fb7b1da
Rename var to match type name 4 years ago
Franck Royer 91d28682ed
Remove comments 4 years ago
Franck Royer 53aae5cf5f
Use anyhow macro as intended 4 years ago
Franck Royer 51cc44484b
Remove unneeded pub qualifiers 4 years ago
rishflab 9ba89194b0 Rename swarm driver to event loop 4 years ago
rishflab f5d3d54b13 Prevent premature Bob t1 timeout
Bob was hitting the t1 timeout and entering cancel
instead of redeem. This was resolved by increasing
the timeouts to 50.
4 years ago
rishflab 27d1334726 Init Alice behaviour with state0
Previously state0 had to be set after creating Alice's behaviour.
With the event loop we no longer has access to the swarm so
set_state0() has to be called indirectly through a channel. This
means it is difficult to guarantee state0 is being set due to the
asynchronous nature of channels. This was solved by initialising
Alice with state0.
4 years ago
rishflab 3d8866f1a0 Convert event loop to use fused futures select
Co-authored-by: Daniel Karzel <daniel@comit.network>
4 years ago
rishflab 58da1df9dc Create SwarmDriverHandle to resolve ownership issues 4 years ago
rishflab 6f7408ecce Drive swarm in seperate async task
Previously the libp2p swarm had to be manually polled within the
protocol execution code to execute actions such as sending a
message. The swarm is now wrapped in SwarmDriver which polls the
swarm in a seperate task
4 years ago
rishflab f88ed9183b
Merge pull request #54 from comit-network/bob-unhappy-paths
Punish Test
4 years ago
rishflab bd8e6e36e0 Fix monero blocktime config 4 years ago
Daniel Karzel 1a2857af29 Properly init tracing per test and reverse the filter to be exclusive
Tracing should be initialized by test and the `_guard` kept alive within the test.
Re-using this code in different tests does not really have any additional value.

Instead of specifying what messages we want to include, I went for a filter that excludes noise.
That way we get more useful logging.
4 years ago
rishflab 883a913f30 Remove nonsensical monero * monero multiplication 4 years ago
rishflab 627b1a9f00 Remove unnecessary execution restart 4 years ago
rishflab 8592ef5f79 Address PR feedback
Add context to logging statements. Use amount type for monero in tests. Remove stale
code and comments.
4 years ago
Franck Royer 78674818c2
Upgrade bitcoin-harness 4 years ago
rishflab b4ac69fa9c Reduce stack size to prevent CI resource issues 4 years ago
rishflab e4eed7b1a5 Change multiaddr for test runs 4 years ago
rishflab c91e9652aa Add alice punish test
Use reusable test init functions for happy path test

Extract tracing setup to reusable function

Move test initialization to seperate functions

Increase stack size in CI

Fix monero max finality time

Force Bob swarm polling to send message 2

Run Bob state to xmr_locked in punish test to force the sending of
message2. Previously Bob state was run until btc_locked. Although
this was the right thing to do, message2 was not being sent as the
swarm was not polled in btc_locked. Alice punish test passes.

Add info logging to executor
4 years ago
rishflab 5fef68322a Allow Alice to exit execution at a specified state 4 years ago
rishflab 584cc22024 Allow Bob to exit execution at a specified state 4 years ago
Franck Royer cfcd1e7170
Clean-up dep versions
- Use bitcoin-harness 0.2
- Use cross-curve-dleq latest master commit
4 years ago
Franck Royer 624716d8a7
Upgrade rust-bitcoin to 0.25 4 years ago
Franck Royer c3e43f50aa
Update bitcoin-harness to specific revision 4 years ago
Franck Royer 765482b0aa
Implement `wait_for_transaction_finality` 4 years ago
rishflab 1c401aad31 Fix clippy warnings and formatting 4 years ago
rishflab b06321a40f WIP: cleanup 4 years ago
rishflab 47c3ddc6f7 Fix happy path test
Poll bob swarm to send encsig after calling send message3. Comment
out unimplmented wait for transaction finality trait. Dial alice.
4 years ago
Franck Royer 2abeba17f9
Save state0 in the swarm to process message0 4 years ago
rishflab d8218a7bea Remove mspc channel from new executor 4 years ago
Franck Royer 2db9ebd28b make new_swarm public 4 years ago
Franck Royer 9e13034e54 Extract execution details from driving loop 4 years ago
rishflab 24631d464d Add test for recursive executor 4 years ago
rishflab dca15b6872 Removed unused binary 4 years ago
rishflab 3b005bd15c Resolve rebase issues, restructure code and fix warnings 4 years ago
Franck Royer 437c1cbb80 Started to extract some steps
Tealised that the whole point is for them to be idempotent to be useful
4 years ago
Franck Royer 66866f8fbd Remove rng argument 4 years ago
Franck Royer 6c0df836ca Deal with Btc Punished. 4 years ago
Franck Royer 6437b529eb Punish Bob if t2 is reached 4 years ago
Franck Royer 8ff1824126 Remove abort function 4 years ago
Franck Royer 58ca33dd04 Remove warnings 4 years ago
Franck Royer c501d84278 Park abort function for now 4 years ago
Franck Royer 4c4a10098c Complete Refund path 4 years ago
Franck Royer bff83bbe99 Progress on Cancellation path 4 years ago
Franck Royer 8e31a3af6a Add steps from `EncSignLearned` 4 years ago
Franck Royer 8976a03b3d Implemented Alice transition from `BtcLocked` to `XmrLocked` 4 years ago
Franck Royer 75e7fedfed Implemented Alice transition from `Negotiated` to `BtcLocked` 4 years ago
Franck Royer c4cd64d134 Implemented Alice transition from `Started` to `Negotiated` 4 years ago
Franck Royer 0fe5131a8a Fix import format 4 years ago
rishflab ae94b170fd Cleanup
Move state machine executors into seperate files

Remove check for ack message from Alice. Seems like a bad idea to
rely on an acknowledgement message instead of looking at the
blockchain.

Fix warnings
4 years ago
rishflab ff7daf16f3 WIP: Test simplified swap execution 4 years ago
rishflab dd07e2f882 Add Alice execution path
Consolidate and simplify swap execution. Generators are no longer
needed. Consolidate recovery and swap data structures. The
recursive calls can be replaced with a loop if returning prior to
completion is desired for testing purposes.

Fill out alice abort path

Move state machine executors into seperate files

Not compiling due to recursion/async issues

Fix async recursion compilation errors

Fix Bob swap execution

Remove check for ack message from Alice. Seems like a bad idea to
rely on an acknowledgement message instead of looking at the
blockchain.

Fix Bob abort

Fix warnings

Xmr lock complete

Add TxCancel submit to XmrLocked

Bob swap completed

Remove alice
4 years ago
Lucas Soriano del Pino 483c819e17 Correctly re-export types from bitcoin and monero modules 4 years ago
Lucas Soriano del Pino f5ff50157e Some more fixes and comments after testing Alice's recovery 4 years ago
Lucas Soriano del Pino bea99185ed Use correct default values for monerod_url*
*`monerod_url` is an incorrect name as it's actually a
`monero_wallet_rpc_url`. This is fixed in another branch.
4 years ago
Lucas Soriano del Pino 5930af3587 Move some things around in recover module 4 years ago
Lucas Soriano del Pino 33b36c98fa Configure binary tracing level for xmr_btc and monero_harness 4 years ago
Lucas Soriano del Pino 5dede0f361 Add more logging to recovery
Also, remove redundant timelock check.
4 years ago
rishflab 11a7963081 Fix bugs 4 years ago
Lucas Soriano del Pino f0d90130ad Add recovery command 4 years ago
Lucas Soriano del Pino 09773dd15b Re-introduce history command 4 years ago
rishflab 0f1a77fa21 Fix Alice's btc redeem recovery path 4 years ago
Lucas Soriano del Pino 6db40dce2a Implement swap recover function for Bob 4 years ago
Lucas Soriano del Pino 28225f8643 Implement swap recover function for Alice
This introduces a lot of duplication between the binary and the
library, but it's okay because this module should only be a temporary
measure until we allow recovery to be handled by the original state
machine.

Also, fix a bug in `xmr_btc::alice::action_generator` caused by the
incorrect assumption that Alice's ability to punish Bob could be
determined before the cancel transaction hits the blockchain.
4 years ago
Lucas Soriano del Pino b989e94322 Remove stale TODO 4 years ago
Lucas Soriano del Pino 33a111d879 Move Swap state out of storage 4 years ago
Lucas Soriano del Pino ac2cfd7f65 Print swap history on --history flag 4 years ago
Lucas Soriano del Pino ecbfed9c11 Add Database API to fetch all swaps 4 years ago
Lucas Soriano del Pino f9cfc2abe3 Remove generics from Database 4 years ago
Lucas Soriano del Pino 02075c2a1d Support saving multiple swaps
By replacing `LAST_STATE_KEY` with a swap ID passed as an argument to
inserting and reading from the database.
4 years ago
Lucas Soriano del Pino 823add218e Remove temporary test tracing guards 4 years ago
Lucas Soriano del Pino a26890001b Fix swap e2e test 4 years ago
Lucas Soriano del Pino 934ddb366a Save state for Alice at specific points in the swap 4 years ago
rishflab ea08778b2f Save state for Bob at specific points in the swap 4 years ago
Philipp Hoenisch 981fcacc95
Make swap e2e test work with new monerod lib 4 years ago
Philipp Hoenisch 70d64f74ae
Testcontainers upgrade 4 years ago
Philipp Hoenisch 0b9e8c145e
Update xmr-btc lib to use new monero-harness 4 years ago
rishflab a44303f839 Add monerod to config
Fixed rebase issues
4 years ago
rishflab 7afd316210 Construct tor transport for Bob 4 years ago
rishflab 3b008c38a6 Remove redundant code and stale comments 4 years ago
rishflab 249f273d1b Remove stale comments 4 years ago
rishflab 5971ef1f28 Fix clippy warnings 4 years ago
rishflab 606c48c752 Format swap crate Cargo.toml 4 years ago
rishflab 796d0b3439 Extract transport creation and remove tor conditional compile
The numerous tor conditional compile flags were removed by
extracting transport creation to the main statement. A tor
transport is created if Alice specifies a tor port using the CLI.
4 years ago
rishflab 0ca511bf8a Remove hardcoded configuration
The hardcoded configuration was replaced with CLI
configuration options. CLI based config was chosen
over a config file as it does not access and clutter
the user's file system. By CLI options depend on whether
the program is run in Alice or Bob mode.
4 years ago
Lucas Soriano del Pino 92c7e8e84f Run swap e2e test without tor feature
Not worth automatically testing both `tor` and `not(tor)`, it should
not make a difference.
4 years ago
Lucas Soriano del Pino 792fa351c8 Upgrade bitcoin-harness dependency
From dev-branch to master.
4 years ago
Lucas Soriano del Pino 7fa7641feb Clean up some logs and comments 4 years ago