Commit Graph

738 Commits (e13044820059b948bef2c80d3cebb1ceb2142b7b)

Author SHA1 Message Date
Thomas Eizinger b1affe3ecf
Insert latest state and call run_until only once
Instead of calling this function in all the branches, we can simply
make the whole match statement evaluate to the new state and perform
this functionality at the very end.
4 years ago
Thomas Eizinger 0d8962762a
Use early return to reduce one level of indentation 4 years ago
Thomas Eizinger 05849505b1
Inline `wait_for_bitcoin_refund`
This function is essentially a single select! statement and can
easily be inlined into the swap state machine.
4 years ago
Thomas Eizinger 8c9285f1f9
Inline step function because it has been reduced to a single statement 4 years ago
Thomas Eizinger afb7e816a1
Don't wait for confirmations again
We only call this function within `CancelTimelockExpired`. There is
no need to check the confirmations again.
4 years ago
Thomas Eizinger c92f2dbc77
Move more domain knowledge onto the `TxCancel` type 4 years ago
Thomas Eizinger 75aec95b0c
Introduce monero::TransferRequest
This allows us to move critical crypto logic onto `State3` which
holds all the necessary data which consequently allows us to get
rid of `lock_xmr` altogether by inlining it into the swap function.
The reduced indirection improves readability.
4 years ago
Thomas Eizinger d682433ec9
Move `EventLoopHandle` next to its impl block
This struct is not that important so it can move further down.
4 years ago
Thomas Eizinger e77f1729b4
Move `extract_monero_private_key` onto TxRefund
This functionality is domain-specific to the refund transaction.
Move it onto there.
4 years ago
Thomas Eizinger a1e065b4e7
Simplify racing cancel timelock against learning enc-sig 4 years ago
Thomas Eizinger 575893fb51
Use domain types in fn signature instead of messages
This simplifies usage witin the swap module.
4 years ago
Thomas Eizinger 64b71d0b16
Remove unnecessary pinning 4 years ago
Daniel Karzel 105e291e67 Update the application name for `--version` print
swap --version
xmr-btc-swap 0.3.0

asb --version
xmr-btc-asb 0.3.0
4 years ago
Daniel Karzel 07542d75ac prepare 0.3 release 4 years ago
bors[bot] d487aa3c5b
Merge #327 #330 #331
327: Bump actions/setup-python from v1 to v2.2.1 r=thomaseizinger a=dependabot[bot]

Bumps [actions/setup-python](https://github.com/actions/setup-python) from v1 to v2.2.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/actions/setup-python/releases">actions/setup-python's releases</a>.</em></p>
<blockquote>
<h2>v2.2.1</h2>
<ul>
<li>Fix PyPy3 issues with Windows</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="3105fb18c0"><code>3105fb1</code></a> fix is_windows (<a href="https://github.com/actions/setup-python/issues/172">#172</a>)</li>
<li><a href="8c5ea631b2"><code>8c5ea63</code></a> Adding support for more PyPy versions and installing them on-flight (<a href="https://github.com/actions/setup-python/issues/168">#168</a>)</li>
<li><a href="2831efe49a"><code>2831efe</code></a> Improve find-python to add &quot;Scripts&quot; folder to PATH on Windows machines (<a href="https://github.com/actions/setup-python/issues/169">#169</a>)</li>
<li><a href="3b3f2de1b1"><code>3b3f2de</code></a> update pypy3 to point to 3.6 (<a href="https://github.com/actions/setup-python/issues/164">#164</a>)</li>
<li><a href="723e46dad7"><code>723e46d</code></a> CODEOWNERS needs the org name for teams</li>
<li><a href="195f5c388b"><code>195f5c3</code></a> Create CODEOWNERS</li>
<li><a href="41b7212b16"><code>41b7212</code></a> Update README.md (<a href="https://github.com/actions/setup-python/issues/145">#145</a>)</li>
<li><a href="878156f1de"><code>878156f</code></a> Inject LD_LIBRARY_PATH library path into Python manifest install and setup (#...</li>
<li><a href="c181ffa198"><code>c181ffa</code></a> Add Environment Files (<a href="https://github.com/actions/setup-python/issues/138">#138</a>)</li>
<li><a href="1ce870e10f"><code>1ce870e</code></a> Fix links in documentation (<a href="https://github.com/actions/setup-python/issues/135">#135</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/actions/setup-python/compare/v1...3105fb18c05ddd93efea5f9e0bef7a03a6e9e7df">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>

330: Bump dialoguer from 0.7.1 to 0.8.0 r=thomaseizinger a=dependabot[bot]

Bumps [dialoguer](https://github.com/mitsuhiko/dialoguer) from 0.7.1 to 0.8.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/mitsuhiko/dialoguer/blob/master/CHANGELOG.md">dialoguer's changelog</a>.</em></p>
<blockquote>
<h2>0.8.0</h2>
<h3>Enhancements</h3>
<ul>
<li><code>Input::validate_with</code> can take a <code>FnMut</code> (allowing multiple references)</li>
</ul>
<h3>Breaking</h3>
<ul>
<li><code>Input::interact*</code> methods take <code>&amp;mut self</code> instead of <code>&amp;self</code></li>
</ul>
<h2>0.7.0</h2>
<h3>Enhancements</h3>
<ul>
<li>Added <code>wait_for_newline</code> to <code>Confirm</code></li>
<li>More secure password prompt</li>
<li>More documentation</li>
<li>Added <code>interact_text</code> method for input prompt</li>
<li>Added <code>inline_selections</code> to <code>ColorfulTheme</code></li>
</ul>
<h3>Breaking</h3>
<ul>
<li>Removed <code>theme::CustomPromptCharacterTheme</code></li>
<li><code>Input</code> validators now take the input type <code>T</code> as arg</li>
<li><code>Confirm</code> has no <code>default</code> value by default now</li>
</ul>
<h2>0.6.2</h2>
<h3>Enhancements</h3>
<ul>
<li>Updating some docs</li>
</ul>
<h2>0.6.1</h2>
<h3>Bugfixes</h3>
<ul>
<li><code>theme::ColorfulTheme</code> default styles are for stderr</li>
</ul>
<h2>0.6.0</h2>
<h3>Breaking</h3>
<ul>
<li>Removed <code>theme::SelectionStyle</code> enum</li>
<li>Allowed more customization for <code>theme::Theme</code> trait by changing methods</li>
<li>Allowed more customization for <code>theme::ColorfulTheme</code> by changing members</li>
<li>Renamed prompt <code>Confirmation</code> to <code>Confirm</code></li>
<li>Renamed prompt <code>PasswordInput</code> to <code>Password</code></li>
<li>Renamed prompt <code>OrderList</code> to <code>Sort</code></li>
<li>Renamed prompt <code>Checkboxes</code> to <code>MultiSelect</code></li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="2c3fe6b646"><code>2c3fe6b</code></a> Release 0.8.0</li>
<li><a href="64f5f9c6f5"><code>64f5f9c</code></a> Allow confirm with no choice (<a href="https://github.com/mitsuhiko/dialoguer/issues/101">#101</a>)</li>
<li><a href="0250090f95"><code>0250090</code></a> Update some docs in confirm prompt</li>
<li><a href="a76fb72c54"><code>a76fb72</code></a> Merge pull request <a href="https://github.com/mitsuhiko/dialoguer/issues/102">#102</a> from spenserblack/typo-fix</li>
<li><a href="3dd93bb75a"><code>3dd93bb</code></a> Fix typo: ereased -&gt; erased</li>
<li><a href="7ea6275caa"><code>7ea6275</code></a> Update CI for i686 ubuntu</li>
<li><a href="af664807da"><code>af66480</code></a> Allow FnMut for validate (<a href="https://github.com/mitsuhiko/dialoguer/issues/96">#96</a>)</li>
<li><a href="2b5722d0f5"><code>2b5722d</code></a> Update README.md</li>
<li><a href="2df3a705eb"><code>2df3a70</code></a> Update ci.yml</li>
<li><a href="8cebf522b3"><code>8cebf52</code></a> Merge pull request <a href="https://github.com/mitsuhiko/dialoguer/issues/94">#94</a> from mitsuhiko/remove-travis</li>
<li>Additional commits viewable in <a href="https://github.com/mitsuhiko/dialoguer/compare/0.7.1...0.8.0">compare view</a></li>
</ul>
</details>
<br />


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

331: Bump tokio from 1.0.2 to 1.3.0 r=thomaseizinger a=dependabot[bot]

Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.0.2 to 1.3.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.3.0</h2>
<h3>Added</h3>
<ul>
<li>coop: expose an <code>unconstrained()</code> opt-out (<a href="https://github.com/tokio-rs/tokio/issues/3547">#3547</a>)</li>
<li>net: add <code>into_std</code> for net types without it (<a href="https://github.com/tokio-rs/tokio/issues/3509">#3509</a>)</li>
<li>sync: add <code>same_channel</code> method to <code>mpsc::Sender</code> (<a href="https://github.com/tokio-rs/tokio/issues/3532">#3532</a>)</li>
<li>sync: add <code>{try_,}acquire_many_owned</code> to <code>Semaphore</code> (<a href="https://github.com/tokio-rs/tokio/issues/3535">#3535</a>)</li>
<li>sync: add back <code>RwLockWriteGuard::map</code> and <code>RwLockWriteGuard::try_map</code> (<a href="https://github.com/tokio-rs/tokio/issues/3348">#3348</a>)</li>
</ul>
<h3>Fixed</h3>
<ul>
<li>sync: allow <code>oneshot::Receiver::close</code> after successful <code>try_recv</code> (<a href="https://github.com/tokio-rs/tokio/issues/3552">#3552</a>)</li>
<li>time: do not panic on <code>timeout(Duration::MAX)</code> (<a href="https://github.com/tokio-rs/tokio/issues/3551">#3551</a>)</li>
</ul>
<h3>Documented</h3>
<ul>
<li>doc: doc aliases for pre-1.0 function names (<a href="https://github.com/tokio-rs/tokio/issues/3523">#3523</a>)</li>
<li>io: fix typos (<a href="https://github.com/tokio-rs/tokio/issues/3541">#3541</a>)</li>
<li>io: note the EOF behaviour of <code>read_until</code> (<a href="https://github.com/tokio-rs/tokio/issues/3536">#3536</a>)</li>
<li>io: update <code>AsyncRead::poll_read</code> doc (<a href="https://github.com/tokio-rs/tokio/issues/3557">#3557</a>)</li>
<li>net: update <code>UdpSocket</code> splitting doc (<a href="https://github.com/tokio-rs/tokio/issues/3517">#3517</a>)</li>
<li>runtime: add link to <code>LocalSet</code> on <code>new_current_thread</code> (<a href="https://github.com/tokio-rs/tokio/issues/3508">#3508</a>)</li>
<li>runtime: update documentation of thread limits (<a href="https://github.com/tokio-rs/tokio/issues/3527">#3527</a>)</li>
<li>sync: do not recommend <code>join_all</code> for <code>Barrier</code> (<a href="https://github.com/tokio-rs/tokio/issues/3514">#3514</a>)</li>
<li>sync: documentation for <code>oneshot</code> (<a href="https://github.com/tokio-rs/tokio/issues/3592">#3592</a>)</li>
<li>sync: rename <code>notify</code> to <code>notify_one</code> (<a href="https://github.com/tokio-rs/tokio/issues/3526">#3526</a>)</li>
<li>time: fix typo in <code>Sleep</code> doc (<a href="https://github.com/tokio-rs/tokio/issues/3515">#3515</a>)</li>
<li>time: sync <code>interval.rs</code> and <code>time/mod.rs</code> docs (<a href="https://github.com/tokio-rs/tokio/issues/3533">#3533</a>)</li>
</ul>
<h2>Tokio v1.2.0</h2>
<h3>Added</h3>
<ul>
<li>signal: make <code>Signal::poll_recv</code> method public (<a href="https://github.com/tokio-rs/tokio/issues/3383">#3383</a>)</li>
</ul>
<h3>Fixed</h3>
<ul>
<li>time: make <code>test-util</code> paused time fully deterministic (<a href="https://github.com/tokio-rs/tokio/issues/3492">#3492</a>)</li>
</ul>
<h3>Documented</h3>
<ul>
<li>sync: link to new broadcast and watch wrappers (<a href="https://github.com/tokio-rs/tokio/issues/3504">#3504</a>)</li>
</ul>
<h2>Tokio v1.1.1</h2>
<p>Forward ports 1.0.3 fix.</p>
<h3>Fixed</h3>
<ul>
<li>io: memory leak during shutdown (<a href="https://github.com/tokio-rs/tokio/issues/3477">#3477</a>).</li>
</ul>
<h2>Tokio v1.1.0</h2>
<h3>Added</h3>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="d0e4dd1d7b"><code>d0e4dd1</code></a> chore: prepare Tokio v1.3.0 (<a href="https://github.com/tokio-rs/tokio/issues/3597">#3597</a>)</li>
<li><a href="872bc09e83"><code>872bc09</code></a> examples: update chat example (<a href="https://github.com/tokio-rs/tokio/issues/3587">#3587</a>)</li>
<li><a href="db1d90453c"><code>db1d904</code></a> util: fuse PollSemaphore (<a href="https://github.com/tokio-rs/tokio/issues/3578">#3578</a>)</li>
<li><a href="05eeea570e"><code>05eeea5</code></a> coop: expose an unconstrained() opt-out (<a href="https://github.com/tokio-rs/tokio/issues/3547">#3547</a>)</li>
<li><a href="f70b9b84f7"><code>f70b9b8</code></a> sync: documenation for oneshot (<a href="https://github.com/tokio-rs/tokio/issues/3592">#3592</a>)</li>
<li><a href="704de8c01b"><code>704de8c</code></a> stream: remove duplicate <code>doc(test(..))</code> &amp; <code>cfg_attr</code> declarations (<a href="https://github.com/tokio-rs/tokio/issues/3571">#3571</a>)</li>
<li><a href="47be928444"><code>47be928</code></a> sync: yield initial value in WatchStream (<a href="https://github.com/tokio-rs/tokio/issues/3576">#3576</a>)</li>
<li><a href="e06b257e09"><code>e06b257</code></a> sync: add same_channel method to mpsc Senders (<a href="https://github.com/tokio-rs/tokio/issues/3532">#3532</a>)</li>
<li><a href="0867a6fc03"><code>0867a6f</code></a> util: add pollable mpsc::Sender (<a href="https://github.com/tokio-rs/tokio/issues/3490">#3490</a>)</li>
<li><a href="0d838bf5ad"><code>0d838bf</code></a> io: fix link to std src in util (<a href="https://github.com/tokio-rs/tokio/issues/3568">#3568</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/tokio-rs/tokio/compare/tokio-1.0.2...tokio-1.3.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.0.2&new-version=1.3.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>
4 years ago
dependabot[bot] 47544764d9
Bump tokio from 1.0.2 to 1.3.0
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.0.2 to 1.3.0.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.0.2...tokio-1.3.0)

Signed-off-by: dependabot[bot] <support@github.com>
4 years ago
bors[bot] 7f6f2408a3
Merge #332
332: Bump base64 from 0.12.3 to 0.13.0 r=thomaseizinger a=dependabot[bot]

Bumps [base64](https://github.com/marshallpierce/rust-base64) from 0.12.3 to 0.13.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/marshallpierce/rust-base64/blob/master/RELEASE-NOTES.md">base64's changelog</a>.</em></p>
<blockquote>
<h1>0.13.0</h1>
<ul>
<li>Config methods are const</li>
<li>Added <code>EncoderStringWriter</code> to allow encoding directly to a String</li>
<li><code>EncoderWriter</code> now owns its delegate writer rather than keeping a reference to it (though refs still work)
<ul>
<li>As a consequence, it is now possible to extract the delegate writer from an <code>EncoderWriter</code> via <code>finish()</code>, which returns <code>Result&lt;W&gt;</code> instead of <code>Result&lt;()&gt;</code>. If you were calling <code>finish()</code> explicitly, you will now need to use <code>let _ = foo.finish()</code> instead of just <code>foo.finish()</code> to avoid a warning about the unused value.</li>
</ul>
</li>
<li>When decoding input that has both an invalid length and an invalid symbol as the last byte, <code>InvalidByte</code> will be emitted instead of <code>InvalidLength</code> to make the problem more obvious.</li>
</ul>
<h1>0.12.2</h1>
<ul>
<li>Add <code>BinHex</code> alphabet</li>
</ul>
<h1>0.12.1</h1>
<ul>
<li>Add <code>Bcrypt</code> alphabet</li>
</ul>
<h1>0.12.0</h1>
<ul>
<li>A <code>Read</code> implementation (<code>DecoderReader</code>) to let users transparently decoded data from a b64 input source</li>
<li>IMAP's modified b64 alphabet</li>
<li>Relaxed type restrictions to just <code>AsRef&lt;[ut8]&gt;</code> for main <code>encode*</code>/<code>decode*</code> functions</li>
<li>A minor performance improvement in encoding</li>
</ul>
<h1>0.11.0</h1>
<ul>
<li>Minimum rust version 1.34.0</li>
<li><code>no_std</code> is now supported via the two new features <code>alloc</code> and <code>std</code>.</li>
</ul>
<h1>0.10.1</h1>
<ul>
<li>Minimum rust version 1.27.2</li>
<li>Fix bug in streaming encoding (<a href="https://github.com/marshallpierce/rust-base64/pull/90">#90</a>): if the underlying writer didn't write all the bytes given to it, the remaining bytes would not be retried later. See the docs on <code>EncoderWriter::write</code>.</li>
<li>Make it configurable whether or not to return an error when decoding detects excess trailing bits.</li>
</ul>
<h1>0.10.0</h1>
<ul>
<li>Remove line wrapping. Line wrapping was never a great conceptual fit in this library, and other features (streaming encoding, etc) either couldn't support it or could support only special cases of it with a great increase in complexity. Line wrapping has been pulled out into a <a href="https://crates.io/crates/line-wrap">line-wrap</a> crate, so it's still available if you need it.
<ul>
<li><code>Base64Display</code> creation no longer uses a <code>Result</code> because it can't fail, which means its helper methods for common
configs that <code>unwrap()</code> for you are no longer needed</li>
</ul>
</li>
<li>Add a streaming encoder <code>Write</code> impl to transparently base64 as you write.</li>
<li>Remove the remaining <code>unsafe</code> code.</li>
<li>Remove whitespace stripping to simplify <code>no_std</code> support. No out of the box configs use it, and it's trivial to do yourself if needed: <code>filter(|b| !b&quot; \n\t\r\x0b\x0c&quot;.contains(b)</code>.</li>
<li>Detect invalid trailing symbols when decoding and return an error rather than silently ignoring them.</li>
</ul>
<h1>0.9.3</h1>
<ul>
<li>Update safemem</li>
</ul>
<h1>0.9.2</h1>
<ul>
<li>Derive <code>Clone</code> for <code>DecodeError</code>.</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="b4fc91325e"><code>b4fc913</code></a> v0.13.0</li>
<li><a href="bba4c5d11e"><code>bba4c5d</code></a> Merge pull request <a href="https://github.com/marshallpierce/rust-base64/issues/145">#145</a> from marshallpierce/mp/cleanup</li>
<li><a href="42967320b3"><code>4296732</code></a> Add docs and other cleanup</li>
<li><a href="6bb3556633"><code>6bb3556</code></a> Merge pull request <a href="https://github.com/marshallpierce/rust-base64/issues/144">#144</a> from untitaker/invalid-bytes-not-length</li>
<li><a href="5b40e0c04e"><code>5b40e0c</code></a> Merge pull request <a href="https://github.com/marshallpierce/rust-base64/issues/142">#142</a> from marshallpierce/mp/string-writer</li>
<li><a href="8b1ae22bab"><code>8b1ae22</code></a> Rename StrWrite to StrConsumer</li>
<li><a href="27ccb6591e"><code>27ccb65</code></a> fix tests</li>
<li><a href="d15cd384e1"><code>d15cd38</code></a> Give better error messages when decoding data with trailing newlines</li>
<li><a href="5a56885c65"><code>5a56885</code></a> Introduce StrWriter to allow ESW to wrap both a String and a &amp;mut String</li>
<li><a href="2dc0296d2a"><code>2dc0296</code></a> Merge pull request <a href="https://github.com/marshallpierce/rust-base64/issues/143">#143</a> from marshallpierce/mp/invalid-length-doc</li>
<li>Additional commits viewable in <a href="https://github.com/marshallpierce/rust-base64/compare/v0.12.3...v0.13.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=base64&package-manager=cargo&previous-version=0.12.3&new-version=0.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>
4 years ago
bors[bot] 2c385ee7d9
Merge #321
321: Properly handle concurrent messages to and from peers r=thomaseizinger a=thomaseizinger

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

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
4 years ago
dependabot[bot] e6fda4a787
Bump base64 from 0.12.3 to 0.13.0
Bumps [base64](https://github.com/marshallpierce/rust-base64) from 0.12.3 to 0.13.0.
- [Release notes](https://github.com/marshallpierce/rust-base64/releases)
- [Changelog](https://github.com/marshallpierce/rust-base64/blob/master/RELEASE-NOTES.md)
- [Commits](https://github.com/marshallpierce/rust-base64/compare/v0.12.3...v0.13.0)

Signed-off-by: dependabot[bot] <support@github.com>
4 years ago
dependabot[bot] 64351a29b5
Bump dialoguer from 0.7.1 to 0.8.0
Bumps [dialoguer](https://github.com/mitsuhiko/dialoguer) from 0.7.1 to 0.8.0.
- [Release notes](https://github.com/mitsuhiko/dialoguer/releases)
- [Changelog](https://github.com/mitsuhiko/dialoguer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mitsuhiko/dialoguer/compare/0.7.1...0.8.0)

Signed-off-by: dependabot[bot] <support@github.com>
4 years ago
bors[bot] 113f2fa385
Merge #322
322: Refactor `ExecutionParams` and harmonize sync intervals of wallets r=thomaseizinger a=thomaseizinger



Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
4 years ago
bors[bot] fc28609a96
Merge #323 #324
323: Minor fixes r=thomaseizinger a=rishflab



324: Enable dependabot r=thomaseizinger a=thomaseizinger



Co-authored-by: rishflab <rishflab@hotmail.com>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
4 years ago
Thomas Eizinger e54d26b26c
Improve log messages by including PeerId 4 years ago
Thomas Eizinger a57f88d1b4
Properly handle concurrent messages to and from peers
Previously, we were forwarding incoming messages from peers to all
swaps that were currently running. That is obviously wrong. The new
design scopes an `EventLoopHandle` to a specific PeerId to avoid
this problem.
4 years ago
Thomas Eizinger ce78075932
Make Monero and Bitcoin wallet use a generalized sync interval
We define the sync interval as 1/10th of the blocktime. For the
special case of our tests, we however check at max once per second.
The tests have a super fast blocktime. As such we shouldn't hammer
the nodes with a request every 100ms.
4 years ago
Thomas Eizinger 09c41f89c4
Rename ExecutionParams to EnvironmentConfig 4 years ago
Thomas Eizinger bc43ed6ebd
Pass execution params directly into wallet for initialization
This reduces the amount of parameters that we need to pass in.
4 years ago
Thomas Eizinger 7213907a79
Group bitcoin and monero fields together 4 years ago
bors[bot] 95acbc6277
Merge #307
307: Reduce load on electrum r=thomaseizinger a=rishflab

.

Co-authored-by: rishflab <rishflab@hotmail.com>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
4 years ago
rishflab 8675d88727 Don't wait for tx lock confirmed after broadcast
Bob does not care whether tx lock is confirmed. That is alice's problem.
This wait was introduced to remedy a bug in status_of_script() which was
 failing when called on a transaction with no confirmations.
4 years ago
rishflab f5e6ba18e0 Use different address for redeem and punish
Having the same address could potentially cause issues when subscribing
to transactions by script
4 years ago
bors[bot] 345bc5b316
Merge #320
320: Fix env filter for asb r=thomaseizinger a=thomaseizinger

1. The asb didn't log any if the statements within main.rs
2. We were initializing unnecessary filters that don't make any sense
for the asb. warp and http are not used and the harness-es are for
test only.

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
4 years ago
bors[bot] 9ed5ca9a04
Merge #317
317: Fix monero refresh interval r=thomaseizinger a=thomaseizinger

The comparison should be the MAXIMUM of the two values, not the
minimum, otherwise we always refresh at an interval of 1 second.

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
4 years ago
Thomas Eizinger 9e3a104b42
Disable timestamp if we log to a non-interactive terminal
A non-interactive terminal is likely something along the lines of
journalctl which captures a timestamp by itself. In theory, it could
also be just a logfile but we rather accept this limitation and keep
the configuration surface simple rather than exposing another config
switch.
4 years ago
Thomas Eizinger edb8851ce2
Fix env filter for asb
1. The asb didn't log any if the statements within main.rs
2. We were initializing unnecessary filters that don't make any sense
for the asb. warp and http are not used and the harness-es are for
test only.
4 years ago
Thomas Eizinger 273cf15631
Introduce `Watchable` abstraction for Bitcoin wallet
We have a repeated pattern where we construct one of our
Tx{Cancel,Redeem,Punish,Refund,Lock} transactions and wait until
the status of this transaction changes. We can make this more
ergonomic by creating and implementing a `Watchable` trait that
gives access to the TxId and relevant script for this transaction.
This allows us to remove a parameter from the `watch_until_status`
function.

Additionally, there is a 2nd pattern: "Completing" one of these
transaction and waiting until they are confirmed with the configured
number of blocks for finality. We can make this more ergonomic by
returning a future from `broadcast` that callers can await in case
they want to wait for the broadcasted transaction to reach finality.
4 years ago
Thomas Eizinger a0830f099f
Pass relevant execution params into wallet instead of via functions
The execution params don't change throughout the lifetime of the
program. They can be set in the wallet at the very beginning.
This simplifies the interface of the wallet functions.
4 years ago
Thomas Eizinger 84ea092a1b
Remove unnecessary state variables by constructing TXs on demand 4 years ago
rishflab e5c0158597
Greatly reduce load onto the Electrum backend
We achieve our optimizations in three ways:

1. Batching calls instead of making them individually.

To get access to the batch calls, we replace all our
calls to the HTTP interface with RPC calls.

2. Never directly make network calls based on function
calls on the wallet.

Instead, inquiring about the status of a script always
just returns information based on local data. With every
call, we check when we last refreshed the local data and
do so if the data is considered to be too old. This
interval is configurable.

3. Use electrum's notification feature to get updated
with the latest blockheight.

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Rishab Sharma <rishflab@hotmail.com>
4 years ago
Thomas Eizinger e17cbadccb
Don't add signatures to transaction unless necessary
In order to compute the cancel TxID, we don't need to add the
signatures.
4 years ago
Thomas Eizinger 6beb732e35
Eliminate `build_bitcoin_punish_transaction`
We reduce indirection by constructing TxPunish directly based off
`State3` and make the type itself more powerful by moving the logic
of completing it with a signature onto it.
4 years ago
Daniel Karzel d85c0ce57c Re-introduce punish test 4 years ago
Daniel Karzel ea05c306e0 Alice spawns swaps outside the event loop
Instead of spawning the swap inside the event loop we send the swap back
to the caller to be spawned. This means we no longer need the remote handle
that was only used in the tests.
This now properly logs the swap results in production.
It also gives us more control over Alice's swap in the tests.
4 years ago
Thomas Eizinger dd6c66a594
Move completing of Bitcoin redeem tx onto RedeemTx
This allows us to have access to RedeemTx from within the scope
of the state transition which we are going to need for more
efficient watching of what happens to this TX on the blockchain.
4 years ago
rishflab 21429f24b2
Inline wait_for_locked_bitcoin() that is only called once
Reduce indirection.
4 years ago
rishflab 6a3e4802f1
Remove redundant reference 4 years ago
rishflab 458a8d594a
Rename fn param to correctly reflect underlying type 4 years ago
rishflab 752e5be8f3
Cleanup test logging 4 years ago
Thomas Eizinger 2704245ed5
Fix monero refresh interval
The comparison should be the MAXIMUM of the two values, not the
minimum, otherwise we always refresh at an interval of 1 second.
4 years ago
bors[bot] a02389f8bd
Merge #314
314: Remove CLI config file in favour of parameters r=thomaseizinger a=da-kami

Fixes #282 

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

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

Co-authored-by: Daniel Karzel <daniel@comit.network>
4 years ago
bors[bot] 8505d76561
Merge #311
311: Add asb to release including ARM build r=da-kami a=da-kami

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

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

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

Concerning openssl depdency see:

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


Co-authored-by: Daniel Karzel <daniel@comit.network>
4 years ago
Daniel Karzel 0091b6cdaf Remove CLI config file in favour of parameters
The CLI has sensible default values for all parameters,
thus a config file is not really an advantage but just
keeps getting in our way, so re remove it.
4 years ago
Daniel Karzel 442c377490 Remove openssl dependency
Upgrade tokio-tungstenite to 0.14 and use feature flag rustls-tls
to get rid of the openssl dependency.
4 years ago
Daniel Karzel 58c33f8468 Add asb to release including ARM build 4 years ago
rishflab 7cb198aea1 Remove pointless todo
The container is defined in the tests module indicating it is only
suitable for these tests
4 years ago
rishflab 9f534996ee Remove unused capability to configure bitcoind docker version tag
We only use one version of this container
4 years ago
rishflab 7b1d901ea0 Fix incorrectly formatted tag 4 years ago
bors[bot] 009597ac49
Merge #306
306: Fix logging and retrying of Monero transaction watching r=thomaseizinger a=thomaseizinger

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

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

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Daniel Karzel <daniel@comit.network>
4 years ago
Daniel Karzel be52892e65
Monero wallet should not know about all execution params
Instead of passing all execution params in we only make the monero_avg_block_time known to the monero wallet.
4 years ago
Thomas Eizinger 82738b111e
Refactor `monero::Wallet::watch_for_transfer` to not use `backoff`
Instead, we use a regular loop and extract everything into a function
that can be independently tested.
`backoff` would be useful to retry the actual call to the node.
4 years ago
Thomas Eizinger 7e0c44ad1d
Add avg monero block time to execution params 4 years ago
Thomas Eizinger d560e69203
Make durations more readable by using extension methods from `time` 4 years ago
Thomas Eizinger ecff1d1cbe
Remove indirection of constants
We never use these constants anywhere else, inline them.
4 years ago
Thomas Eizinger bac0f11898
Disable `backoff`s `max_elapsed_time` functionality
This config setting makes backoff stop retrying if we didn't get an
error within this timeframe.
For us, this results in backoff not actually doing anything.

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

Fixes #303.
4 years ago
Thomas Eizinger 9ad2160c69
Refactor the kraken module to automatically re-connect on errors
In order to be able to re-connect on certain errors, we model
connection errors separately from parsing errors. We also change
the API of the whole module to no longer forward all errors to
the subscribers but instead, only update the subscribers with
either a latest rate or a permanent failure in case we exhausted
all our options to re-connect the websocket.

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

Resolves #297.
4 years ago
Thomas Eizinger c560b3b21a
Introduce `RateUpdate` type alias to reduce duplication 4 years ago
Thomas Eizinger fd5b38739a
Remove constant in favor of inlining string
This removes an import and simplifies the `connect_async` call.
4 years ago
Thomas Eizinger 142e5e2d3a
Use tracing macros by fully-qualifying them 4 years ago
bors[bot] cc131ecf60
Merge #293
293: Some friday evening goodies r=thomaseizinger a=thomaseizinger



Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
4 years ago
Thomas Eizinger 08923a14f3
Simplify GET request for block tip height 4 years ago
Thomas Eizinger e9d7d9299c
Simplify the GET request to the tx status URL 4 years ago
Thomas Eizinger 418ad7089d
Make tests more readable by following arrange-act-assert 4 years ago
Thomas Eizinger c2329b19a2
Tell the user more about the monero lock transaction
First, we tell the user that we are now waiting for Alice to lock
the monero. Additionally, we tell them once we received the
transfer proof which will lead directly into the
"waiting for confirmations" function.
4 years ago
Thomas Eizinger 13c4d29d40
Tell the user immediately how many confirmations we expect
Without this, the user doesn't see a message before the first
confirmation.
4 years ago
Thomas Eizinger 4883e23dd8
Tell the user for how many confirmations we are waiting
Without this, the user has no idea for how long the program is
waiting.
4 years ago
Thomas Eizinger 5d4cf40831
Fix comparison of Monero confirmations 4 years ago
rishflab f92a8ac300 Improve CLI help comments and "type" hints
The type hints are generated from the field names. This has the
unfortunate consequence of the config field becoming file_path which
does not really make sense people working on the codebase.
4 years ago
Daniel Karzel 196557b377 Rename binary to swap 4 years ago
Daniel Karzel f8b61e2e0e Make monero daemon host configurable 4 years ago
Daniel Karzel f091402c7a Remove parameter duplication by introducing structs 4 years ago
Thomas Eizinger c826a28911
Add context if we fail to compute extended private key 4 years ago
Thomas Eizinger 1aa6d177bf
Improve error messages when determining BTC amount to be swapped 4 years ago
Thomas Eizinger 4138039ea0
Make sure all error messages start with an uppercase letter
These might potentially be shown to a user, let's make them all
consistent.
4 years ago
Thomas Eizinger 816e8b9b96
Add more context to fallible functions inside bitcoin::Wallet 4 years ago
Thomas Eizinger 5c24a46298
Improve error message if stuff fails directly in main 4 years ago
Thomas Eizinger 37f97ac471
Shorten function name
The variable will always be at least called `wallet`, hence we can
omit the `_wallet` postfix from the function name.
4 years ago
Thomas Eizinger 4f66269887
Move error message on sync _into_ the function
The bitcoin::Wallet::sync_wallet function doesn't do anything else
other than delegating. As such, we have just as much information
about what went wrong inside this function as we have outside.

By moving the .context call into the function, we can avoid repeating
us on every call-site.
4 years ago
Thomas Eizinger 5953037b81
Don't repeat the module name within the type 4 years ago
Thomas Eizinger 87f928f56c
Move const to function where it is used 4 years ago
Thomas Eizinger 4642e6c0e3
Simplify arguments to `init_XYZ_wallet` functions
This makes the function calls fit onto one line.
4 years ago
Thomas Eizinger d0db6cba10
Favour individual logs over one in main 4 years ago
bors[bot] 2041f367c6
Merge #288
288: Switch to public stagenet node that works r=rishflab a=rishflab

The xmr.to node has been unreliable lately. The exan.tech node seems to
working.

@da-kami is following up with making this configurable. Lets get this in so we can get a release on Friday.

Co-authored-by: rishflab <rishflab@hotmail.com>
4 years ago
rishflab 754159c9f8 Switch to public stagenet node that works
The xmr.to node has been unreliable lately. The exan.tech node seems to
working.
4 years ago
Thomas Eizinger b178e95f95
Redo layout of eventloop module
1. Move internal types to the bottom and make them private
2. Sort public types by their importance
4 years ago
Thomas Eizinger 1822886cd0
Provide stronger isolation of kraken module
Instead of leaking the tokio::sync::Receiver type in our
return value, we create a newtype that implements the desired
interface. This allows us to get rid of the `RateService` structs
and instead implement `LatestRate` directly on top of this struct.

Given that `LatestRate` is only used within the event_loop module,
we move the definition of this type into there.
4 years ago
Thomas Eizinger f6ed4d65b5
Properly deal with additional messages sent from kraken 4 years ago
Thomas Eizinger 7575d412b8
Add kraken_ticker CLI for local testing of the client 4 years ago
Thomas Eizinger 60d6d50246
Extract kraken websocket client into dedicated module 4 years ago
Thomas Eizinger 25c4639689
Prepare for next release 4 years ago
bors[bot] 20f2e56e2d
Merge #271
271: Bob can verify that the XMR lock tx was published r=da-kami a=da-kami

The Monero `txhash` log was removed. I feel the user should have the possibility to verify that the transaction was actually published so I added the tx-hash to the confirmation output. 

We could potentially print the tx-hash when receiving the transfer proof already, but that might not add much value compared to printing it with the confirmations. 

Additionally we should allow the user to at least know when the XMR can be expected in the user's wallet, otherwise the swap ends like this:

```
2021-03-04 13:49:19   INFO Monero lock tx received 5 out of 5 confirmations
```

This is just not very informative - yes, the final transaction is an implementation detail, but I don't think we should hide the transactions from the user. By printing the tx-hash for spending from the lock-tx into the user wallet we ensure the user knows that the XMR can now be expected in the user wallet. 

--- 

To add context, here the complete log (with debug enabled) **before** this change: 

```
2021-03-04 13:30:46  DEBUG Database and seed will be stored in /Users/dakami/Library/Application Support/xmr-btc-swap
2021-03-04 13:30:46  DEBUG Starting monero-wallet-rpc on port 56145
2021-03-04 13:30:51  DEBUG Requesting quote
2021-03-04 13:30:51   INFO Received quote: 1 XMR = 0.00433500 BTC
2021-03-04 13:30:51   INFO Still got 0.01018746 BTC left in wallet, swapping ...
2021-03-04 13:30:51   INFO Spot price for 0.00500000 BTC is 1.153402537485 XMR
2021-03-04 13:30:52  DEBUG Starting execution setup with 12D3KooWCdMKjesXMJz1SiZ7HgotrxuqhQJbP5sgBm2BwP1cqThi
2021-03-04 13:30:55   INFO Published Bitcoin 3a6690a962191529892318819fb20e7f1ac4625400e64ee734056a9b2a17ad8f transaction as lock
2021-03-04 13:41:13  DEBUG Received Transfer Proof from 12D3KooWCdMKjesXMJz1SiZ7HgotrxuqhQJbP5sgBm2BwP1cqThi
2021-03-04 13:42:11   INFO Monero lock tx received 1 out of 5 confirmations
2021-03-04 13:45:33   INFO Monero lock tx received 2 out of 5 confirmations
2021-03-04 13:47:49   INFO Monero lock tx received 3 out of 5 confirmations
2021-03-04 13:48:56   INFO Monero lock tx received 4 out of 5 confirmations
2021-03-04 13:49:19   INFO Monero lock tx received 5 out of 5 confirmations
2021-03-04 13:49:19  DEBUG Encrypted signature sent
2021-03-04 13:49:19  DEBUG Alice acknowledged encrypted signature
2021-03-04 13:49:19  DEBUG watching for tx: e5569d3f0bcccac95252dffaebe74ead0360c09b76bc762de890aaa0e51afbcf
2021-03-04 13:49:20  DEBUG Received protocol error "missing transaction" from Electrum, retrying...
2021-03-04 13:49:22  DEBUG Received protocol error "missing transaction" from Electrum, retrying...
```



Co-authored-by: Daniel Karzel <daniel@comit.network>
4 years ago