graphprotocol / block-oracle

MIT License
5 stars 11 forks source link

Make 'out of funds' a non-recoverable error #174

Open tilacog opened 1 year ago

tilacog commented 1 year ago

When the Oracle's wallet is low on funds and attempts to broadcast a transaction, we get back an error from the JRPC provider, like this one:

2022-08-02T15:07:19.400312207Z ERROR An error occurred and interrupted the last polling iteration. error="Couldn't submit a transaction to the mempool of the JRPC provider: Api error: RPC error: Error { code: ServerError(-32000), message: \"insufficient funds for gas * price + value\", data: None }"

We should create a new error variant that:

  1. emits a proper warning (and alerts, when we get to that)
  2. halts the main loop for longer than the default sleep duration to give the team some time to refund the wallet.

Ideally, the Oracle should keep track of its wallet's balance and emit warnings and alerts way before its depletion.