Converting from f64 to u64 can make us lose precision.
Create a new Fee type that encapsulates calculating fees, includding splitting
it between two parties.
287: Fetch attestations only when it is time r=thomaseizinger a=thomaseizinger
- Rename `OracleEventId`
- Refer to types within `fmt` module via module qualifier
- fixup! Refer to types within `fmt` module via module qualifier
- Prefer `.parse` over `FromStr` to avoid an import
- Properly model event IDs
- Fix typo
- Only fetch attestation that are likely to have occured
- Introduce drop-in replacement for tokio::spawn that logs errors
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
288: Rename order price to offer price r=bonomat a=bonomat
I want to trigger a new `preview` build and wasn't sure if there is another way. Looks like a last release build failed: https://github.com/comit-network/hermes/runs/3868563726?check_suite_focus=true
And I want to see if this was a glitch or if something else went wrong.
Co-authored-by: Philipp Hoenisch <philipp@hoenisch.at>
273: Build for aarch64 which is needed for RPi4 r=bonomat a=bonomat
Adds more build targets and publishes docker containers.
This was tested on my personal fork and resulted in the following container which can run on an RPi4:
```
docker run ghcr.io/bonomat/hermes-maker-aarch64-unknown-linux-gnu:latest
```
A few notes which might come up:
- The naming of the containers can be improved, please someone with sed knowledge give it a try :)
- I was not able to use the github action `docker/build-push-action`. This moves the image build into a tmp folder which I was not able to escape. Hence, I was not able to copy the binaries into the image
- I was not able to combine the containers into a single one because we have parallel builds. Apparently this should be possible though (reference: [manifest](https://www.docker.com/blog/multi-platform-docker-builds/)).
- I was also not able to use alpine because of the different libc6 version
282: Only fetch announcements when needed r=luckysori a=luckysori
Fixes#275.
I think this is what you meant with #275, `@thomaseizinger.` It does result in immediately deleting some code you wrote in #279. I do think we'll end up reintroducing it once we actually use more than one oracle event per CFD, but it seems unnecessary to keep it around until then. Let me know if you disagree.
Co-authored-by: Philipp Hoenisch <philipp@hoenisch.at>
Co-authored-by: Lucas Soriano del Pino <l.soriano.del.pino@gmail.com>
The daemon adds `CfdDetails` that contains:
* `Vec<TxUrl>` - relevant transaction-id URLs to block explorer based on the state and bitcoin network
* `Option<bitcoin::Amount>` - The payout if we already have an attestation
* Display tx-urls and payout when unfolding the cfd row in table
The way I see it, an oracle "event" consists of both an "announcement"
and an "attestation". In the case of this message, we want to keep
track of the state of the "attestation", so the rename should make it
unambiguous.
Instead of always keeping track of the next 24 hours of announcements,
we instruct the `oracle::Actor` to fetch (if necessary) announcements
based on new orders.
At the moment this results in removing code which allowed us to fetch
several announcements in parallel, but we will need to reintroduce it
once we let the `daemon`s create CFDs with multiple attestation
events.
281: Monitor CETs based on a script pubkey in the transaction r=luckysori a=luckysori
Fixes#238.
Instead of passing in a script which may or may not be part of a CET (because some CETs only pay to one party), we take the script pubkey from an output of the transaction itself.
Co-authored-by: Lucas Soriano del Pino <l.soriano.del.pino@gmail.com>
Instead of passing in a script which may or may not be part of a
CET (because some CETs only pay to one party), we take the script
pubkey from an output of the transaction itself.
283: Give each app a different name r=luckysori a=luckysori
This might be stupid, but it makes it easier to know who is who.
Co-authored-by: Lucas Soriano del Pino <l.soriano.del.pino@gmail.com>
279: More oracle actor fixes r=thomaseizinger a=thomaseizinger
- Re-organize oracle module a bit
- Parallelize fetching of announcements via self messages
- Add error message to JSON deserializer
- Don't fail attestation sync just because it is not attested yet
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
268: Transition `PendingOpen` to `PendingOpen` upon attestation r=da-kami a=da-kami
In a real-world scenario this should actually never happen, but it is still weird to see `PendingOpen` jump to `Open` when testing with timelocks and attestations.
Since this is "more correct" we distinguish fine-granular.
Co-authored-by: Daniel Karzel <daniel@comit.network>
269: Fix monitoring r=da-kami a=da-kami
In this protocol we *can* actually have transactions with the same script, hence, we have to handle the `GetHistoryRes` by `Txid`.
To make this easier to understand we group the `Vec<Vec<GetHistoryRes>>` by `Txid` into `HashMap<Txid, GetHistroyRes>`.
Note: The assumption is, that only `GetHistroyRes` is returned for the `Txid`+`Script` combination.
fixes#260
Co-authored-by: Daniel Karzel <daniel@comit.network>
270: Some oracle fixes r=thomaseizinger a=thomaseizinger
- Only fetch announcements we don't already have
- Await futures in random order
- Use the same code for computing the next attestation event
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
274: Bump thiserror from 1.0.29 to 1.0.30 r=thomaseizinger a=dependabot[bot]
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.29 to 1.0.30.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/dtolnay/thiserror/releases">thiserror's releases</a>.</em></p>
<blockquote>
<h2>1.0.30</h2>
<ul>
<li>Make <code>#[source]</code> attribute usable on a field of type <code>Box<dyn Error + Send + Sync + UnwindSafe + 'static></code> (<a href="https://github-redirect.dependabot.com/dtolnay/thiserror/issues/155">#155</a>, thanks <a href="https://github.com/cosmicexplorer"><code>`@cosmicexplorer</code></a>)</li>`
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="672e9525bb"><code>672e952</code></a> Release 1.0.30</li>
<li><a href="5c62f5ed44"><code>5c62f5e</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/dtolnay/thiserror/issues/155">#155</a> from cosmicexplorer/derive-unwindsafe</li>
<li><a href="2fd08ccb50"><code>2fd08cc</code></a> add UnwindSafe impl for AsDynError</li>
<li><a href="00956f1f8c"><code>00956f1</code></a> Ui test changes for trybuild 1.0.49</li>
<li><a href="035abbd652"><code>035abbd</code></a> Add actions job to notice outdated dependencies</li>
<li><a href="f072c626ef"><code>f072c62</code></a> Update ui test files</li>
<li><a href="791a98eb93"><code>791a98e</code></a> Update ui test suite to nightly-2021-10-07</li>
<li><a href="ed234d41b5"><code>ed234d4</code></a> Declare minimum Rust version in Cargo metadata</li>
<li><a href="bda41eb005"><code>bda41eb</code></a> Skip clippy job on pull requests</li>
<li>See full diff in <a href="https://github.com/dtolnay/thiserror/compare/1.0.29...1.0.30">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=thiserror&package-manager=cargo&previous-version=1.0.29&new-version=1.0.30)](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>