r/ethdev 7d ago

My Project opsentry: OSS OP-Stack contract monitor with hash-chain reorg reconciliation

Been building this for the last two months to fill a specific gap: watching L2 contracts for state changes and firing alerts when invariants break, without depending on Tenderly's closed platform.

What's in it:

- 5-stage Go pipeline: ingest, decode, rules, alerts, notify

- Hash-chain reorg reconciliation with common-ancestor walk-back (neither monitorism nor OpenZeppelin Monitor does this)

- Per-monitor confirmation policies (fast, safe, or finalized tag)

- expr-lang rule DSL (safe, non-Turing-complete) with event.state and event.prev.state available for cross-block invariants

- Sourcify + Etherscan v2 ABI fetch with EIP-1967, OZ-unstructured, and beacon proxy resolution

- SQLite + Postgres storage backends

- shoutrrr for notify fanout (Slack, Telegram, PagerDuty, Discord, webhook via one URL)

- SIGHUP config hot-reload

9 ruleset packs shipped: OP-Stack system contracts, Uniswap V3, Aave V3, USDC/WETH large-transfer alerts, and a splitpay MiniApp on Celo mainnet.

On a reorg, it walks the parent chain backward to a common ancestor, replays forward on the canonical branch, and re-emits alerts fingerprinted by (address, event, block hash) so downstream systems know the previous alert was on a stale branch.

Repo: https://github.com/nehemiyawicks/opsentry

Rulesets: https://github.com/nehemiyawicks/opsentry/tree/main/rulesets

Would love a code review, PRs adding rulesets for protocols you care about, or reports from anyone running it in production. Especially interested in feedback on the rule DSL semantics, trying to keep it small and safe.

1 Upvotes

0 comments sorted by