Commit Graph

64 Commits (b9d2e9c3aed01c724e392c7b202a9c07d6c7e400)

Author SHA1 Message Date
Thomas Eizinger 148fdb8d0a
Ensure the size of our locking script never changes 3 years ago
Thomas Eizinger 2eb7fab0c3
Make `capture_logs` available for the whole crate 3 years ago
Thomas Eizinger ec4234fbb9
Merge `--seller-addr` and `--seller-peer-id` into `--seller` parameter
This simplifies the CLI's interface.
3 years ago
Philipp Hoenisch 632293cf91
Add support for swapping through Tor.
This PR does a few things.
* It adds a TorTransport which either dials through Tor's socks5 proxy or via clearnet.
* It enables ASB to register hidden services for each network it is listening on. We assume that we only care about different ports and re-use the same onion-address for all of them. The ASB requires to have access to Tor's control port.
* It adds support to dial through a local Tor socks5 proxy. We assume that Tor is always available on localhost.  Swap cli only requires Tor to be running so that it can send messages via Tor's socks5 proxy.
* It adds a new e2e test which swaps through Tor. For this we assume that Tor is currently running on localhost. All other tests are running via clear net.
3 years ago
rishflab e517c5934e Move asb tracing initializer to asb module 3 years ago
bors[bot] 2c385ee7d9
Merge #321
321: Properly handle concurrent messages to and from peers r=thomaseizinger a=thomaseizinger

Previously, we were forwarding incoming messages from peers to all
swaps that were currently running. That is obviously wrong. The new
design scopes an `EventLoopHandle` to a specific PeerId to avoid
this problem.

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
3 years ago
Thomas Eizinger a57f88d1b4
Properly handle concurrent messages to and from peers
Previously, we were forwarding incoming messages from peers to all
swaps that were currently running. That is obviously wrong. The new
design scopes an `EventLoopHandle` to a specific PeerId to avoid
this problem.
3 years ago
Thomas Eizinger 09c41f89c4
Rename ExecutionParams to EnvironmentConfig 3 years ago
Thomas Eizinger 60d6d50246
Extract kraken websocket client into dedicated module 3 years ago
Thomas Eizinger 14dcd150af
Extract `determine_btc_to_swap` function and test it
We also instantiate tracing in to order to quickly validate, what
the output for the different scenarios looks like.
3 years ago
bors[bot] a6724f29af
Merge #214
214: Rename nectar to asb (automated swap backend) r=da-kami a=da-kami



Co-authored-by: Daniel Karzel <daniel@comit.network>
3 years ago
Daniel Karzel fe3d6f1fef Rename nectar to asb (automated swap backend) 3 years ago
Thomas Eizinger 84bc2c82b7
Upgrade to bdk 4.0
To achieve this we also:

- upgrade rust-bitcoin to 0.26
- upgrade bitcoin-harness to latest version (which also depends bitcoin 0.26)
- upgrade to latest edcsa-fun
- replace cross_curve_dleq proof with sigma_fun (to avoid an upgrade dance over there)
3 years ago
Franck Royer fb3b2aa546
Remove unnecessary pub qualifier 3 years ago
Franck Royer ee43125bdd
Add `nectar` binary 3 years ago
Franck Royer 7805a6d684
Move cli specific modules under cli folder
nectar will also have its own folder with a separate config.
3 years ago
Franck Royer 7d392c3086
This files contains `Command` and `Arguments` structs 3 years ago
Franck Royer 788445964a
Move main.rs to cli.rs to prepare for nectar binary 3 years ago
Daniel Karzel 89b3775e05 Rename config to execution_params 3 years ago
Daniel Karzel 802dc61e7e Configuration for RPC urls and Bitcoin wallet name 3 years ago
Franck Royer 33db688e3a
Bob peer id can be retrieved from the DB
This remove branches where Alice resumes from the DB but cannot contact
Bob.
3 years ago
Franck Royer f2a25ee49b
Move definitions out of lib.rs 3 years ago
Franck Royer b88a777bae
Remove dead code 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 898b8bf8b0
Remove dead code 3 years ago
Franck Royer 31c63f0c4d
Remove dead code 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
rishflab f64eede5d8 Move monero ser/deser to monero module 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
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 cdf2800fa5
Align clippy lints
Lints in `main.rs` are not used if there is a `lib.rs` file.
4 years ago
Franck Royer 40a27a2438
Remove dead code 4 years ago
Daniel Karzel 43d05935e7 Remove tor module 4 years ago
rishflab 4b00141c29
Fix happy path test 4 years ago
Franck Royer 905fc6cf35
Save Bob state during swap 4 years ago
Daniel Karzel 03b8e5f52e Upgrade CLI for mainnet test 4 years ago
Franck Royer c0478d7191
Move expiries to config
So they can be different for mainnet and regtest
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 24631d464d Add test for recursive executor 4 years ago
rishflab 3b005bd15c Resolve rebase issues, restructure code and fix warnings 4 years ago
Franck Royer 58ca33dd04 Remove warnings 4 years ago
Franck Royer 8976a03b3d Implemented Alice transition from `BtcLocked` to `XmrLocked` 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 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 33a111d879 Move Swap state out of storage 4 years ago
rishflab 249f273d1b Remove stale comments 4 years ago