Commit Graph

1079 Commits

Author SHA1 Message Date
Thomas Eizinger
25b123d6ed
Load wallet in monero-wallet-rpc on demand if necessary
Previously, we relied on the wallet in the `monero-wallet-rpc` daemon
to be loaded as we do on startup. As a consequence of this expectation,
restarting `monero-wallet-rpc` to fix bugs like #652 resulted in the
ASB no longer operating correctly.

To fix this, we now load the wallet on-demand in case the daemon responds
with the error code -13.

Ideally, we would implement this behaviour generically using the proxy
pattern on the `MoneroWalletRpc` trait. Unfortunately, when attempting
to do so we uncover a limitation in the design of `jsonrpc_client`.
This limitation is tracked in https://github.com/thomaseizinger/rust-jsonrpc-client/issues/47.
Once fixed, we can implement this logic in a more robust way that is not
tied to the `check_tx_key` RPC call but applies to any RPC call automatically.
2021-08-27 09:39:29 +10:00
Seth Simmons
e3b231f045
Move "Lost connection" log line from WARN to Debug
Per #660, moving the log line on a peer closing connection outside of a swap to DEBUG instead of WARN, as there is no action that can be taken by the ASB owner.
2021-08-24 13:55:56 +00:00
bors[bot]
04bbcb1fc9
Merge #631 #641
631: Bump tokio-tungstenite from 0.14.0 to 0.15.0 r=thomaseizinger a=dependabot[bot]

Bumps [tokio-tungstenite](https://github.com/snapview/tokio-tungstenite) from 0.14.0 to 0.15.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/snapview/tokio-tungstenite/blob/master/CHANGELOG.md">tokio-tungstenite's changelog</a>.</em></p>
<blockquote>
<h1>0.15.0</h1>
<ul>
<li>Update the <code>tungstenite-rs</code> version to <code>0.14.0</code>,
<a href="https://github.com/snapview/tungstenite-rs/blob/master/CHANGELOG.md#0140">check <code>tungstenite-rs</code> release for more details</a>.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="614a4b12eb"><code>614a4b1</code></a> Update the changelog</li>
<li><a href="6e1005f968"><code>6e1005f</code></a> Bump version</li>
<li><a href="44190cfef2"><code>44190cf</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/snapview/tokio-tungstenite/issues/174">#174</a> from SyedAhkam/master</li>
<li><a href="bed60c753d"><code>bed60c7</code></a> Derive <code>Debug</code> trait for <code>MaybeTlsStream</code></li>
<li><a href="6ce3591789"><code>6ce3591</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/snapview/tokio-tungstenite/issues/164">#164</a> from torlenor/document_tls_features</li>
<li><a href="4686ae0041"><code>4686ae0</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/snapview/tokio-tungstenite/issues/165">#165</a> from snapview/fix-autobahn</li>
<li><a href="e861b1be06"><code>e861b1b</code></a> ci: do not use Travis, superseded by GH Actions</li>
<li><a href="12e3dca65a"><code>12e3dca</code></a> tests: fix confusing wrong paths in the scripts</li>
<li><a href="639b106739"><code>639b106</code></a> tests: use autobahn test suite as docker image</li>
<li><a href="c9b886ea72"><code>c9b886e</code></a> Add documentation about TLS features to README</li>
<li>Additional commits viewable in <a href="https://github.com/snapview/tokio-tungstenite/compare/v0.14.0...v0.15.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=tokio-tungstenite&package-manager=cargo&previous-version=0.14.0&new-version=0.15.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

You can trigger a rebase of this PR by commenting ``@dependabot` rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

641: Bump thomaseizinger/create-pull-request from 1.1.0 to 1.2.1 r=thomaseizinger a=dependabot[bot]

Bumps [thomaseizinger/create-pull-request](https://github.com/thomaseizinger/create-pull-request) from 1.1.0 to 1.2.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/thomaseizinger/create-pull-request/releases">thomaseizinger/create-pull-request's releases</a>.</em></p>
<blockquote>
<h2>1.2.1</h2>
<p>No release notes provided.</p>
<h2>1.2.0</h2>
<h3>Added</h3>
<ul>
<li>Support for adding labels by setting <code>labels</code></li>
<li>Check for existing pull request and <code>created</code> action output</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/thomaseizinger/create-pull-request/blob/master/CHANGELOG.md">thomaseizinger/create-pull-request's changelog</a>.</em></p>
<blockquote>
<h1>Changelog</h1>
<p>All notable changes to this project will be documented in this file.</p>
<p>The format is based on <a href="https://keepachangelog.com/en/1.0.0/">Keep a Changelog</a>,
and this project adheres to <a href="https://semver.org/spec/v2.0.0.html">Semantic Versioning</a>.</p>
<h2>[Unreleased]</h2>
<h2>[1.2.0] - 2021-07-26</h2>
<h3>Added</h3>
<ul>
<li>Support for adding labels by setting <code>labels</code></li>
<li>Check for existing pull request and <code>created</code> action output</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="603900158e"><code>6039001</code></a> Use github.actor instead of hardcoded name</li>
<li><a href="f3b6912a65"><code>f3b6912</code></a> Added labels to action.yml (<a href="https://github-redirect.dependabot.com/thomaseizinger/create-pull-request/issues/75">#75</a>)</li>
<li><a href="8aa44c8cb5"><code>8aa44c8</code></a> Update CHANGELOG.md</li>
<li><a href="0afa85c37f"><code>0afa85c</code></a> Added support for labels and existing PR check (v2 from master) (<a href="https://github-redirect.dependabot.com/thomaseizinger/create-pull-request/issues/61">#61</a>)</li>
<li><a href="1737745289"><code>1737745</code></a> Add missing links to changelog</li>
<li><a href="2d426a48b7"><code>2d426a4</code></a> Create CONTRIBUTING.md</li>
<li><a href="296164f67d"><code>296164f</code></a> Misc (<a href="https://github-redirect.dependabot.com/thomaseizinger/create-pull-request/issues/52">#52</a>)</li>
<li>See full diff in <a href="https://github.com/thomaseizinger/create-pull-request/compare/1.1.0...1.2.1">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=thomaseizinger/create-pull-request&package-manager=github_actions&previous-version=1.1.0&new-version=1.2.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

You can trigger a rebase of this PR by commenting ``@dependabot` rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-20 07:56:38 +00:00
dependabot[bot]
4a2bfbf9cf
Bump comfy-table from 4.0.1 to 4.1.1
Bumps [comfy-table](https://github.com/nukesor/comfy-table) from 4.0.1 to 4.1.1.
- [Release notes](https://github.com/nukesor/comfy-table/releases)
- [Changelog](https://github.com/Nukesor/comfy-table/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nukesor/comfy-table/compare/v4.0.1...v4.1.1)

---
updated-dependencies:
- dependency-name: comfy-table
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-20 01:32:09 +00:00
Thomas Eizinger
6c446825b7
Instruct Ping to keep the connection alive 2021-08-18 12:45:17 +10:00
Thomas Eizinger
1af0623c85
Remove empty modules 2021-08-18 12:35:47 +10:00
COMIT Botty McBotface
7126d77dc1 Prepare release 0.8.1 2021-08-16 01:37:09 +00:00
Thomas Eizinger
0296509110
Upgrade to bdk 0.10
This fixes #546. I don't know why, but I can't reproduce the problem
with the updated dependency.
2021-08-12 18:47:05 +10:00
Thomas Eizinger
475057abda
Add proptest for max_giveable and signing PSBT 2021-08-12 18:42:00 +10:00
Thomas Eizinger
e4b5e28a93
Introduce WalletBuilder for creating test instances of wallet 2021-08-12 18:39:31 +10:00
Thomas Eizinger
148fdb8d0a
Ensure the size of our locking script never changes 2021-08-12 18:39:31 +10:00
dependabot[bot]
83c378db15
Bump tokio-tungstenite from 0.14.0 to 0.15.0
Bumps [tokio-tungstenite](https://github.com/snapview/tokio-tungstenite) from 0.14.0 to 0.15.0.
- [Release notes](https://github.com/snapview/tokio-tungstenite/releases)
- [Changelog](https://github.com/snapview/tokio-tungstenite/blob/master/CHANGELOG.md)
- [Commits](https://github.com/snapview/tokio-tungstenite/compare/v0.14.0...v0.15.0)

---
updated-dependencies:
- dependency-name: tokio-tungstenite
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-12 11:09:44 +00:00
dependabot[bot]
8ea0877dc1
Bump comfy-table from 4.0.0 to 4.0.1
Bumps [comfy-table](https://github.com/nukesor/comfy-table) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/nukesor/comfy-table/releases)
- [Changelog](https://github.com/Nukesor/comfy-table/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nukesor/comfy-table/compare/v4.0.0...v4.0.1)

---
updated-dependencies:
- dependency-name: comfy-table
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-09 11:08:51 +00:00
COMIT Botty McBotface
403e3d2b33 Prepare release 0.8.0 2021-07-09 02:02:13 +00:00
Thomas Eizinger
d21bd556ec
Remove rendezvous point default
This also fixes a bug where an empty string wasn't actually allowed
as a rendezvous point in the ASB's initial setup wizard.
2021-07-09 09:44:56 +10:00
bors[bot]
9fc53d3f84
Merge #615
615: Update default Monero node URLs and info r=thomaseizinger a=da-kami

xmr.to nodes are not served at the xmr.to domain but moved to melo.tools

Co-authored-by: Daniel Karzel <daniel@comit.network>
2021-07-08 06:43:12 +00:00
Daniel Karzel
0dc3943d9c
Update default Monero node URLs and info
xmr.to nodes are not served at the xmr.to domain but moved to melo.tools
2021-07-08 16:42:18 +10:00
bors[bot]
6208689237
Merge #620
620: Revert "Prepare release 0.8.0" r=thomaseizinger a=da-kami

This reverts commit 50da9580

Co-authored-by: Daniel Karzel <daniel@comit.network>
2021-07-08 06:26:26 +00:00
bors[bot]
238e52228e
Merge #618
618: Don't spam on transaction status change r=da-kami a=thomaseizinger



Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2021-07-08 05:49:39 +00:00
bors[bot]
00f581dee1
Merge #619
619: Disallow Bitcoin legacy addresses r=da-kami a=thomaseizinger



Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2021-07-08 05:32:38 +00:00
Daniel Karzel
ab24f7bce5
Revert "Prepare release 0.8.0"
This reverts commit 50da9580
2021-07-08 15:03:37 +10:00
bors[bot]
b7a832eb7a
Merge #616
616: Don't spam the user while waiting for BTC to be deposited r=thomaseizinger a=thomaseizinger



Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2021-07-08 04:48:55 +00:00
Thomas Eizinger
2c8bbe4913
Remove left-over "half" of log message
With the move to using tracing's fields, this log message was not
properly updated.
2021-07-08 13:40:11 +10:00
Thomas Eizinger
94f089f4f2
Disallow Bitcoin legacy addresses
These cause problems during fee estimation.
2021-07-08 13:36:43 +10:00
Thomas Eizinger
367d75cab6
Reduce code duplication and make evaluation order determinisitic
The Rust compiler doesn't guarantee in which order field initialization
are executed. By extracting them, we can make sure they run in a certain
order. This will be important as we add more validations that can
fail.
2021-07-08 13:31:57 +10:00
Thomas Eizinger
46ffc34f40
Don't spam on transaction status change 2021-07-08 12:55:37 +10:00
Thomas Eizinger
991dbf496e
Extract print_status_change so it is easily testable 2021-07-08 12:55:36 +10:00
Thomas Eizinger
2eb7fab0c3
Make capture_logs available for the whole crate 2021-07-08 12:55:33 +10:00
Daniel Karzel
6abf83f4ad
Sort seller list inside of list_sellers
By sorting the list inside we have a more deterministic output that makes processing in JSON easier.
2021-07-08 12:42:26 +10:00
Thomas Eizinger
cacfc50fb2
Don't spam the user while waiting for BTC 2021-07-08 12:14:37 +10:00
Thomas Eizinger
56a48e71ef
Add failing test that shows spamming of output 2021-07-08 12:12:55 +10:00
Thomas Eizinger
56ea23c2a3
Assert log output for determine_btc_to_swap 2021-07-08 12:10:49 +10:00
Thomas Eizinger
a347dd8b97
Move helper structs below tests 2021-07-08 11:15:24 +10:00
COMIT Botty McBotface
50da958078 Prepare release 0.8.0 2021-07-07 08:31:00 +00:00
Thomas Eizinger
714514edbc
Provide a commit-specific version output
For builds made directly on the tag, the output of `--version` will
not change. For builds not made on a tagged commit, the output will
look something like this:

```
> swap --version

swap 0.7.0-117-g93161f9
```

Fixes #409.
2021-07-07 17:55:13 +10:00
Thomas Eizinger
5c37fe6733
Make struct-opt docs more consistent
- Remove dots from the of help messages
- Unify wording
2021-07-07 17:14:56 +10:00
Thomas Eizinger
987f8abb9d
Include unreachable nodes in table output
We emit an `info!` log for every peer that we discover but only ever
emitted a `debug!` log if we fail to connect. This leads to a situation
where the user would run `swap list-sellers`, the logs would say
"Discovered XYZ at ABC" but then get a potentially empty table.

To not confuse the user, we include unreachable nodes in the table output.
For example:

```
Connected to rendezvous point, discovering nodes in 'xmr-btc-swap-testnet' namespace ...
Discovered peer 12D3KooWPZ69DRp4wbGB3wJsxxsg1XW1EVZ2evtVwcARCF3a1nrx at /dns4/ac4hgzmsmekwekjbdl77brufqqbylddugzze4tel6qsnlympgmr46iid.onion/tcp/8765
+-------+--------------+--------------+-------------+----------------------------------------------------------------------------------------------------------------------------------------+
| PRICE | MIN_QUANTITY | MAX_QUANTITY | STATUS      | ADDRESS                                                                                                                                |
+============================================================================================================================================================================================+
| ???   | ???          | ???          | Unreachable | /dns4/ac4hgzmsmekwekjbdl77brufqqbylddugzze4tel6qsnlympgmr46iid.onion/tcp/8765/p2p/12D3KooWPZ69DRp4wbGB3wJsxxsg1XW1EVZ2evtVwcARCF3a1nrx |
+-------+--------------+--------------+-------------+----------------------------------------------------------------------------------------------------------------------------------------+
```
2021-07-07 17:14:56 +10:00
Thomas Eizinger
09f395a26b
Don't print level and time for list-sellers
This is now consistent with the `buy-xmr` command.
2021-07-07 17:14:55 +10:00
Thomas Eizinger
40eccd089f
Change --data-dir for --data-base-dir 2021-07-07 17:14:55 +10:00
Thomas Eizinger
3b1789fe07
Make things private if possible 2021-07-07 17:14:55 +10:00
Thomas Eizinger
8f50eb2f34
Utilize tracing's fields more 2021-07-07 16:02:02 +10:00
Thomas Eizinger
9119ce5cc4
Tidy up log messages across the codebase
1. Clearly separate the log messages from any fields that are
captured. The log message itself should be meaningful because it
depends on the underlying formatter, how/if the fields are displayed.
2. Some log messages had very little context, expand that.
3. Wording of errors was inconsistent, hopefully all errors should
now start with `Failed to ...`.
4. Some log messages were duplicated across multiple layers (like opening
the database).
5. Some log messages were split into two where one part is now an `error!`
and the 2nd part is an `info!` on what is happening next.
6. Where appropriate, punctuation has been removed to not interrupt
the reader's flow.
2021-07-07 16:02:00 +10:00
Thomas Eizinger
78480547d5
Don't import tracing's macros
Log statements end up getting changed constantly and having to clean
up imports after that is annoying, for example, if the last `info!`
in a file disappears, you end up with an unused import warning.

Fully qualifying tracing's macros prevents that and also communicates
clearly that we are using tracing and not log.
2021-07-07 16:01:33 +10:00
Thomas Eizinger
1d0d38cd48
Explain why we clear the bip32_derivation map 2021-07-07 14:37:56 +10:00
Thomas Eizinger
acfd2dd6bb
Store Monero receive address in database and load it on resume 2021-07-06 20:08:24 +10:00
Thomas Eizinger
5463bde4f8
Add a mandatory --change-address parameter to buy-xmr
Fixes #513.
2021-07-06 20:07:53 +10:00
Thomas Eizinger
683d565679
Make variable naming consistent 2021-07-06 20:06:41 +10:00
Thomas Eizinger
8b59ac26ba
Replace sorting with slice pattern matching
Sorting `psbt.output` by `witness_script` is at times pointless
because it might be set to `None`. To be more robust, we pattern
match against the produced transaction.
2021-07-06 20:06:40 +10:00
Thomas Eizinger
348fca0827
Add isolated test for list_sellers function 2021-07-06 20:03:53 +10:00
Thomas Eizinger
e642f5c148
Extend SwarmExt with ability to listen on TCP localhost
The CLI's transport doesn't support memory addresses and it also shouldn't support those by default. To be able to use it in tests, we extend the `SwarmExt` trait with the ability to listen on local TCP addresses with a random port.
2021-07-06 20:03:19 +10:00
rishflab
93a0692998
Integrate rendezvous protocol into ASB
The rendezvous protocol allows us to register all of our external
addresses. Hence, the first step is to allow the user to configure
external addresses as part of the config. In the future, there might
be an automated way of determining these.

To register with a rendezvous node, the user needs to configure which
one. CoBloX is running a rendezvous node that acts as the default by
every spec-compliant node will do the job just fine. This behaviour
is optional which is why our custom behaviour is wrapped in a `Toggle`.

We also want our node to re-register after half the time of the
registration has passed. To make this simpler and allow for testing in
isolation, we create a custom behaviour that wraps the libp2p rendezvous
behaviour.
2021-07-06 20:03:19 +10:00
Daniel Karzel
ff10edd8a4
Add the list-sellers command to the CLI
This command uses a rendezvous node to find sellers (i.e. ASBs) and query them for quotes.
Sellers, that can be dialed and queried for a quote will be listed.
2021-07-06 20:03:18 +10:00
Daniel Karzel
f45cde84ab
comfy-table instead of prettytable-rs 2021-07-06 20:01:48 +10:00
Thomas Eizinger
b4fafeba6b
Allow large enum variant lint
The docs say one needs to measure the impact of this before taking
action. We didn't measure anything. Let's not take any action.
2021-07-06 19:58:41 +10:00
Thomas Eizinger
e163942850
Merge transport and behaviour module into network 2021-07-06 19:58:40 +10:00
Daniel Karzel
ff8cca2e27
Pass in CLI behaviour when creating swarm
This allows us to reuse the swarm setup with a different behaviour for discovering ASBs with a rendezvous node.
2021-07-06 19:58:36 +10:00
bors[bot]
4cd27e372c
Merge #604
604: Bump torut from 0.1.9 to 0.1.10 r=thomaseizinger a=dependabot[bot]

Bumps [torut](https://github.com/teawithsand/torut) from 0.1.9 to 0.1.10.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/teawithsand/torut/releases">torut's releases</a>.</em></p>
<blockquote>
<h2>Release 0.1.10</h2>
<p>Deprecated onion services V2 and all stuff associated with it.
Updated tokio version.
Implemented std::error::Error for error types in this crate, support for these errors is very basic and all that was done was implementing Error trait for existing error types. No error structure refactoring was done.</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="8a26ddde79"><code>8a26ddd</code></a> Implemented std::error::Error for error types</li>
<li><a href="c5cee8a369"><code>c5cee8a</code></a> Implemented std::error::Error for error types</li>
<li><a href="caed51d697"><code>caed51d</code></a> Deprecated v2 onion service stuff</li>
<li><a href="87bcde20bb"><code>87bcde2</code></a> Updated tokio version</li>
<li>See full diff in <a href="https://github.com/teawithsand/torut/compare/v0.1.9...v0.1.10">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=torut&package-manager=cargo&previous-version=0.1.9&new-version=0.1.10)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

You can trigger a rebase of this PR by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2021-07-06 06:49:06 +00:00
bors[bot]
72673fa166
Merge #605
605: Merge `--seller-addr` and `--seller-peer-id` into `--seller` parameter r=thomaseizinger a=thomaseizinger

This simplifies the CLI's interface.

It wills also play nicely with https://github.com/comit-network/xmr-btc-swap/pull/593.

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2021-07-06 05:55:25 +00:00
Thomas Eizinger
d49f4ea60d
Test saving and loading of addresses in isolation 2021-07-06 15:53:14 +10:00
Thomas Eizinger
ec4234fbb9
Merge --seller-addr and --seller-peer-id into --seller parameter
This simplifies the CLI's interface.
2021-07-06 14:51:08 +10:00
Thomas Eizinger
c2daf7a11e
Make use of torut's errors implementing std::error::Error
Anyhow all the things!
2021-07-06 14:46:00 +10:00
Thomas Eizinger
8057b45e17
Test new reachability function in tests 2021-06-30 18:28:51 +10:00
Thomas Eizinger
92ed8d9c04
Refuse to dial addresses via Tor that are almost certainly not reachable
For now, this just concerns loopback addresses.
2021-06-30 18:28:47 +10:00
Thomas Eizinger
ec59184e85
Refactor fmt_as_address_string to return a structured value
Instead of formatting to a string right away, we parse the multiaddress
into a stricter data structure that only allows the kind of addresses
we can dial through Tor.

This will allow us to perform further checks on the parsed address.
2021-06-30 18:15:26 +10:00
bors[bot]
b708d5a4dd
Merge #585
585: Configurable kraken websocket url via the ASB config r=thomaseizinger a=cimble-code

- Allows the ASB operator to configure a custom kraken websocket url via the ASB config. 
- Addresses the issue of price control first brought up [here](https://github.com/comit-network/xmr-btc-swap/discussions/571)

>  Gotya. 
There is a relatively easy to implement (but temporary) solution for that. We could let the user configure the kraken websocket url via the ASB config. That way you can plug in your own service. The only requirement is that your service publishes prices updates in the same format as [kraken](https://docs.kraken.com/websockets/), e.g. : 

_Originally posted by @bonomat in https://github.com/comit-network/xmr-btc-swap/discussions/571#discussioncomment-885535_

Co-authored-by: Your Name <you@example.com>
2021-06-28 12:05:00 +00:00
Your Name
665ea503d2 Make price ticker ws url configurable 2021-06-28 03:19:49 -07:00
Daniel Karzel
dc89a837e7
Do not actively set KeepAlice::No for swap_setup
Closing the connection upon completing the `swap_setup` protocol caused problems on the ASB side, because the CLI would close the connection before the last message was properly processed. This would result in swaps going into execution on the CLI side, but not on the ASB side.
The CLI ensures an open connection to the ASB over the complete course of a swap. So it does not make much sense to allow a protocol to close the connection (the CLI would immediately redial).
For the Alice we set the initial `KeepAlive` to `10` seconds because Bob is expected to request a spot price in reasonable time after opening a connection on the protocol. Since Tor connections can take some time we set 10 seconds fow now for resilience.
2021-06-28 12:08:51 +10:00
Daniel Karzel
cd14e22cdf
Longer timeout (120 secs) for swap_setup protocol
Given that we combined the `spot_price` and the `execution_setup` messaging into one protocol we should allow the protocol to take longer than 60 seconds to complete.
This is especially important for connections over Tor, where messaging can take significantly longer than over clearnet.
I ran some tests with Tor and did not run into issues with the 60 seconds, but we get very close to the timeout, so we better make it more resilient by adding more time.
2021-06-28 12:08:51 +10:00
Daniel Karzel
fd18a07426
Flush and close swap_setup substreams
When swapping on testnet we ran into a problem where the CLI started the swap after sending all messages successfully, but the ASB ran into a `connection closed` error at the end of the `swap_setup` and the swap state machine was never actually triggered.

Flushing and closing the stream on both sides should ensure that we don't run into this problem and both parties gracefully exit the protocol.
2021-06-28 12:08:50 +10:00
Daniel Karzel
c2c9e975ef
Quote protocol asb/cli instead of alice/bob
The quote protocol has no relation to the protocol roles but to the application hence the rename.
2021-06-28 10:04:08 +10:00
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.
2021-06-28 10:04:08 +10:00
Daniel Karzel
818147a629
swap_setup instead of spot_price and execution_setup
Having `spot_price` and `execution_setup` as separate protocols did not bring any advantages, but was problematic because we had to ensure that `execution_setup` would be triggered after `spot_price`. Because of this dependency it is better to combine the protocols into one.

Combining the protocols also allows a refactoring to get rid of the `libp2p-async-await` dependency.

Alice always listens for the `swap_setup` protocol. When Bob opens a substream on that protocol the spot price is communicated, and then all execution setup messages (swap-id and signature exchange).
2021-06-28 10:04:07 +10:00
Daniel Karzel
529de8d5fd
ASB aborts if CLI does not lock BTC
Includes a new state that is used to await BTC lock tx finality. Upon starting the swap we initially only wait for the BTC lock tx to be seen in the mempool.
This is guarded by a short timeout (3 mins), because it is assumed that in the current setup (sport_price + execution_setup only triggered upon funds being available already) the lock transaction should be picked up almost instanly after the execution setup succeeded.
2021-06-23 17:54:42 +10:00
Daniel Karzel
c4c798ea20
Timeout on execution_setup for ASB
Similar to the CLI the ASB has to ensure that the execution_setup is executed within a certain time.
Without a timeout the price (returned by `spot_price` would be guaranteed with the CLI indefinitely.
2021-06-23 17:54:42 +10:00
Daniel Karzel
1ae377ef24
Request timeout when swapping over Tor
It seems the current chosen channel timeouts are still not optimal.
I ran into issues with swapping over Tor and traced them down to the CLI timeout of the bmrng channel.
It appears that the ASB was not running as quick as the CLI, which caused a timeout on the CLI side (in addition to the delay when sending messages over Tor).
Only `execution_setup` caused the problem so far, but I would recommend changing all the channel timeouts to one minute to avoid this problem.
2021-06-23 17:53:50 +10:00
bors[bot]
c6b0013b92
Merge #581 #583
581: Remove dead code r=thomaseizinger a=da-kami



583: Bump reqwest from 0.11.3 to 0.11.4 r=thomaseizinger a=dependabot[bot]

Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.11.3 to 0.11.4.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/seanmonstar/reqwest/releases">reqwest's releases</a>.</em></p>
<blockquote>
<h2>v0.11.4</h2>
<ul>
<li>Add <code>ClientBuilder::resolve()</code> option to override DNS resolution for specific domains.</li>
<li>Add <code>native-tls-alpn</code> Cargo feature to use ALPN with the native-tls backend.</li>
<li>Add <code>ClientBuilder::deflate()</code> option and <code>deflate</code> Cargo feature to support decoding response bodies using deflate.</li>
<li>Add <code>RequestBuilder::version()</code> to allow setting the HTTP version of a request.</li>
<li>Fix allowing &quot;invalid&quot; certificates with the <code>rustls-tls</code> backend, when the server uses TLS v1.2 or v1.3.</li>
<li>(wasm) Add <code>try_clone</code> to <code>Request</code> and <code>RequestBuilder</code></li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md">reqwest's changelog</a>.</em></p>
<blockquote>
<h2>v0.11.4</h2>
<ul>
<li>Add <code>ClientBuilder::resolve()</code> option to override DNS resolution for specific domains.</li>
<li>Add <code>native-tls-alpn</code> Cargo feature to use ALPN with the native-tls backend.</li>
<li>Add <code>ClientBuilder::deflate()</code> option and <code>deflate</code> Cargo feature to support decoding response bodies using deflate.</li>
<li>Add <code>RequestBuilder::version()</code> to allow setting the HTTP version of a request.</li>
<li>Fix allowing &quot;invalid&quot; certificates with the <code>rustls-tls</code> backend, when the server uses TLS v1.2 or v1.3.</li>
<li>(wasm) Add <code>try_clone</code> to <code>Request</code> and <code>RequestBuilder</code></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="f5fe17876a"><code>f5fe178</code></a> v0.11.4</li>
<li><a href="8e5af459e5"><code>8e5af45</code></a> Allow overriding of DNS resolution to specified IP addresses(<a href="https://github-redirect.dependabot.com/seanmonstar/reqwest/issues/561">#561</a>) (<a href="https://github-redirect.dependabot.com/seanmonstar/reqwest/issues/1277">#1277</a>)</li>
<li><a href="c4388fcff9"><code>c4388fc</code></a> WASM: Add <code>try_clone</code> implementations to <code>Request</code> and <code>RequestBuilder</code> (<a href="https://github-redirect.dependabot.com/seanmonstar/reqwest/issues/1286">#1286</a>)</li>
<li><a href="b48cb4a5aa"><code>b48cb4a</code></a> Add native-tls-alpn feature (<a href="https://github-redirect.dependabot.com/seanmonstar/reqwest/issues/1283">#1283</a>)</li>
<li><a href="bbeb1ede4e"><code>bbeb1ed</code></a> Bump ssri from 6.0.1 to 6.0.2 in /examples/wasm_github_fetch (<a href="https://github-redirect.dependabot.com/seanmonstar/reqwest/issues/1262">#1262</a>)</li>
<li><a href="841d47c6a2"><code>841d47c</code></a> Bump url-parse from 1.4.7 to 1.5.1 in /examples/wasm_github_fetch (<a href="https://github-redirect.dependabot.com/seanmonstar/reqwest/issues/1267">#1267</a>)</li>
<li><a href="33bc7939b4"><code>33bc793</code></a> Bump lodash from 4.17.19 to 4.17.21 in /examples/wasm_github_fetch (<a href="https://github-redirect.dependabot.com/seanmonstar/reqwest/issues/1269">#1269</a>)</li>
<li><a href="b0af278f78"><code>b0af278</code></a> Implement &quot;default&quot; functions of the trait to fix &quot;insecure&quot; mode (<a href="https://github-redirect.dependabot.com/seanmonstar/reqwest/issues/1259">#1259</a>)</li>
<li><a href="8d3e27966c"><code>8d3e279</code></a> use ZlibDecoder for deflate responses (<a href="https://github-redirect.dependabot.com/seanmonstar/reqwest/issues/1257">#1257</a>)</li>
<li><a href="b88f309339"><code>b88f309</code></a> Fix small typos in <code>Client</code> docs (<a href="https://github-redirect.dependabot.com/seanmonstar/reqwest/issues/1253">#1253</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/seanmonstar/reqwest/compare/v0.11.3...v0.11.4">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=reqwest&package-manager=cargo&previous-version=0.11.3&new-version=0.11.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

You can trigger a rebase of this PR by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

Co-authored-by: Daniel Karzel <daniel@comit.network>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-23 03:41:02 +00:00
bors[bot]
858c6d85ce
Merge #576
576: Bump to Rust 1.53 r=thomaseizinger a=thomaseizinger



Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2021-06-23 03:17:17 +00:00
Daniel Karzel
ca6b889632
Remove dead code 2021-06-22 17:06:21 +10:00
bors[bot]
3e88e13fbb
Merge #566 #568
566: Bump rand_chacha from 0.3.0 to 0.3.1 r=thomaseizinger a=dependabot[bot]

Bumps [rand_chacha](https://github.com/rust-random/rand) from 0.3.0 to 0.3.1.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/rust-random/rand/blob/master/CHANGELOG.md">rand_chacha's changelog</a>.</em></p>
<blockquote>
<h2>[0.3.19] - 2017-12-27</h2>
<h3>Changed</h3>
<ul>
<li>Require <code>log &lt;= 0.3.8</code> for dev builds</li>
<li>Update <code>fuchsia-zircon</code> dependency to 0.3</li>
<li>Fix broken links in docs (to unblock compiler docs testing CI)</li>
</ul>
<h2>[0.3.18] - 2017-11-06</h2>
<h3>Changed</h3>
<ul>
<li><code>thread_rng</code> is seeded from the system time if <code>OsRng</code> fails</li>
<li><code>weak_rng</code> now uses <code>thread_rng</code> internally</li>
</ul>
<h2>[0.3.17] - 2017-10-07</h2>
<h3>Changed</h3>
<ul>
<li>Fuchsia: Magenta was renamed Zircon</li>
</ul>
<h2>[0.3.16] - 2017-07-27</h2>
<h3>Added</h3>
<ul>
<li>Implement Debug for mote non-public types</li>
<li>implement <code>Rand</code> for (i|u)i128</li>
<li>Support for Fuchsia</li>
</ul>
<h3>Changed</h3>
<ul>
<li>Add inline attribute to SampleRange::construct_range.
This improves the benchmark for sample in 11% and for shuffle in 16%.</li>
<li>Use <code>RtlGenRandom</code> instead of <code>CryptGenRandom</code></li>
</ul>
<h2>[0.3.15] - 2016-11-26</h2>
<h3>Added</h3>
<ul>
<li>Add <code>Rng</code> trait method <code>choose_mut</code></li>
<li>Redox support</li>
</ul>
<h3>Changed</h3>
<ul>
<li>Use <code>arc4rand</code> for <code>OsRng</code> on FreeBSD.</li>
<li>Use <code>arc4random(3)</code> for <code>OsRng</code> on OpenBSD.</li>
</ul>
<h3>Fixed</h3>
<ul>
<li>Fix filling buffers 4 GiB or larger with <code>OsRng::fill_bytes</code> on Windows</li>
</ul>
<h2>[0.3.14] - 2016-02-13</h2>
<h3>Fixed</h3>
<ul>
<li>Inline definitions from winapi/advapi32, which decreases build times</li>
</ul>
<h2>[0.3.13] - 2016-01-09</h2>
<h3>Fixed</h3>
<ul>
<li>Compatible with Rust 1.7.0-nightly (needed some extra type annotations)</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="98a0339f99"><code>98a0339</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/rust-random/rand/issues/1135">#1135</a> from dhardy/work</li>
<li><a href="a7f8fb72d7"><code>a7f8fb7</code></a> Prepare rand_chacha v0.3.1 release</li>
<li><a href="09d3df3119"><code>09d3df3</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/rust-random/rand/issues/1130">#1130</a> from dhardy/work</li>
<li><a href="d167dd25d2"><code>d167dd2</code></a> Deprecate ReadRng</li>
<li><a href="e3bc4a1357"><code>e3bc4a1</code></a> Do not impl serde for ReadRng or ReseedingRng</li>
<li><a href="66b163632e"><code>66b1636</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/rust-random/rand/issues/1132">#1132</a> from rust-random/readme-wasm-note</li>
<li><a href="d9c6a76048"><code>d9c6a76</code></a> README: add note regarding wasm32-unknown-unknown</li>
<li><a href="4726d328d6"><code>4726d32</code></a> Update minimum version of packed_simd_2</li>
<li><a href="f6bbfcfa89"><code>f6bbfcf</code></a> serde for BlockRng, ReseedingRng and ReadRng</li>
<li><a href="2732f2d6a8"><code>2732f2d</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/rust-random/rand/issues/1116">#1116</a> from vks/criterion</li>
<li>Additional commits viewable in <a href="https://github.com/rust-random/rand/compare/rand_chacha-0.3.0...rand_chacha-0.3.1">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=rand_chacha&package-manager=cargo&previous-version=0.3.0&new-version=0.3.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

You can trigger a rebase of this PR by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

568: Bump bdk from 0.7.0 to 0.8.0 r=thomaseizinger a=dependabot[bot]

Bumps [bdk](https://github.com/bitcoindevkit/bdk) from 0.7.0 to 0.8.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/bitcoindevkit/bdk/blob/master/CHANGELOG.md">bdk's changelog</a>.</em></p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="33b45ebe82"><code>33b45eb</code></a> Bump version to 0.8.0</li>
<li><a href="2faed425ed"><code>2faed42</code></a> Update CHANGELOG</li>
<li><a href="2cc05c07a5"><code>2cc05c0</code></a> Bump version in <code>src/lib.rs</code></li>
<li><a href="9205295332"><code>9205295</code></a> Merge commit 'refs/pull/365/head' of github.com:bitcoindevkit/bdk into releas...</li>
<li><a href="3b446c9e14"><code>3b446c9</code></a> Use no_run instead of ignore</li>
<li><a href="378167efca"><code>378167e</code></a> Remove explicit <code>feature(external_doc)</code></li>
<li><a href="224be27aa8"><code>224be27</code></a> Fix example/doctests format</li>
<li><a href="4a23070cc8"><code>4a23070</code></a> [ci] Check fmt for examples/doctests</li>
<li><a href="f8117c0f9f"><code>f8117c0</code></a> Bump version to 0.8.0-rc.1</li>
<li><a href="0ec064ef13"><code>0ec064e</code></a> Use AddressInfo in private methods</li>
<li>Additional commits viewable in <a href="https://github.com/bitcoindevkit/bdk/compare/v0.7.0...v0.8.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=bdk&package-manager=cargo&previous-version=0.7.0&new-version=0.8.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

You can trigger a rebase of this PR by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-21 03:12:03 +00:00
Thomas Eizinger
7120a1f70a
Don't depend on core::fmt through bitcoin_hashes re-export 2021-06-21 12:14:02 +10:00
Thomas Eizinger
3aa028e3bf
Use or-pattern stabilized in Rust 1.53 where possible 2021-06-21 11:57:21 +10:00
Thomas Eizinger
ac0b0150e6
Upgrade to Rust 1.53
Also fix all clippy lints that came up.
2021-06-21 11:56:04 +10:00
Thomas Eizinger
b7064578ca
Reduce level of indentation of match statements 2021-06-21 11:46:24 +10:00
Thomas Eizinger
f1182f97c0
Simplify match statement
This code is unnecessarily complicated.
2021-06-21 11:31:24 +10:00
Thomas Eizinger
707bae9ff0
Merge patterns of nested match 2021-06-21 11:22:45 +10:00
dependabot[bot]
9577875834
Bump bdk from 0.7.0 to 0.8.0
Bumps [bdk](https://github.com/bitcoindevkit/bdk) from 0.7.0 to 0.8.0.
- [Release notes](https://github.com/bitcoindevkit/bdk/releases)
- [Changelog](https://github.com/bitcoindevkit/bdk/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bitcoindevkit/bdk/compare/v0.7.0...v0.8.0)

---
updated-dependencies:
- dependency-name: bdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-21 11:16:45 +10:00
Thomas Eizinger
1ba186aa63
Make log message a proper statement
"Listening on" is only half a sentence.
2021-06-21 09:01:21 +10:00
Thomas Eizinger
ff8cd0ab93
Harmonise log statements between applications
The refactoring of the transport initialization removed the log statement
for the asb. We re-introduce this log statement in main for consistency.
2021-06-21 09:01:20 +10:00
Thomas Eizinger
8a30ef725c
Refactor transports to construct them specific for each application
Instead of splitting up the transports into capabilities, we compose
them directly for each application. This allows us to remove the
websocket transport for the CLI which is really only needed for the
ASB to allow retrieval of quotes via the browser.
2021-06-21 09:01:19 +10:00
Thomas Eizinger
90deb6451c
Rename swarm constructors to be per tool instead of per role 2021-06-21 09:00:10 +10:00
Thomas Eizinger
d19231d811
Refactor Tor transport to be dial-only
Libp2p's transports are meant to be composed. Hence, any form of
fallback should be implemented by emitting `MultiaddrNotSupported`
from the `listen` and `dial` functions.

This allows us to completely remove the tcp transport from the tor
transport.
2021-06-21 09:00:10 +10:00
Thomas Eizinger
8bd6c9dcfc
Simplify construction of Socks5Stream 2021-06-21 09:00:09 +10:00
Thomas Eizinger
ea0fd1eb53
Inline functions to reduce complexity induced by indirection 2021-06-21 09:00:09 +10:00
Thomas Eizinger
97a09807dd
Use BoxFuture type alias to avoid clippy's complexity nag 2021-06-21 09:00:09 +10:00
Thomas Eizinger
d01e444c90
Import anyhow::Result instead of fully-qualifying it 2021-06-21 09:00:06 +10:00
bors[bot]
7f2aa59880
Merge #504 #547 #556 #563 #564
504: Bump bdk from 0.6.0 to 0.7.0 r=thomaseizinger a=dependabot[bot]

Bumps [bdk](https://github.com/bitcoindevkit/bdk) from 0.6.0 to 0.7.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/bitcoindevkit/bdk/blob/v0.7.0/CHANGELOG.md">bdk's changelog</a>.</em></p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="766570abfd"><code>766570a</code></a> Bump version to 0.7.0</li>
<li><a href="934ec366d9"><code>934ec36</code></a> Use the released <code>testutils-macros</code></li>
<li><a href="d0733e9496"><code>d0733e9</code></a> Bump version in <code>src/lib.rs</code></li>
<li><a href="3c7a1f5918"><code>3c7a1f5</code></a> Bump <code>testutils-macros</code> to <code>v0.6.0</code></li>
<li><a href="85aadaccd2"><code>85aadac</code></a> Update changelog in preparation of <code>v0.7.0</code></li>
<li><a href="fad0fe9f30"><code>fad0fe9</code></a> Update create transaction example code</li>
<li><a href="47f26447da"><code>47f2644</code></a> continue signing when finding already finalized inputs</li>
<li><a href="3608ff9f14"><code>3608ff9</code></a> Merge commit 'refs/pull/341/head' of github.com:bitcoindevkit/bdk into releas...</li>
<li><a href="898dfe6cf1"><code>898dfe6</code></a> get psbt inputs with bounds check</li>
<li><a href="7961ae7f8e"><code>7961ae7</code></a> Check index out of bound also for tx inputs not only for psbt inputs</li>
<li>Additional commits viewable in <a href="https://github.com/bitcoindevkit/bdk/compare/v0.6.0...v0.7.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=bdk&package-manager=cargo&previous-version=0.6.0&new-version=0.7.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

547: Print the Bitcoin address to the terminal as a QR code r=thomaseizinger a=xscd

It helps to fund the Bitcoin address with your mobile device without a need to copy-paste the receive address. 

Here is how it looks like under different terminals:
1) Gnome Terminal:
![1](https://user-images.githubusercontent.com/46658470/120103390-0e87dd80-c158-11eb-9e0f-da5af89ea8d7.png)
2) Alacritty:
![2](https://user-images.githubusercontent.com/46658470/120103398-1ba4cc80-c158-11eb-89c0-8a54e8902658.png)
3) Kitty:
![3](https://user-images.githubusercontent.com/46658470/120103411-265f6180-c158-11eb-95e1-b37c2d16c2b6.png)
4) Konsole:
![4](https://user-images.githubusercontent.com/46658470/120103421-2f503300-c158-11eb-83bf-82d55b6e2dd8.png)



556: Bump rust_decimal from 1.14.1 to 1.14.2 r=thomaseizinger a=dependabot[bot]

Bumps [rust_decimal](https://github.com/paupino/rust-decimal) from 1.14.1 to 1.14.2.
<details>
<summary>Commits</summary>
<ul>
<li><a href="16b41cc58c"><code>16b41cc</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/paupino/rust-decimal/issues/394">#394</a> from paupino/version/1.14.2</li>
<li><a href="c7bd3bf987"><code>c7bd3bf</code></a> Version 1.14.2</li>
<li><a href="c0117ddc36"><code>c0117dd</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/paupino/rust-decimal/issues/393">#393</a> from paupino/issue/392</li>
<li><a href="a231fbf12c"><code>a231fbf</code></a> Fixes issue with remainder overflow</li>
<li>See full diff in <a href="https://github.com/paupino/rust-decimal/compare/1.14.1...1.14.2">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=rust_decimal&package-manager=cargo&previous-version=1.14.1&new-version=1.14.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

You can trigger a rebase of this PR by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

563: Bump tokio from 1.6.0 to 1.7.0 r=thomaseizinger a=dependabot[bot]

Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.6.0 to 1.7.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/tokio-rs/tokio/releases">tokio's releases</a>.</em></p>
<blockquote>
<h2>Tokio v1.7.0</h2>
<h1>1.7.0 (June 15, 2021)</h1>
<h3>Added</h3>
<ul>
<li>net: add named pipes on windows (<a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/3760">#3760</a>)</li>
<li>net: add <code>TcpSocket</code> from <code>std::net::TcpStream</code> conversion (<a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/3838">#3838</a>)</li>
<li>sync: add <code>receiver_count</code> to <code>watch::Sender</code> (<a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/3729">#3729</a>)</li>
<li>sync: export <code>sync::notify::Notified</code> future publicly (<a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/3840">#3840</a>)</li>
<li>tracing: instrument task wakers (<a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/3836">#3836</a>)</li>
</ul>
<h3>Fixed</h3>
<ul>
<li>macros: suppress <code>clippy::default_numeric_fallback</code> lint in generated code (<a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/3831">#3831</a>)</li>
<li>runtime: immediately drop new tasks when runtime is shut down (<a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/3752">#3752</a>)</li>
<li>sync: deprecate unused <code>mpsc::RecvError</code> type (<a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/3833">#3833</a>)</li>
</ul>
<h3>Documented</h3>
<ul>
<li>io: clarify EOF condition for <code>AsyncReadExt::read_buf</code> (<a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/3850">#3850</a>)</li>
<li>io: clarify limits on return values of <code>AsyncWrite::poll_write</code> (<a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/3820">#3820</a>)</li>
<li>sync: add examples to Semaphore (<a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/3808">#3808</a>)</li>
</ul>
<h2>Tokio v1.6.2</h2>
<h3>Fixes</h3>
<ul>
<li>test: sub-ms <code>time:advance</code> regression introduced in 1.6 (<a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/3852">#3852</a>)</li>
</ul>
<p><a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/3852">#3852</a>: <a href="https://github-redirect.dependabot.com/tokio-rs/tokio/pull/3852">tokio-rs/tokio#3852</a></p>
<h2>Tokio v1.6.1</h2>
<p>This release reverts <a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/3518">#3518</a> because it doesn't work on some kernels due to
a kernel bug. (<a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/3803">#3803</a>)</p>
<p><a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/3518">#3518</a>: <a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/3518">tokio-rs/tokio#3518</a>
<a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/3803">#3803</a>: <a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/3803">tokio-rs/tokio#3803</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="34c6a26c01"><code>34c6a26</code></a> chore: prepare Tokio v1.7.0 (<a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/3863">#3863</a>)</li>
<li><a href="97e7830364"><code>97e7830</code></a> net: provide NamedPipe{Client, Server} types and builders (<a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/3760">#3760</a>)</li>
<li><a href="606206ecad"><code>606206e</code></a> Merge branch 'tokio-1.6.x' into merge-1.6.x</li>
<li><a href="dfe4013ff2"><code>dfe4013</code></a> chore: prepare Tokio 1.6.2 release (<a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/3859">#3859</a>)</li>
<li><a href="18779aa2e2"><code>18779aa</code></a> time: fix time::advance() with sub-ms durations (<a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/3852">#3852</a>)</li>
<li><a href="2c24a028f6"><code>2c24a02</code></a> chore: re-enable test_socket_pair on FreeBSD (<a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/3844">#3844</a>)</li>
<li><a href="f55b77aadd"><code>f55b77a</code></a> tracing: emit waker op as str instead as Debug (<a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/3853">#3853</a>)</li>
<li><a href="21de476ae7"><code>21de476</code></a> sync: export sync::notify::Notified future publicly (<a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/3840">#3840</a>)</li>
<li><a href="cb147a2b3f"><code>cb147a2</code></a> sync: deprecate mpsc::RecvError (<a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/3833">#3833</a>)</li>
<li><a href="f759240254"><code>f759240</code></a> chore: update version in README.md (<a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/3851">#3851</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/tokio-rs/tokio/compare/tokio-1.6.0...tokio-1.7.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=tokio&package-manager=cargo&previous-version=1.6.0&new-version=1.7.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

You can trigger a rebase of this PR by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

564: Bump thomaseizinger/create-pull-request from 1.0.0 to 1.1.0 r=thomaseizinger a=dependabot[bot]

Bumps [thomaseizinger/create-pull-request](https://github.com/thomaseizinger/create-pull-request) from 1.0.0 to 1.1.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/thomaseizinger/create-pull-request/blob/master/CHANGELOG.md">thomaseizinger/create-pull-request's changelog</a>.</em></p>
<blockquote>
<h2>[1.1.0] - 2021-06-16</h2>
<h3>Added</h3>
<ul>
<li>Git hook to make sure we always run <code>yarn build</code> before committing any Typescript changes. This should prevent dist/index.js from getting out of date.</li>
<li>Support for setting a proxy using the <code>HTTPS_PROXY</code> environment variable</li>
<li>Support for GitHub Enterprise by reading <code>process.env.GITHUB_REPOSITORY</code></li>
</ul>
<h3>Fixed</h3>
<ul>
<li>action.yml suggested to use <code>github-token</code> as the input where as in reality, we are looking for an input <code>github_token</code> (note the underscore!)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="285345fb83"><code>285345f</code></a> Add support for creating PR's in ghes and behind proxy (<a href="https://github-redirect.dependabot.com/thomaseizinger/create-pull-request/issues/41">#41</a>)</li>
<li><a href="13c98abb44"><code>13c98ab</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/thomaseizinger/create-pull-request/issues/37">#37</a> from orestesgaolin/patch-1</li>
<li><a href="5c8c2b6c09"><code>5c8c2b6</code></a> Fix parameters in the example</li>
<li><a href="1dde00b9ad"><code>1dde00b</code></a> Adapt LICENSE</li>
<li><a href="655db51f4a"><code>655db51</code></a> Automatically set the hookspath to our git hooks</li>
<li><a href="cedbbbb2ba"><code>cedbbbb</code></a> Update README.md</li>
<li><a href="2cd3e70bc6"><code>2cd3e70</code></a> Add readme note about inputs</li>
<li><a href="faf5ed2aa5"><code>faf5ed2</code></a> Define Inputs type through type magic on payloads types</li>
<li><a href="3fb1c8b1be"><code>3fb1c8b</code></a> Fixing git url in package.json</li>
<li><a href="e46f94e6ae"><code>e46f94e</code></a> Add git hook for making sure we update index.js</li>
<li>Additional commits viewable in <a href="https://github.com/thomaseizinger/create-pull-request/compare/1.0.0...1.1.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=thomaseizinger/create-pull-request&package-manager=github_actions&previous-version=1.0.0&new-version=1.1.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

You can trigger a rebase of this PR by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: xscd <xscd@pm.me>
2021-06-17 01:06:54 +00:00
xscd
03857ca835 Print the Bitcoin address to the terminal as a QR code 2021-06-16 15:18:16 +03:00
dependabot[bot]
e9595487f6
Bump strum from 0.20.0 to 0.21.0
Bumps [strum](https://github.com/Peternator7/strum) from 0.20.0 to 0.21.0.
- [Release notes](https://github.com/Peternator7/strum/releases)
- [Changelog](https://github.com/Peternator7/strum/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Peternator7/strum/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-01 06:45:25 +00:00
bors[bot]
eb705d3e9c
Merge #515
515: Make it easier to create a bitcoin::Wallet for testing r=thomaseizinger a=thomaseizinger

Forcing the user to create an implementation of `EstimateFeeRate`
every time they want to create a wallet for testing is tedious and
leads to duplicated code.

The implementation for tests is rarely dynamic and thus can be
simplified to static arguments.

This also allows us to provide convenience constructors to make tests
that don't care about fees less distracting by reducing the number of
constants that are floating around.

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2021-05-28 08:57:22 +00:00
dependabot[bot]
6badf09394
Bump bdk from 0.6.0 to 0.7.0
Bumps [bdk](https://github.com/bitcoindevkit/bdk) from 0.6.0 to 0.7.0.
- [Release notes](https://github.com/bitcoindevkit/bdk/releases)
- [Changelog](https://github.com/bitcoindevkit/bdk/blob/v0.7.0/CHANGELOG.md)
- [Commits](https://github.com/bitcoindevkit/bdk/compare/v0.6.0...v0.7.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-28 18:42:25 +10:00