-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Start pricenode providers asynchronously #4890
Conversation
Thanks for working on this. I think the main concern is what price do you return if there is no data for a given asset? In that case I assume you don't return anything, or a null value, right? |
If there is no data for a given asset, that asset would not be present in the JSON data. For example, running with only two providers: Kraken and Luno, the rate for ZAR is not present in the JSON data. ZAR is provided by Luno (not Kraken), but Luno service is down. If the Binance provider is included, the ZAR rate is present. |
@cd2357 Could you please give this code changes a quick ACK? |
My main concern is this:
This is now avoided by the simple fact that a pricenode always provides a price for all known / expected currencies :
I admit this is mainly a theoretical concern (I didn't test it out and see errors), but it seems reasonable that these risks are possible. Most "at risk" currencies are those with a small number of "inputs" in the aggregate price, like those depending on 1-2-3 exchanges: https://bisq.wiki/Bisq_Price_Indices . For example, lots of fiat currencies have only 1 provider (BitPay). How do you see this? Is this an acceptable risk, or maybe am I over-estimating it? If not, how could it be mitigated? One possible solution that comes to mind is that pricenodes periodically persist to disk the latest-known prices for all supported currencies, then if they are restarted and some exchanges are temporarily unreachable, they could report the "cached" price for those currencies until the faulty exchanges come back online. (This cache approach is already in place, but the prices are cached in-memory, not persisted on-disk.) cc @bisq-network/pricenode-operators |
What happens if
Does re-enabling the offer fail graciously? Also, if shortly after that the pricefeed becomes available again (Bisq client didn't restart, kept using same pricenode, but not pricenode starts providing the needed pricefeed) -- will the client detect that and allow the user to re-enable the offer / create new offers in that currency? |
Per your first question, re-enabling the offer does not fail, you can disable/enable at will. The status of the pricefeed is not taken into account. The trading protocol would prevent a market based offer from being taken due to the price feed being N/A. Per your second question, offers can still be created when the pricefeed is down. If the pricefeed fails while Bisq is running, the user can still create market based offers. If Bisq starts up with no pricefeed available the user is only allowed to create fixed price offers. |
In that case, it sounds good from my side. Thanks for the detailed answers @jmacxx. @wiz do you want to coordinate more extensive tests on this first? Or is this fine and can be merged? |
As pricenode providers are running from specific master versions anyways I'm not merging this for v1.5.2. Waiting for testing by @wiz. |
@wiz ☝️ |
@wiz did this get installed to production? It seemed like a high priority when you were |
@jmacxx sorry for the late reply, yes it was a high priority because it can cause pricenodes to completely fail to startup. I apologize I haven't had time to properly ACK the PR but IIRC it's running on my pricenode server for a while now. @Emzy would you mind testing/reviewing this PR ? |
I have this PR as a test running on my pricenode "emzypricpidesmyqg2hc6dkwitqzaxrqnpkdg3ae2wef5znncu2ambqd.onion" |
ACK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK - based on #4890 (comment)
Fixes #4441
This guarantees that the pricenode will run even when there is a problem with a provider at startup. It simply calls the initial
refresh()
asynchronously rather than blocking the bean startup routine. To my point of view there is no difference between the first and subsequent calls to refresh, since providers can fail at any time. When rates are requested any non-initialized provider is ignored.However I have not taken ownership of the pricenode and only have a superficial understanding of how the data is calculated. I did enough testing to check that the price and fee data looks good, and that the automated tests pass. There could certainly be edge cases that I'm not aware of. @cd2357 is certainly free to flame me if this is a stupid change, as he put a lot more work into it than I did.