Commit Graph

1347 Commits

Author SHA1 Message Date
Philipp Hoenisch
14c5a4f025
Add upper bound for bitcoin fees of 100,000 satoshi.
Fees are hard to compute and it is too easy to get wrong and lose a lot of money. Hence, a hardcoded maximum of 100,000 satoshi for a single transaction is in place.
2021-05-07 10:24:41 +10:00
Philipp Hoenisch
46e0449b8e
Add config/argument to swap/asb to configure bitcoin tx fees. 2021-05-07 10:24:41 +10:00
Philipp Hoenisch
9e8b788aa9
Rename weight constants. 2021-05-07 10:24:41 +10:00
Philipp Hoenisch
ee90c228b4
Dynamically calculate fees using electrum's estimate_fee.
Electrum has an estimate-fee feature which takes as input the block you want a tx to be included.
The result is a recommendation of BTC/vbyte.
Using this recommendation and the knowledge about the size of our transactions we compute an appropriate fee.
The size of the transactions were taken from real transactions as published on bitcoin testnet.
Note: in reality these sizes might fluctuate a bit but not for much.
2021-05-07 10:24:41 +10:00
Philipp Hoenisch
38540b4de5
Dynamically chose fee for TxCancel.
Bob chooses the fee for TxCancel because he is the one that cares.
2021-05-07 10:24:41 +10:00
Philipp Hoenisch
1012e39527
Dynamically chose fee for TxRefund and TxPunish.
Alice chooses the fee for TxPunish because she is the one that cares.
Bob chooses the fee for TxRefund because he is the one that cares.

Note must be taken here because if the fee is too low (e.g. < min tx fee) then she might not be able to publish TxRedeem at all.
2021-05-07 10:24:41 +10:00
Philipp Hoenisch
d5c1b6693e
Dynamically chose fee for TxRedeem.
Alice chooses the fee for TxRedeem because she is the one that cares. Note must be taken here because if the fee is too low (e.g. < min tx fee) then she might not be able to publish TxRedeem at all.
2021-05-07 10:24:41 +10:00
Philipp Hoenisch
002e7b38c3
Define TX_FEE within test files only. 2021-05-07 10:24:41 +10:00
dependabot[bot]
a90931bae5
Bump sha2 from 0.9.3 to 0.9.4
Bumps [sha2](https://github.com/RustCrypto/hashes) from 0.9.3 to 0.9.4.
- [Release notes](https://github.com/RustCrypto/hashes/releases)
- [Commits](https://github.com/RustCrypto/hashes/compare/sha2-v0.9.3...sha2-v0.9.4)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-06 07:42:22 +00:00
dependabot[bot]
4514b564bf
Bump dprint/check from v1.3 to v1.4
Bumps [dprint/check](https://github.com/dprint/check) from v1.3 to v1.4.
- [Release notes](https://github.com/dprint/check/releases)
- [Commits](https://github.com/dprint/check/compare/v1.3...a3ed4347fef5b3b2bf68cc38b44885d9df913253)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-06 07:37:01 +00:00
bors[bot]
0006130756
Merge #473
473: Bump rust_decimal from 1.12.4 to 1.13.0 r=thomaseizinger a=dependabot[bot]

Bumps [rust_decimal](https://github.com/paupino/rust-decimal) from 1.12.4 to 1.13.0.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a href="https://github.com/paupino/rust-decimal/commits/1.13.0">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.12.4&new-version=1.13.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>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-05 23:48:46 +00:00
bors[bot]
7c18ae23a8
Merge #472
472: Increase timeout sending/receiving protocol messages.  r=bonomat a=bonomat

Resolves #465 

@thomaseizinger / @da-kami : Shall we make this configurable?

Co-authored-by: Philipp Hoenisch <philipp@hoenisch.at>
2021-05-04 23:11:04 +00:00
bors[bot]
6eb387ef40
Merge #467
467: Bump tracing from 0.1.25 to 0.1.26 r=thomaseizinger a=dependabot[bot]

Bumps [tracing](https://github.com/tokio-rs/tracing) from 0.1.25 to 0.1.26.
<details>
<summary>Commits</summary>
<ul>
<li><a href="d9e8eceafd"><code>d9e8ece</code></a> tracing: prepare to release 0.1.26 (<a href="https://github-redirect.dependabot.com/tokio-rs/tracing/issues/1383">#1383</a>)</li>
<li><a href="8d428b25d7"><code>8d428b2</code></a> core: prepare to release v0.1.18</li>
<li><a href="848ee2d157"><code>848ee2d</code></a> docs: document span.in_scope() at top-level (<a href="https://github-redirect.dependabot.com/tokio-rs/tracing/issues/1344">#1344</a>)</li>
<li><a href="88b176cdb5"><code>88b176c</code></a> tracing: impl <code>From\&lt;EnteredSpan&gt;</code> for <code>Option\&lt;Id&gt;</code> (<a href="https://github-redirect.dependabot.com/tokio-rs/tracing/issues/1325">#1325</a>)</li>
<li><a href="ccfa2cc687"><code>ccfa2cc</code></a> core: add support for <code>Arc\&lt;dyn Subscriber + ...&gt;</code></li>
<li><a href="f9a3f17fbb"><code>f9a3f17</code></a> tracing: add an example of <code>tracing</code> in a panic hook (<a href="https://github-redirect.dependabot.com/tokio-rs/tracing/issues/1375">#1375</a>)</li>
<li><a href="e63d8e454b"><code>e63d8e4</code></a> core: add <code>Subscriber</code> impl for <code>Box\&lt;dyn Subscriber + ...&gt;</code> (<a href="https://github-redirect.dependabot.com/tokio-rs/tracing/issues/1358">#1358</a>)</li>
<li><a href="1e8446eaa0"><code>1e8446e</code></a> subscriber: support special chars in span names (<a href="https://github-redirect.dependabot.com/tokio-rs/tracing/issues/1368">#1368</a>)</li>
<li><a href="396d9f42a5"><code>396d9f4</code></a> chore: fix cargo docs warnings (<a href="https://github-redirect.dependabot.com/tokio-rs/tracing/issues/1362">#1362</a>)</li>
<li><a href="5e435b1220"><code>5e435b1</code></a> subscriber: deprecate <code>CurrentSpan</code> (<a href="https://github-redirect.dependabot.com/tokio-rs/tracing/issues/1321">#1321</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/tokio-rs/tracing/compare/tracing-0.1.25...tracing-0.1.26">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=tracing&package-manager=cargo&previous-version=0.1.25&new-version=0.1.26)](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>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-04 13:37:25 +00:00
dependabot[bot]
7f74fd0190
Bump rust_decimal from 1.12.4 to 1.13.0
Bumps [rust_decimal](https://github.com/paupino/rust-decimal) from 1.12.4 to 1.13.0.
- [Release notes](https://github.com/paupino/rust-decimal/releases)
- [Commits](https://github.com/paupino/rust-decimal/commits/1.13.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-04 07:42:29 +00:00
bors[bot]
21b16b7ff5
Merge #471
471: Remove torut patch to custom fork. r=bonomat a=bonomat

https://github.com/teawithsand/torut/pull/10 was merged and a new version released.

Co-authored-by: Philipp Hoenisch <philipp@hoenisch.at>
2021-05-04 06:34:05 +00:00
Philipp Hoenisch
1db7586632
Increase timeout sending/receiving protocol messages. 2021-05-04 15:38:55 +10:00
Philipp Hoenisch
1c8dfa52c6
Remove torut patch to custom fork. 2021-05-04 14:42:29 +10:00
bors[bot]
3b96aa4a1f
Merge #464
464: Add short description of how to configure Tor. r=bonomat a=bonomat

@da-kami : Is this the right place to document this? 

Co-authored-by: Philipp Hoenisch <philipp@hoenisch.at>
Co-authored-by: Philipp Hoenisch <philipp@coblox.tech>
2021-05-04 02:02:57 +00:00
dependabot[bot]
6e13752300
Bump tracing from 0.1.25 to 0.1.26
Bumps [tracing](https://github.com/tokio-rs/tracing) from 0.1.25 to 0.1.26.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-0.1.25...tracing-0.1.26)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-04 00:53:59 +00:00
bors[bot]
ac232843d2
Merge #468 #469
468: Bump rust_decimal from 1.12.3 to 1.12.4 r=thomaseizinger a=dependabot[bot]

Bumps [rust_decimal](https://github.com/paupino/rust-decimal) from 1.12.3 to 1.12.4.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a href="https://github.com/paupino/rust-decimal/commits">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.12.3&new-version=1.12.4)](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>

469: Bump tracing-subscriber from 0.2.17 to 0.2.18 r=thomaseizinger a=dependabot[bot]

Bumps [tracing-subscriber](https://github.com/tokio-rs/tracing) from 0.2.17 to 0.2.18.
<details>
<summary>Commits</summary>
<ul>
<li><a href="dd49b99016"><code>dd49b99</code></a> subscriber: prepare to release 0.2.18 (<a href="https://github-redirect.dependabot.com/tokio-rs/tracing/issues/1384">#1384</a>)</li>
<li><a href="d9e8eceafd"><code>d9e8ece</code></a> tracing: prepare to release 0.1.26 (<a href="https://github-redirect.dependabot.com/tokio-rs/tracing/issues/1383">#1383</a>)</li>
<li><a href="8d428b25d7"><code>8d428b2</code></a> core: prepare to release v0.1.18</li>
<li><a href="848ee2d157"><code>848ee2d</code></a> docs: document span.in_scope() at top-level (<a href="https://github-redirect.dependabot.com/tokio-rs/tracing/issues/1344">#1344</a>)</li>
<li><a href="88b176cdb5"><code>88b176c</code></a> tracing: impl <code>From\&lt;EnteredSpan&gt;</code> for <code>Option\&lt;Id&gt;</code> (<a href="https://github-redirect.dependabot.com/tokio-rs/tracing/issues/1325">#1325</a>)</li>
<li><a href="ccfa2cc687"><code>ccfa2cc</code></a> core: add support for <code>Arc\&lt;dyn Subscriber + ...&gt;</code></li>
<li><a href="f9a3f17fbb"><code>f9a3f17</code></a> tracing: add an example of <code>tracing</code> in a panic hook (<a href="https://github-redirect.dependabot.com/tokio-rs/tracing/issues/1375">#1375</a>)</li>
<li><a href="e63d8e454b"><code>e63d8e4</code></a> core: add <code>Subscriber</code> impl for <code>Box\&lt;dyn Subscriber + ...&gt;</code> (<a href="https://github-redirect.dependabot.com/tokio-rs/tracing/issues/1358">#1358</a>)</li>
<li><a href="1e8446eaa0"><code>1e8446e</code></a> subscriber: support special chars in span names (<a href="https://github-redirect.dependabot.com/tokio-rs/tracing/issues/1368">#1368</a>)</li>
<li><a href="396d9f42a5"><code>396d9f4</code></a> chore: fix cargo docs warnings (<a href="https://github-redirect.dependabot.com/tokio-rs/tracing/issues/1362">#1362</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/tokio-rs/tracing/compare/tracing-subscriber-0.2.17...tracing-subscriber-0.2.18">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=tracing-subscriber&package-manager=cargo&previous-version=0.2.17&new-version=0.2.18)](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>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-04 00:35:48 +00:00
Philipp Hoenisch
90eb9fede1
Apply suggestions from code review
Co-authored-by: Daniel Karzel <daniel.karzel@coblox.tech>
2021-05-04 08:47:33 +10:00
dependabot[bot]
e0a4e89d1e
Bump tracing-subscriber from 0.2.17 to 0.2.18
Bumps [tracing-subscriber](https://github.com/tokio-rs/tracing) from 0.2.17 to 0.2.18.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-subscriber-0.2.17...tracing-subscriber-0.2.18)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-03 09:30:57 +00:00
dependabot[bot]
24519824a2
Bump rust_decimal from 1.12.3 to 1.12.4
Bumps [rust_decimal](https://github.com/paupino/rust-decimal) from 1.12.3 to 1.12.4.
- [Release notes](https://github.com/paupino/rust-decimal/releases)
- [Commits](https://github.com/paupino/rust-decimal/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-03 09:30:49 +00:00
bors[bot]
e7785d2c83
Merge #434
434: Introduce monero-wallet crate r=thomaseizinger a=thomaseizinger

This PR:

1. ~Introduce a crate for the epee binary serialization as a serde format~: Released here: https://github.com/comit-network/monero-epee-bin-serde
2. Extends the MoneroRPC client with two binary calls
3. Introduces a `monero-wallet` crate that for now just provides functionality for choosing random key offsets. Together with the the ability to produce bulletproofs and ring signatures, this should be enough for signing Monero transactions locally.

(1) and (2) are a prerequisite for (3).

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2021-05-03 03:21:18 +00:00
bors[bot]
02a61f1328
Merge #462
462: Bump rust_decimal from 1.12.2 to 1.12.3 r=thomaseizinger a=dependabot[bot]

Bumps [rust_decimal](https://github.com/paupino/rust-decimal) from 1.12.2 to 1.12.3.
<details>
<summary>Commits</summary>
<ul>
<li><a href="322e3d1a40"><code>322e3d1</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/paupino/rust-decimal/issues/363">#363</a> from paupino/version/1.12.3</li>
<li><a href="74f1a06b7d"><code>74f1a06</code></a> Version 1.12.3</li>
<li><a href="6c0a1dbff4"><code>6c0a1db</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/paupino/rust-decimal/issues/362">#362</a> from paupino/issue/361</li>
<li><a href="010868df10"><code>010868d</code></a> Fixes an issue whereby rounding small negative numbers towards zero would cau...</li>
<li><a href="bb9b05c05a"><code>bb9b05c</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/paupino/rust-decimal/issues/358">#358</a> from paupino/feautre/min-version</li>
<li><a href="831fb9ae2e"><code>831fb9a</code></a> Use precompiled version of cargo make</li>
<li><a href="2e80bff136"><code>2e80bff</code></a> Relax when CI should be run</li>
<li><a href="c862d1dd41"><code>c862d1d</code></a> Use stable toolchain for file format/clippy checks</li>
<li><a href="571f5c06d1"><code>571f5c0</code></a> Switch back to --workspace for cargo check compatible functions</li>
<li><a href="c64b400844"><code>c64b400</code></a> Revert to --all for older toolchain</li>
<li>Additional commits viewable in <a href="https://github.com/paupino/rust-decimal/compare/1.12.2...1.12.3">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.12.2&new-version=1.12.3)](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>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-03 03:02:27 +00:00
Philipp Hoenisch
01a60ff468
Add short description of how to configure Tor. 2021-05-02 11:31:14 +10:00
dependabot[bot]
502e298542
Bump rust_decimal from 1.12.2 to 1.12.3
Bumps [rust_decimal](https://github.com/paupino/rust-decimal) from 1.12.2 to 1.12.3.
- [Release notes](https://github.com/paupino/rust-decimal/releases)
- [Commits](https://github.com/paupino/rust-decimal/compare/1.12.2...1.12.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-30 07:42:23 +00:00
bors[bot]
cf1c448b7c
Merge #460
460: Different default directories for CLI and ASB r=da-kami a=da-kami

Fixes #437 

Using the same default directory as data-/config-dir has caused unwanted side effects when running both applications on the same machine.
Use these directory names:
- ASB: `xmr-btc-swap-asb`
- CLI: `xmr-btc-swap-cli`

Since the functionality is now application specific the respective functions were moved into the appropriate module of the application.

Co-authored-by: Daniel Karzel <daniel@comit.network>
2021-04-30 04:24:29 +00:00
bors[bot]
1244b30094
Merge #459
459: Use dprint for formatting Cargo.toml files r=thomaseizinger a=thomaseizinger

Invoking cargo tomlfmt on all files is a PITA and as we can see from
the CI scripts, it is often forgotten to as new crates are added to
the workspace.

Using dprint for toml files fixes this.

Unfortunately, we can't use dprint for Rust code yet because there
hasn't been a release of rustfmt in quite a while but we are already
using features from a newer rustfmt via rustup.

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2021-04-30 01:19:40 +00:00
Daniel Karzel
69f7565746
!fixup Different default directories for CLI and ASB
Using the same default directory as data-/config-dir has caused unwanted side effects when running both applications on the same machine.
Use these directory names:
- ASB: xmr-btc-swap/asb
- CLI: xmr-btc-swap/cli

Since the functionality is now application specific the respective functions were moved into the appropriate module of the application.
2021-04-30 11:03:13 +10:00
Thomas Eizinger
471baf7c49
Introduce monero-wallet crate
This is fairly bare-bones for now and only contains one piece of
functionality: choosing random key offsets.

More functionality for actually signing Monero transactions will
be added later.
2021-04-30 10:28:46 +10:00
Thomas Eizinger
dd6bfd3bf4
Extend RPC client for monerod with binary requests 2021-04-30 10:28:45 +10:00
bors[bot]
f74c59b857
Merge #451
451: Peer id check for transfer proof and encsig messages r=da-kami a=da-kami

Fixes #416 

The second commit will be relevant for changes planned in #411 

@thomaseizinger with #411 we will need access to Bob's database in the eventloop, this might influence design decisions for #401

Co-authored-by: Daniel Karzel <daniel@comit.network>
2021-04-29 09:38:59 +00:00
Daniel Karzel
b0ffeeab1d
Different default directories for CLI and ASB
Using the same default directory as data-/config-dir has caused unwanted side effects when running both applications on the same machine.
Use these directory names:
- ASB: xmr-btc-swap-asb
- CLI: xmr-btc-swap-cli

Since the functionality is now application specific the respective functions were moved into the appropriate module of the application.
2021-04-29 19:02:16 +10:00
Daniel Karzel
08fecb8fe3
Peer check for incoming transfer proofs
Bob validates that incoming transfer proof messages are coming from the peer-id of Alice.
Currently Bob will ignore any transfer proof message that is not coming from the counterparty peer-id associated to the current swap in execution.
Once we add support for trying to save received transfer proofs for swaps that are currently not in execution we can also adapy allowing this for different counterparty peer-ids. This requires access to the database in Bob's event loop.
2021-04-29 18:28:14 +10:00
Daniel Karzel
3c2dfa830a
Peer check for incoming encrypted signatures
Alice validates that incoming encsig messages are coming from the peer-id that is associated with the swap.
Encsig message from a peer-id different to the one associated with the swap are ignored.
2021-04-29 18:24:45 +10:00
Thomas Eizinger
1820139786
Use dprint for formatting Cargo.toml files
Invoking cargo tomlfmt on all files is a PITA and as we can see from
the CI scripts, it is often forgotten to as new crates are added to
the workspace.

Using dprint for toml files fixes this.

Unfortunately, we can't use dprint for Rust code yet because there
hasn't been a release of rustfmt in quite a while but we are already
using features from a newer rustfmt via rustup.
2021-04-29 17:35:02 +10:00
bors[bot]
c0501627c9
Merge #438
438: Add support for swapping through Tor. r=bonomat a=bonomat

Resolves: #447 

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.


Note: It is expected that the new test will fail on CI because we do not have Tor running. That's why it wasn't added yet. I'll play around in my own fork to not use precious CI resources :) 
The rest is ready for review. 


// edit:

Swapping through Tor on one machine seems to be working: 

Asb: 
```
cargo run --bin asb -- --config "/Users/bonomat/Library/Application Support/xmr-btc-swap/asb/config.toml" start
    Finished dev [unoptimized + debuginfo] target(s) in 0.30s
     Running `target/debug/asb --config '/Users/bonomat/Library/Application Support/xmr-btc-swap/asb/config.toml' start`
Apr 22 11:14:05.090  INFO Initialized tracing with level: debug
Apr 22 11:14:05.092  INFO Using config file at default path: /Users/bonomat/Library/Application Support/xmr-btc-swap/asb/config.toml
Apr 22 11:14:05.094  INFO Database and Seed will be stored in directory: /Users/bonomat/Library/Application Support/xmr-btc-swap/asb
Apr 22 11:14:05.094 DEBUG Opening database at /Users/bonomat/Library/Application Support/xmr-btc-swap/asb/database
Apr 22 11:14:05.226 DEBUG Reading in seed from /Users/bonomat/Library/Application Support/xmr-btc-swap/asb/seed.pem
Apr 22 11:14:06.903  INFO Tor found. Setting up hidden service. 
Apr 22 11:14:08.805  INFO /onion3/jugnrrdp7imu5tqphvlrctudguq3sapmjideu6d63i5y7qqtzzwvf4id:9939
Apr 22 11:14:08.805  INFO /onion3/jugnrrdp7imu5tqphvlrctudguq3sapmjideu6d63i5y7qqtzzwvf4id:9940
Apr 22 11:14:13.431 DEBUG Opened Monero wallet asb-wallet
Apr 22 11:14:13.433  INFO Bitcoin balance: 0.00000000 BTC
Apr 22 11:14:13.433  WARN The Monero balance is 0, make sure to deposit funds at: 5A3iBfDbhGfUUL5WKFcdY5JK7oLcMXYmD9VnUjxmBgFHXswtENMjFsHUDeeCWVvRYaNRCAJDRS7jY85iyNt7s3syVNJtwLd
Apr 22 11:14:13.436 DEBUG Trying to listen on: /ip4/0.0.0.0/tcp/9939
Apr 22 11:14:13.437 DEBUG Trying to listen on: /ip4/0.0.0.0/tcp/9940
Apr 22 11:14:13.437  INFO Our peer id is 12D3KooWNqWpoLUp6YSoUYTinwJFh92wzggeanLgSutmZbZYG9cN
Apr 22 11:14:13.438  INFO Listening on /ip4/127.0.0.1/tcp/9940/ws
Apr 22 11:14:13.438  INFO Listening on /ip4/127.0.0.1/tcp/9939
Apr 22 11:14:13.438  INFO Listening on /ip4/192.168.1.63/tcp/9940/ws
Apr 22 11:14:13.438  INFO Listening on /ip4/192.168.1.63/tcp/9939
Apr 22 11:14:14.275 DEBUG Connected to Kraken websocket API
Apr 22 11:14:14.462 DEBUG Subscribed to updates for ticker
Apr 22 11:23:11.833 DEBUG New connection established peer=12D3KooWHBMKm8Wnq4WD7ehVdSHaf4ccjdzR97UTFtMGT6LBmRev address=/ip4/127.0.0.1/tcp/63655
Apr 22 11:23:25.700  INFO swap{id=c4f51a28-b2fb-4885-9f7a-5d1852de5f0d}: Current state: started
Apr 22 11:23:25.700  INFO swap{id=c4f51a28-b2fb-4885-9f7a-5d1852de5f0d}: Waiting for 1 confirmation of Bitcoin transaction txid=537070d7a6f75e74caa65cebbbf0997b50914fd86b7a752f0d74eb0c5701291f
Apr 22 11:23:33.732 DEBUG Transaction is in mempool txid=537070d7a6f75e74caa65cebbbf0997b50914fd86b7a752f0d74eb0c5701291f
Apr 22 11:42:49.668 DEBUG Transaction is confirmed with 1 blocks txid=537070d7a6f75e74caa65cebbbf0997b50914fd86b7a752f0d74eb0c5701291f
Apr 22 11:42:49.671  INFO swap{id=c4f51a28-b2fb-4885-9f7a-5d1852de5f0d}: Bitcoin tx has 1 out of 1 confirmation txid=537070d7a6f75e74caa65cebbbf0997b50914fd86b7a752f0d74eb0c5701291f
Apr 22 11:42:49.703  INFO swap{id=c4f51a28-b2fb-4885-9f7a-5d1852de5f0d}: Current state: btc is locked
Apr 22 11:43:02.670 DEBUG swap{id=c4f51a28-b2fb-4885-9f7a-5d1852de5f0d}: sent transfer of 0.695214974374 XMR to 05d77c136ad84eff1184a14971f8ec7f5884bb25b646a6c1eb95e0c26782f0a5 in c00f4543d9c9831fa892a2180b4dabbc33eff1fcd6f58ac24495dcf1450bbab3
Apr 22 11:43:02.740  INFO swap{id=c4f51a28-b2fb-4885-9f7a-5d1852de5f0d}: Current state: xmr lock transaction sent

...
```

Swap:
```
 cargo run --bin swap buy-xmr --seller-peer-id 12D3KooWNqWpoLUp6YSoUYTinwJFh92wzggeanLgSutmZbZYG9cN --seller-addr /onion3/jugnrrdp7imu5tqphvlrctudguq3sapmjideu6d63i5y7qqtzzwvf4id:9939 --receive-address 5A3iBfDbhGfUUL5WKFcdY5JK7oLcMXYmD9VnUjxmBgFHXswtENMjFsHUDeeCWVvRYaNRCAJDRS7jY85iyNt7s3syVNJtwLd 
    Finished dev [unoptimized + debuginfo] target(s) in 0.37s
     Running `target/debug/swap buy-xmr --seller-peer-id 12D3KooWNqWpoLUp6YSoUYTinwJFh92wzggeanLgSutmZbZYG9cN --seller-addr '/onion3/jugnrrdp7imu5tqphvlrctudguq3sapmjideu6d63i5y7qqtzzwvf4id:9939' --receive-address 5A3iBfDbhGfUUL5WKFcdY5JK7oLcMXYmD9VnUjxmBgFHXswtENMjFsHUDeeCWVvRYaNRCAJDRS7jY85iyNt7s3syVNJtwLd`
 Connecting to Tor proxy ...
 Connection established
 Connected to Alice at /onion3/jugnrrdp7imu5tqphvlrctudguq3sapmjideu6d63i5y7qqtzzwvf4id:9939/p2p/12D3KooWNqWpoLUp6YSoUYTinwJFh92wzggeanLgSutmZbZYG9cN
 Received quote: 1 XMR ~ 0.00719202 BTC
 Found 0.01559763 BTC in wallet
 Swapping 0.00500000 BTC with 0.00000610 BTC fees
 Spot price for 0.00500000 BTC is 0.695214974374 XMR
 Published Bitcoin lock transaction txid=537070d7a6f75e74caa65cebbbf0997b50914fd86b7a752f0d74eb0c5701291f
 Waiting for Alice to lock Monero
 Alice locked Monero txid=c00f4543d9c9831fa892a2180b4dabbc33eff1fcd6f58ac24495dcf1450bbab3
 Waiting for 10 confirmations of Monero transaction txid=c00f4543d9c9831fa892a2180b4dabbc33eff1fcd6f58ac24495dcf1450bbab3
 Monero lock tx has 1 out of 10 confirmations txid=c00f4543d9c9831fa892a2180b4dabbc33eff1fcd6f58ac24495dcf1450bbab3
 Monero lock tx has 2 out of 10 confirmations txid=c00f4543d9c9831fa892a2180b4dabbc33eff1fcd6f58ac24495dcf1450bbab3
 Monero lock tx has 3 out of 10 confirmations txid=c00f4543d9c9831fa892a2180b4dabbc33eff1fcd6f58ac24495dcf1450bbab3
...

```

Co-authored-by: Philipp Hoenisch <philipp@hoenisch.at>
Co-authored-by: Philipp Hoenisch <philipp@coblox.tech>
2021-04-29 05:09:23 +00:00
Philipp Hoenisch
00b40c4a8f
Merge branch 'tor-integration' of github.com:comit-network/xmr-btc-swap into tor-integration 2021-04-28 16:22:27 +10:00
Philipp Hoenisch
ea6e2f8f09
Simplify to_address_string by implying more context on the structure. 2021-04-28 16:21:31 +10:00
Philipp Hoenisch
99db8c9108
Apply suggestions from code review
Co-authored-by: Daniel Karzel <daniel.karzel@coblox.tech>
2021-04-28 16:04:25 +10:00
bors[bot]
7174303496
Merge #453
453: Fix messages for awaiting containers ready r=da-kami a=da-kami

The message `JOINING all threads` is unfortunately not deterministic, it can happen that it just is not printed in the logs.
For Monerod container the message is set to `RPC server started ok`. This message appears in both a test run that was hanging with `JOINING all threads` and a successful run. Initially the message was set to `core RPC server started ok` with `core` being a variable value. We assume that `core` does not change, but did not to further code analysis what values it can be.

For Monero Wallet RPC container the message is set to `Run server thread name: RPC` which is what it was set to initially. After several container runs this message seems to be reasonable - there are no recorded issues of the Wallet RPC container hanging, but we had problems with Monerod in the past.

Co-authored-by: Daniel Karzel <daniel@comit.network>
2021-04-28 05:37:34 +00:00
Daniel Karzel
04611ee9e1
Fix messages for awaiting containers ready
The message `JOINING all threads` is unfortunately not deterministic, it can happen that it just is not printed in the logs.
For Monerod container the message is set to `RPC server started ok`. This message appears in both a test run that was hanging with `JOINING all threads` and a successful run. Initially the message was set to `core RPC server started ok` with `core` being a variable value. We assume that `core` does not change, but did not to further code analysis what values it can be.

For Monero Wallet RPC container the message is set to `Run server thread name: RPC` which is what it was set to initially. After several container runs this message seems to be reasonable - there are no recorded issues of the Wallet RPC container hanging, but we had problems with Monerod in the past.
2021-04-28 11:44:55 +10:00
Philipp Hoenisch
c8e6db24f8
Derive Tor secret key from seed. 2021-04-27 16:39:32 +10:00
Philipp Hoenisch
3a5395d7a5
Optimize torut features.
OnionV2 addresses are being deprecated and will be fully phased out on 15.10.2021: https://blog.torproject.org/v2-deprecation-timeline
2021-04-27 16:39:32 +10:00
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.
2021-04-27 14:51:41 +10:00
bors[bot]
e262345b4f
Merge #442
442: Minor cleanups towards implementing a Monero wallet for local signing r=thomaseizinger a=thomaseizinger

Extracted out of #434.

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2021-04-27 02:16:27 +00:00
bors[bot]
a84bf11991
Merge #450
450: Bump async-compression from 0.3.7 to 0.3.8 r=thomaseizinger a=dependabot[bot]

Bumps [async-compression](https://github.com/Nemo157/async-compression) from 0.3.7 to 0.3.8.
<details>
<summary>Commits</summary>
<ul>
<li><a href="acae25bdf9"><code>acae25b</code></a> Merge <a href="https://github-redirect.dependabot.com/Nemo157/async-compression/issues/119">#119</a></li>
<li><a href="19fd03f8bb"><code>19fd03f</code></a> Update all locked dependencies</li>
<li><a href="f145824fe7"><code>f145824</code></a> Upgrade ntest</li>
<li><a href="1808080c46"><code>1808080</code></a> Merge <a href="https://github-redirect.dependabot.com/Nemo157/async-compression/issues/118">#118</a></li>
<li><a href="2538217702"><code>2538217</code></a> Bump version to 0.3.8</li>
<li><a href="a23d7a6076"><code>a23d7a6</code></a> Merge <a href="https://github-redirect.dependabot.com/Nemo157/async-compression/issues/115">#115</a></li>
<li><a href="b064a5744d"><code>b064a57</code></a> Merge <a href="https://github-redirect.dependabot.com/Nemo157/async-compression/issues/117">#117</a></li>
<li><a href="c7fe7f9512"><code>c7fe7f9</code></a> update zstd dependency to 1.4.9</li>
<li><a href="429c5b4185"><code>429c5b4</code></a> Use ReaderStream to convert from IO to Stream&lt;Bytes&gt;</li>
<li><a href="f0d69901c6"><code>f0d6990</code></a> Test that replacements do result in the same thing</li>
<li>Additional commits viewable in <a href="https://github.com/Nemo157/async-compression/compare/0.3.7...0.3.8">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=async-compression&package-manager=cargo&previous-version=0.3.7&new-version=0.3.8)](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>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-27 01:47:20 +00:00
bors[bot]
80bd860f55
Merge #449
449: Bump rust_decimal from 1.11.1 to 1.12.2 r=thomaseizinger a=dependabot[bot]

Bumps [rust_decimal](https://github.com/paupino/rust-decimal) from 1.11.1 to 1.12.2.
<details>
<summary>Commits</summary>
<ul>
<li><a href="5f7f94fb3e"><code>5f7f94f</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/paupino/rust-decimal/issues/357">#357</a> from paupino/version/1.12.2</li>
<li><a href="6779bec5b7"><code>6779bec</code></a> Added zero inverse property tests</li>
<li><a href="41c0bc30f7"><code>41c0bc3</code></a> Version 1.12.2</li>
<li><a href="ca01086b4c"><code>ca01086</code></a> Merge branch 'master' of github.com:paupino/rust-decimal into doc/readme</li>
<li><a href="55de2037cf"><code>55de203</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/paupino/rust-decimal/issues/356">#356</a> from KonishchevDmitry/master</li>
<li><a href="1b6a708f55"><code>1b6a708</code></a> Fix <code>0 - 0 = -0</code> -&gt; <code>0 - 0 = 0</code></li>
<li><a href="4c387bf589"><code>4c387bf</code></a> Fixes minor omission from docs</li>
<li><a href="000fab7856"><code>000fab7</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/paupino/rust-decimal/issues/352">#352</a> from paupino/version/1.12.1</li>
<li><a href="9209ad6c3b"><code>9209ad6</code></a> Version 1.12.1</li>
<li><a href="d51e8096f1"><code>d51e809</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/paupino/rust-decimal/issues/351">#351</a> from paupino/version/1.12</li>
<li>Additional commits viewable in <a href="https://github.com/paupino/rust-decimal/compare/1.11.1...1.12.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.11.1&new-version=1.12.2)](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>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-27 01:23:48 +00:00
dependabot[bot]
b7abf2addb
Bump async-compression from 0.3.7 to 0.3.8
Bumps [async-compression](https://github.com/Nemo157/async-compression) from 0.3.7 to 0.3.8.
- [Release notes](https://github.com/Nemo157/async-compression/releases)
- [Commits](https://github.com/Nemo157/async-compression/compare/0.3.7...0.3.8)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-26 09:30:49 +00:00