To run the ASB on testnet, one actively has to provide the `--testnet` flag.
Mainnet and testnet data and config are separated into sub-folders, i.e. `{data/config-dir}/asb/testnet` and `{data-dir}/asb/mainnet`.
The initial setup is also per network. If (default) config for the network cannot be found the initial setup is triggered.
Startup includes network check to ensure the bitcoin/monero network in config file is the same as the one in the `env::Config`.
Note: Wallet initialization is done with the network set in the `env::Config`, the network saved in the config file is just to indicate what network the config file is for.
This includes testing CLI commandline args
Clap's `default_value_with` actually did not work on `Subcommand`s because the parent's flags were not picked up.
This was fixed by changing parameters dependent on testnet/mainnet to options.
This problem should have been detected by tests, that's why the command line parameter tests were finally (re-)added.
Thanks to @rishflab for some pre-work for this.
486: Update metadata and remove outdated config files / READMEs r=thomaseizinger a=thomaseizinger
508: Remove tokio-tar from workspace in favor of git dependency r=thomaseizinger a=thomaseizinger
Fixes#315.
Fixes#227.
The upstream PR that upgrades to tokio v1 got merged, hence we can at least point to the git dependency for now and remove that later once it has been released to crates.io
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
500: Bump sha2 from 0.9.4 to 0.9.5 r=thomaseizinger a=dependabot[bot]
Bumps [sha2](https://github.com/RustCrypto/hashes) from 0.9.4 to 0.9.5.
<details>
<summary>Commits</summary>
<ul>
<li><a href="06586d8ee8"><code>06586d8</code></a> sha-1 v0.9.6 (<a href="https://github-redirect.dependabot.com/RustCrypto/hashes/issues/271">#271</a>)</li>
<li><a href="ca27667a75"><code>ca27667</code></a> sha1+sha2: use cpufeatures v0.1.1 crate release (<a href="https://github-redirect.dependabot.com/RustCrypto/hashes/issues/269">#269</a>)</li>
<li><a href="12493fc7af"><code>12493fc</code></a> sha1: use <code>cpufeatures</code> to detect SHA-1 on <code>aarch64</code> (<a href="https://github-redirect.dependabot.com/RustCrypto/hashes/issues/268">#268</a>)</li>
<li><a href="d13936a82a"><code>d13936a</code></a> sha2: use <code>cpufeatures</code> to detect <code>sha2</code> on <code>aarch64</code> (<a href="https://github-redirect.dependabot.com/RustCrypto/hashes/issues/267">#267</a>)</li>
<li><a href="15a0468e98"><code>15a0468</code></a> sha2: fix missing documentation on compression functions (<a href="https://github-redirect.dependabot.com/RustCrypto/hashes/issues/266">#266</a>)</li>
<li>See full diff in <a href="https://github.com/RustCrypto/hashes/compare/sha2-v0.9.4...sha2-v0.9.5">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=sha2&package-manager=cargo&previous-version=0.9.4&new-version=0.9.5)](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>
505: Bump serde from 1.0.125 to 1.0.126 r=thomaseizinger a=dependabot[bot]
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.125 to 1.0.126.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/serde-rs/serde/releases">serde's releases</a>.</em></p>
<blockquote>
<h2>v1.0.126</h2>
<ul>
<li>Resolve conflict with <code>forbid(future_incompatible)</code> lint setting in generated code (<a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2026">#2026</a>, thanks <a href="https://github.com/hyd-dev"><code>@hyd-dev</code></a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="d9c338ec4a"><code>d9c338e</code></a> Release 1.0.126</li>
<li><a href="699bf3a75d"><code>699bf3a</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2026">#2026</a> from hyd-dev/warning</li>
<li><a href="dd29825217"><code>dd29825</code></a> Allow only <code>unused_extern_crates</code> instead of the whole <code>rust_2018_idioms</code> lin...</li>
<li><a href="6366f17da7"><code>6366f17</code></a> Ignore clone_instead_of_copied pedantic clippy lint</li>
<li><a href="1120e5af4a"><code>1120e5a</code></a> Remove suppression of removed clippy lint</li>
<li><a href="1093f7e232"><code>1093f7e</code></a> Resolve flat_map_option pedantic clippy lint</li>
<li><a href="2ea132b8c4"><code>2ea132b</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2018">#2018</a> from dtolnay/nonascii</li>
<li><a href="2ebc771b88"><code>2ebc771</code></a> Remove non_ascii_idents feature gate from test suite</li>
<li><a href="c17c4eef18"><code>c17c4ee</code></a> Unify stable and beta CI workflow</li>
<li><a href="7aa4950504"><code>7aa4950</code></a> Release serde_derive_internals 0.26.0</li>
<li>Additional commits viewable in <a href="https://github.com/serde-rs/serde/compare/v1.0.125...v1.0.126">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=serde&package-manager=cargo&previous-version=1.0.125&new-version=1.0.126)](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>
494: Bump actions/upload-release-asset from 1 to 1.0.2 r=thomaseizinger a=dependabot[bot]
Bumps [actions/upload-release-asset](https://github.com/actions/upload-release-asset) from 1 to 1.0.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/actions/upload-release-asset/releases">actions/upload-release-asset's releases</a>.</em></p>
<blockquote>
<h2>Automate sliding major version number</h2>
<p>This is a minor update to make the current release have the latest code from master, and additionally allows for a new automation workflow to execute to automate the sliding of the major (v1, v2, v3, etc) version numbers for ease of referencing</p>
<h2>Fix upload asset logic</h2>
<p>This release patches a bug in the <code>upload-asset</code> logic that was preventing the asset from actually being uploaded properly.</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a href="https://github.com/actions/upload-release-asset/compare/v1...v1.0.2">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/upload-release-asset&package-manager=github_actions&previous-version=1&new-version=1.0.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>
In order to allow people to plug into public nodes / be more flexible with their own setup we now enforce specifying the monero daemon port to be used by the `monero-wallet-rpc`.
In the past we had problems with flags/parameter changes several times, where on instance was changed, buy another one was missed. This should mitigate this problem.
This patch introduces structs for all duplicated parameters and uses flatten to only have one point for changes.
Additionally removes all mentions of `alice` from the commands / variables. This code is on an application level and should not be concerned with swap protocol roles.
493: Add checks to max_giveable amount. r=da-kami a=bonomat
We need to check two things:
- balance to be higher than dust amount (546).
- balance to be higher than min-relay fee.
Additionally, the tx_builder might fail if not enough funds are in the wallet to pay for the overall transaction fees. In both cases, we return 0.
fixes#487
Co-authored-by: Philipp Hoenisch <philipp@hoenisch.at>
We need to check two things:
- balance to be higher than dust amount (546).
- balance to be higher than min-relay fee.
Additionally, the tx_builder might fail if not enough funds are in the wallet to pay for the overall transaction fees.
476: Bump dprint/check from v1.3 to v1.4 r=thomaseizinger a=dependabot[bot]
Bumps [dprint/check](https://github.com/dprint/check) from v1.3 to v1.4.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/dprint/check/releases">dprint/check's releases</a>.</em></p>
<blockquote>
<h2>v1.4</h2>
<p>Upgrade to dprint 0.13.1</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="a3ed4347fe"><code>a3ed434</code></a> fix: Update to dprint 0.13.1</li>
<li>See full diff in <a href="https://github.com/dprint/check/compare/v1.3...a3ed4347fef5b3b2bf68cc38b44885d9df913253">compare view</a></li>
</ul>
</details>
<br />
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>
477: Bump sha2 from 0.9.3 to 0.9.4 r=thomaseizinger a=dependabot[bot]
Bumps [sha2](https://github.com/RustCrypto/hashes) from 0.9.3 to 0.9.4.
<details>
<summary>Commits</summary>
<ul>
<li><a href="c1ed4b1cbc"><code>c1ed4b1</code></a> sha2 v0.9.4 (<a href="https://github-redirect.dependabot.com/RustCrypto/hashes/issues/265">#265</a>)</li>
<li><a href="1bf768865d"><code>1bf7688</code></a> sha-1 v0.9.5 (<a href="https://github-redirect.dependabot.com/RustCrypto/hashes/issues/264">#264</a>)</li>
<li><a href="bf761edb53"><code>bf761ed</code></a> sha1+sha2: switch from <code>cpuid-bool</code> to <code>cpufeatures</code> (<a href="https://github-redirect.dependabot.com/RustCrypto/hashes/issues/263">#263</a>)</li>
<li><a href="1e775edda2"><code>1e775ed</code></a> sha2: bump <code>sha2-asm</code> to v0.6.1 release (<a href="https://github-redirect.dependabot.com/RustCrypto/hashes/issues/262">#262</a>)</li>
<li><a href="e8b3abe442"><code>e8b3abe</code></a> feat(sha2): use latest sha2-asm and enable M1 (<a href="https://github-redirect.dependabot.com/RustCrypto/hashes/issues/261">#261</a>)</li>
<li><a href="ee361ed25f"><code>ee361ed</code></a> build(deps): bump libc from 0.2.88 to 0.2.93 (<a href="https://github-redirect.dependabot.com/RustCrypto/hashes/issues/254">#254</a>)</li>
<li><a href="0bf77b52b1"><code>0bf77b5</code></a> build(deps): bump byteorder from 1.4.2 to 1.4.3 (<a href="https://github-redirect.dependabot.com/RustCrypto/hashes/issues/245">#245</a>)</li>
<li><a href="dd9086ad8c"><code>dd9086a</code></a> sha1: add multiplatform tests (<a href="https://github-redirect.dependabot.com/RustCrypto/hashes/issues/252">#252</a>)</li>
<li><a href="1c1182c8b8"><code>1c1182c</code></a> rustfmt (<a href="https://github-redirect.dependabot.com/RustCrypto/hashes/issues/253">#253</a>)</li>
<li><a href="ad19dffcbe"><code>ad19dff</code></a> build(deps): bump libc from 0.2.86 to 0.2.88 (<a href="https://github-redirect.dependabot.com/RustCrypto/hashes/issues/244">#244</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/RustCrypto/hashes/compare/sha2-v0.9.3...sha2-v0.9.4">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=sha2&package-manager=cargo&previous-version=0.9.3&new-version=0.9.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>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
483: Bump url from 2.2.1 to 2.2.2 r=thomaseizinger a=dependabot[bot]
Bumps [url](https://github.com/servo/rust-url) from 2.2.1 to 2.2.2.
<details>
<summary>Commits</summary>
<ul>
<li><a href="6c22912c31"><code>6c22912</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/servo/rust-url/issues/709">#709</a> from BramBonne/bump-version</li>
<li><a href="0707a58b91"><code>0707a58</code></a> Bump minor version number</li>
<li><a href="991e438ff1"><code>991e438</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/servo/rust-url/issues/708">#708</a> from BramBonne/test-syntax-violations</li>
<li><a href="744b76332c"><code>744b763</code></a> Remove stray comma</li>
<li><a href="5793b7ef14"><code>5793b7e</code></a> Check parsing result in SyntaxViolation test</li>
<li><a href="0659871a26"><code>0659871</code></a> Add tests for SyntaxViolation callback types</li>
<li><a href="c6f60fe5ff"><code>c6f60fe</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/servo/rust-url/issues/668">#668</a> from sdroege/make-relative</li>
<li><a href="d51cec4803"><code>d51cec4</code></a> Add Url::make_relative() as the inverse of Url::join()</li>
<li><a href="77fb472619"><code>77fb472</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/servo/rust-url/issues/703">#703</a> from BramBonne/slicing-tests</li>
<li><a href="ea2342e182"><code>ea2342e</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/servo/rust-url/issues/705">#705</a> from BramBonne/test-quirks</li>
<li>Additional commits viewable in <a href="https://github.com/servo/rust-url/compare/v2.2.1...v2.2.2">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=url&package-manager=cargo&previous-version=2.2.1&new-version=2.2.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>
474: Add more log details r=bonomat a=bonomat
Resolves#448
1. The first commit adds an additional log statement of the exchange rate for each state-update. This is useful because it allows us to measure profitability easily, i.e. by knowing what was the exchange rate when the swap was started and what was it when it was finalized.
2. The second commit changes a bunch of log messages.
3. The third commit is adds a new commandline flag to toggle json format.
Co-authored-by: Philipp Hoenisch <philipp@hoenisch.at>
Co-authored-by: Philipp Hoenisch <philipp@coblox.tech>
485: Update assert_weight test to account for a range up to 8 bytes. r=bonomat a=bonomat
Fixes#482
Weights fluctuate because of the length of the signatures. Valid ecdsa signatures can have 68, 69, 70, 71, or 72 bytes. Since most of our transactions have 2 signatures the weight can be up to 8 bytes less than the static weight (4 bytes per signature).
Since it is really hard to get these short signatures (<1 in 100), I also include the transaction in the assert message which will help for debugging purposes.
Source: https://medium.com/coinmonks/on-bitcoin-transaction-sizes-97e31bc9d816
Co-authored-by: Philipp Hoenisch <philipp@hoenisch.at>
Introduces a minimum buy Bitcoin amount similar to the maximum amount already present.
For the CLI the minimum amount is enforced by waiting until at least the minimum is available as max-giveable amount.
Max-buy and spread is not something that one would configure on every run.
More convenient to keep this in the config.
The max-buy Bitcoin value was adapted to `0.02` which is more reasonable for mainnet.
Activated feature `serde-float` to serialize the spread (Decimal) as float instead of string.
```
...
[maker]
max_buy_btc = 0.02
ask_spread = 0.02
```
Weights fluctuate because of the length of the signatures. Valid ecdsa signatures can have 68, 69, 70, 71, or 72 bytes. Since most of our transactions have 2 signatures the weight can be up to 8 bytes less than the static weight (4 bytes per signature).