Daniel Karzel
dfc8b00ac7
Taker removes order from feed after cfd insert
We have a 1:1 relationship (and the fact that we don't remove cfds) between cfd and order at the moment, so once the cfd was inserted we cannot creat another cfd for the same order.
Thus, we should remove the order from the feel by sending `None`.
3 years ago
Daniel Karzel
79616e8036
Add guard to disallow adding cfd for same order
This should make this error more explicit and add understanding what goes wrong in the logs.
3 years ago
Thomas Eizinger
d18ee55146
Replace `expect` with `context` to avoid panics
3 years ago
Lucas Soriano del Pino
f90dd1fa53
Convert tracing::error into anyhow::Error context
This prevents us from reporting an error when the transaction was
actually on-chain.
3 years ago
Thomas Eizinger
75cd6a1ea2
Fix precision of Usd and Percent to 2 decimal upon serialization
3 years ago
Thomas Eizinger
202c600ddc
Refer to correct ID when joining orders
3 years ago
Daniel Karzel
4f4e6133ac
Failing test
3 years ago
Thomas Eizinger
09172b2b5d
Make `OrderId` always represent as `Hyphenated` in DB
3 years ago
Thomas Eizinger
1a28131bf5
Properly shutdown DB connection before exit
3 years ago
Lucas Soriano del Pino
7cb3c4f2c7
Treat InvalidOrderId from maker as Rejected
If the maker tells the taker that the take request was for an invalid
order ID, we should do something other than panic. For example,
logging and treating the situation as if the maker had rejected the
take request.
3 years ago
Mariusz Klochowicz
5b615476a3
Test order and cfd insertion in the actor
Check whether after inserting order and the cfd the Cfd feed works as expected
3 years ago
Mariusz Klochowicz
df402180f2
Validate sqlx insertions
Check query results whether the affected rows match our expectations
3 years ago
Philipp Hoenisch
9497043478
Print git tag when starting maker/taker
3 years ago
Daniel Karzel
f5db38a724
Remove Todos in favour of tickets
https://github.com/comit-network/hermes/issues/369
https://github.com/comit-network/hermes/issues/368
3 years ago
Daniel Karzel
a328d43b74
Remove pending roll over proposal upon rejection
3 years ago
Thomas Eizinger
790eaaa4f4
Add timeouts to rollover messages
3 years ago
Thomas Eizinger
2e57f98a8b
Fix typo
3 years ago
Thomas Eizinger
c467155b71
Add timeouts to awaiting messages during contract setup
3 years ago
Thomas Eizinger
698c7b70b7
Add log statements to sections of contract-setup
3 years ago
Thomas Eizinger
932b0badf5
Remove stale TODO
3 years ago
Thomas Eizinger
38ee2b1d7c
Prefetch announcement upon proposing rollover
Fixes #361 .
3 years ago
Thomas Eizinger
3ad6eacdb1
Add log statement for completed roll over
3 years ago
Lucas Soriano del Pino
79c377a7b8
Introduce maker ActorSystem
3 years ago
Lucas Soriano del Pino
4b9dae8c7d
Make taker_cfd::Actor generic over other actor addresses
3 years ago
Lucas Soriano del Pino
20c76f6134
Use MessageChannel instead of send_to_socket::Actor
We depend on `luckysori/xtra` until
https://github.com/Restioson/xtra/pull/45 is released.
3 years ago
Thomas Eizinger
ac73ddf3a1
Embed correct frontend :face_palm:
3 years ago
Daniel Karzel
cbfb40186a
Notify monitor actor to watch for collaborative close tx
So far we only did this on startup, but not during the actual execution of the collaborative close.
3 years ago
DelicioiusHair
6d6c40436d
Fix up SQL queries
This PR does a few things:
* cleans up the SQL to make the queries clearer in terms of intent, as well as eliminating the use of an extra transaction in some write queries.
* adds some additional testing
* (mostly) eliminates the use of `serde_json::to_string()`, making the data columns behave in a more sane manner
3 years ago
Thomas Eizinger
6d033264e8
Fetch announcement in case it is not present but requested
This will make sure that if a user retries an operation, the
announcement is there.
3 years ago
Thomas Eizinger
fc2b5fe482
Sync with Olivia every 5 seconds
We are only making requests to Olivia that are absolutely necessary,
i.e. only fetch attestations when they are likely ready and only
fetch attestations that we definitely need.
As a result, we can trigger the sync much more frequent.
Fixes #349 .
3 years ago
Lucas Soriano del Pino
a2b2a04a3a
Make maker_cfd::Actor generic over other actor addresses
3 years ago
Lucas Soriano del Pino
05c1674ae3
Use MessageChannel in taker's post_cfd_action HTTP handler
3 years ago
Thomas Eizinger
7c8d5e110b
Don't expose panicking code paths to the user
An actor not being reachable is a bad internal state but it should
never lead to an actual panic.
3 years ago
Lucas Soriano del Pino
e2f926388a
Introduce taker_cfd::CfdAction enum
To reduce boilerplate and allow us to use an
`xtra::MessageChannel<taker_cfd::CfdAction>` in the (very near)
future.
3 years ago
Thomas Eizinger
d00ac5bfdd
Don't return plain-text errors to the user
3 years ago
Lucas Soriano del Pino
1dbe127db9
Use MessageChannel in post_order_request HTTP handler
3 years ago
Thomas Eizinger
443e206a0b
Remove unused tempfile dependency
3 years ago
Thomas Eizinger
907f6b97f6
Run tests against in-memory DB
This prevents left-over temporary files on the system.
3 years ago
Thomas Eizinger
296be594a4
Add test for a variety of state updates
Co-authored-by: DelicioiusHair <mshepit@gmail.com>
3 years ago
Thomas Eizinger
bfabf0c7b1
Make it less verbose to construct simple states
3 years ago
Thomas Eizinger
44e62cff29
Reduce boilerplate in constructing `CfdStateCommon`
3 years ago
Thomas Eizinger
ca93714746
Refactor `insert_new_cfd_state_by_order_id` to `append_cfd_state`
We almost always have the entire `Cfd` available when we call this
function. It is therefore much easier to simply pass the entire
`Cfd` in instead of selective data.
3 years ago
Thomas Eizinger
8d72104641
Make DB tests more readable by reducing boilerplate
3 years ago
Thomas Eizinger
9c3ef98965
Use pretty assertions
3 years ago
Thomas Eizinger
b5dd3d0caa
Take `Cfd` by reference if we don't need to consume it
3 years ago
Thomas Eizinger
18d5506f46
Don't use Default for test instance
3 years ago
Thomas Eizinger
ed63d595f3
Directly return `PoolConnection`
Saves us a line of code in every test!
3 years ago
Daniel Karzel
b47d91ad6e
Extend DB test suite
3 years ago
Thomas Eizinger
8c8cbe759c
Close connections with takers that don't adhere to the message format
3 years ago
Thomas Eizinger
414d520afd
Introduce dedicated actor for forwarding only `Ok` messages
3 years ago