437: Test reject order r=da-kami a=da-kami
There is several improvements that can be done on top of this, but we can merge this work and go on from here.
I opted for writing specific helper functions for `next_cfd` and `next_order` that handle both maker and taker channel. I think that reads nicer and it makes it easier to use (internally it uses the generic impls so we avoid code duplication).
Co-authored-by: Daniel Karzel <daniel@comit.network>
444: Bump trybuild from 1.0.50 to 1.0.52 r=da-kami a=dependabot[bot]
Bumps [trybuild](https://github.com/dtolnay/trybuild) from 1.0.50 to 1.0.52.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/dtolnay/trybuild/releases">trybuild's releases</a>.</em></p>
<blockquote>
<h2>1.0.52</h2>
<ul>
<li>Display full path of test files (<a href="https://github-redirect.dependabot.com/dtolnay/trybuild/issues/139">#139</a>, thanks <a href="https://github.com/taiki-e"><code>`@taiki-e</code></a>)</li>`
</ul>
<h2>1.0.51</h2>
<ul>
<li>Strip line numbers from every file other than the one that was the argument to <code>fn compile_fail</code> (<a href="https://github-redirect.dependabot.com/dtolnay/trybuild/issues/136">#136</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="2ee6ca1e0e"><code>2ee6ca1</code></a> Release 1.0.52</li>
<li><a href="a71eef7eca"><code>a71eef7</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/dtolnay/trybuild/issues/139">#139</a> from taiki-e/path</li>
<li><a href="6170650b47"><code>6170650</code></a> Always display path of test files</li>
<li><a href="f74cd93e28"><code>f74cd93</code></a> Release 1.0.51</li>
<li><a href="0895db4ea7"><code>0895db4</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/dtolnay/trybuild/issues/138">#138</a> from dtolnay/inputfile</li>
<li><a href="ae88a100fc"><code>ae88a10</code></a> Link to issue 86 in dropshot test</li>
<li><a href="362c606914"><code>362c606</code></a> Set appropriate input path on test cases to match prev result</li>
<li><a href="9db3ce59d8"><code>9db3ce5</code></a> Strip line numbers outside of the one input file</li>
<li><a href="d8c5756cbe"><code>d8c5756</code></a> Add input file path to context for normalization</li>
<li><a href="db6e88014d"><code>db6e880</code></a> Add test for issue 136</li>
<li>See full diff in <a href="https://github.com/dtolnay/trybuild/compare/1.0.50...1.0.52">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=trybuild&package-manager=cargo&previous-version=1.0.50&new-version=1.0.52)](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>
443: Bump syn from 1.0.80 to 1.0.81 r=da-kami a=dependabot[bot]
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.80 to 1.0.81.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/dtolnay/syn/releases">syn's releases</a>.</em></p>
<blockquote>
<h2>1.0.81</h2>
<ul>
<li>Support arbitrary precision negative literal tokens on rustc 1.56+ (<a href="https://github-redirect.dependabot.com/dtolnay/syn/issues/1087">#1087</a>, <a href="https://github-redirect.dependabot.com/dtolnay/syn/issues/1088">#1088</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="6044282060"><code>6044282</code></a> Release 1.0.81</li>
<li><a href="f39a581ef7"><code>f39a581</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/dtolnay/syn/issues/1088">#1088</a> from dtolnay/literalparse</li>
<li><a href="0ca31d1e12"><code>0ca31d1</code></a> Delete lit overflow test</li>
<li><a href="793b1c395e"><code>793b1c3</code></a> Pull in proc-macro2 negative literal support</li>
<li><a href="36093340a3"><code>3609334</code></a> Link to rustc PR for negative literal parse</li>
<li><a href="a7eedc1e7e"><code>a7eedc1</code></a> Locally ignore unnecessary_wraps pedantic clippy lint</li>
<li><a href="d9a9ff4398"><code>d9a9ff4</code></a> Bypass negative literal workaround on 1.56+</li>
<li><a href="30984ec11f"><code>30984ec</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/dtolnay/syn/issues/1087">#1087</a> from dtolnay/literalparse</li>
<li><a href="0fda5ad1a0"><code>0fda5ad</code></a> Use 'FromStr for Literal' instead of TokenStream workaround</li>
<li><a href="68e7ab85ab"><code>68e7ab8</code></a> Suppress no_effect_underscore_binding pedantic Clippy lint in test suite</li>
<li>Additional commits viewable in <a href="https://github.com/dtolnay/syn/compare/1.0.80...1.0.81">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=syn&package-manager=cargo&previous-version=1.0.80&new-version=1.0.81)](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>
433: Rename Buy and Sell to Long and Short r=da-kami a=DeliciousHair
Addresses #373. Change made for consistency of language and removes some ambiguity in the business logic as a side-effect.
Co-authored-by: DelicioiusHair <mshepit@gmail.com>
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>