interlay / interbtc-clients

interBTC Clients | Vault, Oracle, Faucet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add oracle fallback

gregdhill opened this issue · comments

Is your feature request related to a problem? Please describe.
If a single price feed fails we may be unable to update the oracle before the parachain goes into an error state.

Describe the solution you'd like
We should add a configurable fallback to use a secondary API if we do not get a response from the primary API within some time bound.

Describe alternatives you've considered
With good monitoring we can catch when the oracle goes offline but since this may happen out-of-hours it is better to have the oracle client handle this automatically.

commented

@greg Questions for the Issue:

  1. Is it related to submitting the price feed to the blockchain or getting the price feed from the exchanges?
  2. If it is the latter,
    • Will get_value_or_median always return the result "OK" since get_prices will return a result of "OK"? If not, would you like to switch to a secondary API endpoint if the primary API feed gives an error? You can find the relevant code here.
  3. If it is the former,
    • Would you like to add a fallback btc_parachain_url in case the primary RPC endpoint is down?
  1. Getting the price feed from the external endpoint
  2. The code you linked will fail on the first error, at which point we should switch to a secondary API but actually now that I consider this it feels slightly over-engineered so I would be in favour of closing this actually - what do you think @sander2?
  3. Not applicable, we control RPC endpoints and oracle should retry on disconnect

I'm no longer convinced this is necessary, we want to be very specific which price feed we use and I don't think it makes sense to switch to a backup. Besides, once interlay/interbtc#1119 is merged the parachain will no longer enter an error state which I believe was the motivation for this feature request.