omni-network / omni

Monorepo for Omni node, contracts and other related tools

Home Page:https://omni.network

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

refactor(monitor): avoid dependency on archive EVM nodes

corverroos opened this issue · comments

commented

Currently, our internal RPC nodes must be partial archive nodes.
This is because we need to query historical (>128 blocks) state for monitoring purposes.
Operators should however be able to only run fullnodes, since they don’t need to query state at all. TODO: We should confirm this.

One option is to build a monitoring cache that queries and stores cursors per blockheight. We then query the cache for monitoring purposes (if actual query fails). We can then revert to using normal fullnodes.

  • Move relayer startMonitoring to monitor service. Along with all required config and metrics. Update grafana to use new metrics.
  • Implement emitcursorcache package in monitor binary
    • For each evm chain, stream xblocks, using ConfLatest.
    • For each xblock with ShouldAttest==true, fetch all emit cursors.
    • Store emit cursors locally on disk, index by height.
    • Trim the cache after 90k blocks.
  • In monitorAttestedForever if GetEmittedCursor errors, fetch the emit cursor from the emitcursorcache using att.BlockHeight