subql icon indicating copy to clipboard operation
subql copied to clipboard

Healthcheck doesn't consider mine-on-demand EVMs

Open hellowodl opened this issue 1 year ago • 1 comments

Prerequisites

  • [x] Are you running the latest version(s)?
  • [x] Have you searched the documentation for your issue?
  • [x] Did you search for an existing issue or pull request?

Description

The indexer's healthcheck relies on the last time a block was mined. Though there are various EVMs out there that mine blocks on demand, eg. rollup based chains or local development environments. Thus the current healthcheck doesn't work for all scenarios anymore.

The culprit is this method: https://github.com/subquery/subql/blob/c99be34fe74172a7cbad77f6ddaef1df0a066426/packages/node-core/src/meta/health.service.ts#L65

Details

Local Environment: @subql/cli/5.3.0 darwin-arm64 node-v20.18.0 Query Version: v2.15.2 (docker) Indexer Version: v5.1.7 (docker) Network Details:

  • Foundry/Anvil

Steps to Reproduce

  1. Deploy an example project with Anvil as the EVM/RPC
  2. Wait for a few seconds
  3. Healthcheck fails

Example project: I can create one on-request, though I don't have the time at the moment.

Expected behavior: The healthcheck preferably should check whether new blocks are mined instead of failing based upon time.

Actual behavior: When no new blocks are created within a certain time, the indexer's health check fails.

If desired I could write a fix. Though I'd like to know whether that is desired and what the desired route of implementation would be from you guys.

hellowodl avatar Nov 13 '24 03:11 hellowodl

Hi @hellowodl, thanks for your issue, this issue has been in the back of our mind but not big enough to consider addressing.

The health check is just a best guess that a growing chain is a healthy chain (and therefore a healthy RPC and indexer).

I think we can drop the requirement that the latest height by the RPC needs to grow.

So an unhealthy node is where the current indexing height is < the RPC reported chain height and not increasing within the interval. Otherwise its false.

If you have time to make this change it would be appreciated otherwise we will add it to our backlog.

stwiname avatar Nov 14 '24 00:11 stwiname