Commit Graph

967 Commits

Author SHA1 Message Date
rishflab
21429f24b2
Inline wait_for_locked_bitcoin() that is only called once
Reduce indirection.
2021-03-16 17:11:31 +11:00
rishflab
6a3e4802f1
Remove redundant reference 2021-03-16 17:11:30 +11:00
rishflab
458a8d594a
Rename fn param to correctly reflect underlying type 2021-03-16 17:11:30 +11:00
rishflab
752e5be8f3
Cleanup test logging 2021-03-16 17:11:29 +11:00
Thomas Eizinger
2704245ed5
Fix monero refresh interval
The comparison should be the MAXIMUM of the two values, not the
minimum, otherwise we always refresh at an interval of 1 second.
2021-03-16 17:10:34 +11:00
bors[bot]
904312d1e9
Merge #313
313: Bump tracing-subscriber to 0.2.17 r=da-kami a=thomaseizinger

This release includes a bug-fix that removes an erroneous space
from our logs when running with `--debug`.

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2021-03-15 06:01:09 +00:00
bors[bot]
a02389f8bd
Merge #314
314: Remove CLI config file in favour of parameters r=thomaseizinger a=da-kami

Fixes #282 

The CLI has sensible default values for all parameters,
thus a config file is not really an advantage but just
keeps getting in our way, so re remove it.

Trait impls on `Data` needed for structopt, see https://docs.rs/structopt/0.3.21/structopt/#default-values

Co-authored-by: Daniel Karzel <daniel@comit.network>
2021-03-15 05:37:50 +00:00
bors[bot]
8505d76561
Merge #311
311: Add asb to release including ARM build r=da-kami a=da-kami

https://github.com/da-kami/xmr-btc-swap/releases/tag/0.3-test

The asb ARM build does neither run tests on CI not smoke test for the binary upon release because the there is no standard runner for ARM. One can configure a self-hosted one but I think that might be an overkill: https://docs.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners

I did download the produced ARM tar, unpack and test on the raspi, it works :)

Concerning openssl depdency see:

https://github.com/da-kami/xmr-btc-swap/runs/2093523365?check_suite_focus=true
https://www.reddit.com/r/rust/comments/axaq9b/opensslsys_error_when_crosscompiling_for/


Co-authored-by: Daniel Karzel <daniel@comit.network>
2021-03-15 05:26:49 +00:00
Daniel Karzel
222724b59a Update bors config
Add armv build check to bors.
Update build and test names due to matix configuration changes.
2021-03-15 16:11:35 +11:00
Daniel Karzel
0091b6cdaf Remove CLI config file in favour of parameters
The CLI has sensible default values for all parameters,
thus a config file is not really an advantage but just
keeps getting in our way, so re remove it.
2021-03-15 15:41:46 +11:00
Daniel Karzel
442c377490 Remove openssl dependency
Upgrade tokio-tungstenite to 0.14 and use feature flag rustls-tls
to get rid of the openssl dependency.
2021-03-15 14:36:05 +11:00
Daniel Karzel
f8360fe853 .cargo/config.toml for specifying linker
To avoid code duplication we specify the linker for the specific
target armv7-unknown-linux-gnueabihf in the config.toml file as
specified here:
https://doc.rust-lang.org/cargo/reference/config.html#targettriplelinker
2021-03-15 14:36:05 +11:00
Daniel Karzel
6e09653d3f Remove target section from CI
matrix.include does not require the target section to be present because it
specifies the specific matrix combinations to be run.
2021-03-15 14:35:59 +11:00
Thomas Eizinger
a667c0ecd8
Bump tracing-subscriber to 0.2.17
This release includes a bug-fix that removes an erroneous space
from our logs when running with `--debug`.
2021-03-15 10:39:49 +11:00
Daniel Karzel
58c33f8468 Add asb to release including ARM build 2021-03-15 09:58:18 +11:00
bors[bot]
3a5d8aee42
Merge #308
308: Fix incorrect docker tag r=thomaseizinger a=rishflab



Co-authored-by: rishflab <rishflab@hotmail.com>
2021-03-12 07:45:18 +00:00
rishflab
7cb198aea1 Remove pointless todo
The container is defined in the tests module indicating it is only
suitable for these tests
2021-03-12 12:52:23 +11:00
rishflab
9f534996ee Remove unused capability to configure bitcoind docker version tag
We only use one version of this container
2021-03-12 12:50:42 +11:00
rishflab
7b1d901ea0 Fix incorrectly formatted tag 2021-03-12 11:01:52 +11:00
bors[bot]
009597ac49
Merge #306
306: Fix logging and retrying of Monero transaction watching r=thomaseizinger a=thomaseizinger

Hopefully, this should also reduce the load because I am not asking the node every second.

Related: https://github.com/comit-network/xmr-btc-swap/issues/202

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Daniel Karzel <daniel@comit.network>
2021-03-11 07:50:54 +00:00
Daniel Karzel
be52892e65
Monero wallet should not know about all execution params
Instead of passing all execution params in we only make the monero_avg_block_time known to the monero wallet.
2021-03-11 17:43:01 +11:00
Thomas Eizinger
82738b111e
Refactor monero::Wallet::watch_for_transfer to not use backoff
Instead, we use a regular loop and extract everything into a function
that can be independently tested.
`backoff` would be useful to retry the actual call to the node.
2021-03-11 17:42:54 +11:00
bors[bot]
1d1ed13b65
Merge #302
302: Fixup backticks in README r=da-kami a=thomaseizinger



Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2021-03-11 06:12:20 +00:00
bors[bot]
b956f366b9
Merge #305
305: Disable `backoff`s `max_elapsed_time` functionality r=da-kami a=thomaseizinger

This config setting makes backoff stop retrying if we didn't get an
error within this timeframe.
For us, this results in backoff not actually doing anything.

The connection to kraken is very long-running. It might be active
for hours without failing. However, the default value for
`max_elapsed_time` is set to 15 minutes. As such, once the connection
fails any time after that, backoff doesn't actually retry the operation
but just gives up.

Fixes #303.

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2021-03-11 05:46:02 +00:00
Thomas Eizinger
f0a2134f76
Remove unused field 2021-03-11 15:34:27 +11:00
Thomas Eizinger
7e0c44ad1d
Add avg monero block time to execution params 2021-03-11 15:01:55 +11:00
Thomas Eizinger
d560e69203
Make durations more readable by using extension methods from time 2021-03-11 14:59:57 +11:00
Thomas Eizinger
ecff1d1cbe
Remove indirection of constants
We never use these constants anywhere else, inline them.
2021-03-11 14:57:47 +11:00
Thomas Eizinger
bac0f11898
Disable backoffs max_elapsed_time functionality
This config setting makes backoff stop retrying if we didn't get an
error within this timeframe.
For us, this results in backoff not actually doing anything.

The connection to kraken is very long-running. It might be active
for hours without failing. However, the default value for
`max_elapsed_time` is set to 15 minutes. As such, once the connection
fails any time after that, backoff doesn't actually retry the operation
but just gives up.

Fixes #303.
2021-03-11 13:33:46 +11:00
Thomas Eizinger
8d8b3100ea
Fixup backticks in README 2021-03-10 14:55:36 +11:00
bors[bot]
9279877c8f
Merge #301
301: Refactor the kraken module to automatically re-connect on errors r=thomaseizinger a=thomaseizinger



Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2021-03-10 00:13:38 +00:00
Thomas Eizinger
9ad2160c69
Refactor the kraken module to automatically re-connect on errors
In order to be able to re-connect on certain errors, we model
connection errors separately from parsing errors. We also change
the API of the whole module to no longer forward all errors to
the subscribers but instead, only update the subscribers with
either a latest rate or a permanent failure in case we exhausted
all our options to re-connect the websocket.

To model all of this properly, we introduce to sub-modules so that
each submodule can have their own `Error` type.

Resolves #297.
2021-03-09 17:37:37 +11:00
Thomas Eizinger
c560b3b21a
Introduce RateUpdate type alias to reduce duplication 2021-03-09 15:39:08 +11:00
Thomas Eizinger
fd5b38739a
Remove constant in favor of inlining string
This removes an import and simplifies the `connect_async` call.
2021-03-09 15:39:07 +11:00
Thomas Eizinger
142e5e2d3a
Use tracing macros by fully-qualifying them 2021-03-09 15:39:03 +11:00
bors[bot]
cc131ecf60
Merge #293
293: Some friday evening goodies r=thomaseizinger a=thomaseizinger



Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2021-03-08 22:53:58 +00:00
Thomas Eizinger
08923a14f3
Simplify GET request for block tip height 2021-03-05 17:06:17 +11:00
Thomas Eizinger
e9d7d9299c
Simplify the GET request to the tx status URL 2021-03-05 16:56:48 +11:00
Thomas Eizinger
418ad7089d
Make tests more readable by following arrange-act-assert 2021-03-05 16:56:48 +11:00
Thomas Eizinger
c2329b19a2
Tell the user more about the monero lock transaction
First, we tell the user that we are now waiting for Alice to lock
the monero. Additionally, we tell them once we received the
transfer proof which will lead directly into the
"waiting for confirmations" function.
2021-03-05 16:56:47 +11:00
Thomas Eizinger
13c4d29d40
Tell the user immediately how many confirmations we expect
Without this, the user doesn't see a message before the first
confirmation.
2021-03-05 16:56:47 +11:00
Thomas Eizinger
4883e23dd8
Tell the user for how many confirmations we are waiting
Without this, the user has no idea for how long the program is
waiting.
2021-03-05 16:56:47 +11:00
Thomas Eizinger
5d4cf40831
Fix comparison of Monero confirmations 2021-03-05 16:56:46 +11:00
bors[bot]
52483a5a43
Merge #291
291: Improve CLI help comments and "type" hints r=rishflab a=rishflab

The type hints are generated from the field names. This has the
unfortunate consequence of the config field becoming file_path which
does not really make sense people working on the codebase.

Co-authored-by: rishflab <rishflab@hotmail.com>
2021-03-05 05:56:41 +00:00
rishflab
f92a8ac300 Improve CLI help comments and "type" hints
The type hints are generated from the field names. This has the
unfortunate consequence of the config field becoming file_path which
does not really make sense people working on the codebase.
2021-03-05 16:46:17 +11:00
bors[bot]
4b99d68790
Merge #290
290: Monero daemon host configurable r=rishflab a=da-kami

Note: `monero-daemon-host` in accordance with the wallet RPC params, from wallet RPC help:

```
Usage:
  monero-wallet-rpc [--wallet-file=<file>|--generate-from-json=<file>|--wallet-dir=<directory>] [--rpc-bind-port=<port>]

General options:
  --help                                Produce help message
  --version                             Output version information

Wallet options:
  --daemon-address arg                  Use daemon instance at <host>:<port>
  --daemon-host arg                     Use daemon instance at host <arg>
                                        instead of localhost
```

Co-authored-by: Daniel Karzel <daniel@comit.network>
2021-03-05 05:29:16 +00:00
bors[bot]
21a2a005e8
Merge #289
289: Tidy up README and docs r=rishflab a=thomaseizinger



Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2021-03-05 05:19:25 +00:00
Daniel Karzel
196557b377 Rename binary to swap 2021-03-05 16:14:21 +11:00
Daniel Karzel
f8b61e2e0e Make monero daemon host configurable 2021-03-05 16:10:45 +11:00
Daniel Karzel
f091402c7a Remove parameter duplication by introducing structs 2021-03-05 16:08:54 +11:00