436: Consume both feeds in test r=da-kami a=da-kami
Minor changes on the test we already have. When creating another test I noticed that it reads nicer to just join on both channels. We might even pack the join into the `next` function at some point and return from both - I did not go that far yet.
Note that this is also closer to what we do in the production code, because we now send the message with `do_send_async` which is what we do there.
Co-authored-by: Daniel Karzel <daniel@comit.network>
440: Only transition maker to `ContractSetup` if we succeed to contract taker r=da-kami a=da-kami
Stumbled on this when writing actor tests.
We cannot create a failing test for this code at the moment, because our current test framework does not allow us to test at this granulairty level.
Nevertheless, we should fix this.
Rational:
If the maker is unable to contact the taker about the contract setup we fail now (previously we tried to continue).
This means, that we should only transition the maker's cfd to the new state if we are able to contact the maker.
Co-authored-by: Daniel Karzel <daniel@comit.network>
Stumbled on this when writing actor tests.
We cannot create a failing test for this code at the moment, because our current test framework does not allow us to test at this granulairty level.
Nevertheless, we should fix this.
Rational:
If the maker is unable to contact the taker about the contract setup we fail now (previously we tried to continue).
This means, that we should only transition the maker's cfd to the new state if we are able to contact the maker.
424: Rename `term` to `settlement_time_interval` and `announcement_lookahead` r=da-kami a=da-kami
Follow up for #419
Depending on the context, this makes it more explicit what we mean by `term` in the context of the `Cfd` and the `Oracle`.
Co-authored-by: Daniel Karzel <daniel@comit.network>
405: Fix price type r=da-kami a=DeliciousHair
Replacement of structs with public data to ones with private data
Addresses #357 and #365. Although not a very large change, this PR ends up touching rather a lot of code.
* Converted types `Usd`, `Leverage` and `Percent` to something that is appropriate to this application
* Created new types `Price` and `InversePrice` to use for BTC/USD exchange rate with appropriate algebraic ops implemented as well.
* Added new positive tests
* The function `daemon::model::calculate_profit()` has been changed substantially as the updated types make the existing workflow needlessly complex
* Some tests (mostly in `cfd.rs` required updating) in order to make use of the new types.
* Minor edit to `.gitignore` to avoid accidental pushing of DB to repository--should have been it's own item, added here to fix a problem that arose during this work.
NOTE:
* There may be an excess of algebraic ops implemented, some pruning may be appropriate.
Co-authored-by: DelicioiusHair <mshepit@gmail.com>
Addresses #357 and #365. Although not a very large change, this PR ends up touching rather a lot of code.
* Converted types `Usd`, `Leverage` and `Percent` to something that is appropriate to this application
* Created new types `Price` and `InversePrice` to use for BTC/USD exchange rate with appropriate algebraic ops implemented as well.
* Added new positive tests
* The function `daemon::model::calculate_profit()` has been changed substantially as the updated types make the existing workflow needlessly complex
* Some tests (mostly in `cfd.rs` required updating) in order to make use of the new types.
* Minor edit to `.gitignore` to avoid accidental pushing of DB to repository--should have been it's own item, added here to fix a problem that arose during this work.
NOTE:
* There may be an excess of algebraic ops implemented, some pruning may be appropriate.
419: Ensure we always know about Order::Term * announcements r=da-kami a=bonomat
When looking into https://github.com/comit-network/hermes/issues/360 I realized we forgot to trigger `FetchAnnouncement` when receiving a roll-over request.
This is fixed with this PR.
I found this a bit cumbersome to have to do this manually. Instead, we should sync regularly and ensure we have attestations for the next 24h.
This is also related to the discussion `@da-kami` and `@thomaseizinger` had in https://github.com/comit-network/hermes/issues/349
Co-authored-by: Philipp Hoenisch <philipp@hoenisch.at>
Fetching new events all over the place is cumbersome and it is likely that we will forget about doing so (e.g. atm we forgot doing this when receiving a roll-over request at the maker). Hence, we now fetch on a regular interval for a fixed timespan:
When starting up we fetch oracle events for the next 24h. Afterwards we check every 5 minutes again if there is a new event to check. This should ensure that we always know about needed events.
428: Actor tests r=da-kami a=da-kami
TODOs:
- [x] Test code does not clippy, there are two annoying warnings
- [x] Rebase on `master` 😬
Once that is done I'd say we get this work in and then add more tests and extract the test framework into a test module as needed.
Co-authored-by: Daniel Karzel <daniel@comit.network>
Co-authored-by: Mariusz Klochowicz <mariusz@klochowicz.com>
Include a generic Wallet actor constructor in the actor systems and allow
passing in a generic Wallet actor implementing xtra::Handlers into the cfd
actors.
Rename 'Maker' and 'Taker' to 'MakerActorSystem' and 'TakerActorSystem' for
readability.
Co-authored-by: Mariusz Klochowicz <mariusz@klochowicz.com>
400: Cleanup `unwrap`s throughout the codebase r=da-kami a=thomaseizinger
- Make function that never fails non-fallible
- Disallow `.unwrap` in prod code and use expect for remaining ones
- Rewrite matrix_solve to not contain `unwrap`
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
427: Bump rust_decimal_macros from 1.16.0 to 1.17.0 r=da-kami a=dependabot[bot]
Bumps [rust_decimal_macros](https://github.com/paupino/rust-decimal) from 1.16.0 to 1.17.0.
<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_macros&package-manager=cargo&previous-version=1.16.0&new-version=1.17.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>
421: Bump quote from 1.0.9 to 1.0.10 r=da-kami a=dependabot[bot]
Bumps [quote](https://github.com/dtolnay/quote) from 1.0.9 to 1.0.10.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/dtolnay/quote/releases">quote's releases</a>.</em></p>
<blockquote>
<h2>1.0.10</h2>
<ul>
<li>Work around regression in nightly Clippy: <a href="https://github-redirect.dependabot.com/rust-lang/rust-clippy/issues/7768">rust-lang/rust-clippy#7768</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="f1df6c7416"><code>f1df6c7</code></a> Release 1.0.10</li>
<li><a href="264221ecb5"><code>264221e</code></a> Work around clippy semicolon_if_nothing_returned regression</li>
<li><a href="9e1b974802"><code>9e1b974</code></a> Declare minimum Rust version in Cargo metadata</li>
<li><a href="32431f6630"><code>32431f6</code></a> Update test suite to tool attrs</li>
<li><a href="6c4aba5a45"><code>6c4aba5</code></a> Run clippy on test suite too</li>
<li><a href="dcbfb23ca1"><code>dcbfb23</code></a> Skip clippy job on pull requests</li>
<li><a href="5a1d627c43"><code>5a1d627</code></a> Update test suite to nightly-2021-09-18</li>
<li><a href="cbe5dedaeb"><code>cbe5ded</code></a> Update ui test suite to nightly-2021-07-20</li>
<li><a href="ef86ae7677"><code>ef86ae7</code></a> Include benches and ui stderr files in published crate</li>
<li><a href="4e689243ee"><code>4e68924</code></a> Update ui test suite to nightly-2021-05-14</li>
<li>Additional commits viewable in <a href="https://github.com/dtolnay/quote/compare/1.0.9...1.0.10">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=quote&package-manager=cargo&previous-version=1.0.9&new-version=1.0.10)](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>
418: Stop contract and rollover from the maker if cannot notify the taker r=da-kami a=klochowicz
As for now, we were only logging the communication problem and moving on.
420: Be productive r=klochowicz a=thomaseizinger
422: Bump rust_decimal from 1.16.0 to 1.17.0 r=da-kami a=dependabot[bot]
Bumps [rust_decimal](https://github.com/paupino/rust-decimal) from 1.16.0 to 1.17.0.
<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.16.0&new-version=1.17.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: Mariusz Klochowicz <mariusz@klochowicz.com>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
412: All the term to be configurable on the maker's commandline r=thomaseizinger a=thomaseizinger
- Use the original order's term for rolling over
- Allow term to be configurable on the maker's commandline
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
This allows us to avoid the use of the constant in two places which
removes the dependency on the constant from the taker entirely.
The logic here is generally not great - in particular having the taker
anticipate, which announcement it is going to be - but this is the
least invasive way of making the term dynamic.
407: Xtra productivity hell yeah r=thomaseizinger a=da-kami
- [x] Optimize message block generation
- [x] Use the actual variable names that were used in the function sig in the generated code
- [x] Get the xtra::Context into the macro (third argument that can be specified on function sig)
Co-authored-by: Daniel Karzel <daniel@comit.network>
Co-authored-by: Mariusz Klochowicz <mariusz@klochowicz.com>
416: Prefer automatic links in docs r=klochowicz a=klochowicz
Automatic links (wrapped inside <>) are automatically turned into clickable
links when you generate documentation
Gets rid of the warnings when you run `cargo doc`
Co-authored-by: Mariusz Klochowicz <mariusz@klochowicz.com>
414: Initialize Cfd actors outside of Rocket r=klochowicz a=klochowicz
Allows us to use `?` instead of unwrapping.
Co-authored-by: Mariusz Klochowicz <mariusz@klochowicz.com>