Skip to content

feat(indexer): implement EVM indexer runtime - #1

Merged
Patrick-Ehimen merged 3 commits into
mainfrom
feat/evm-indexer
Jul 8, 2026
Merged

Patrick-Ehimen merged 3 commits into
mainfrom
feat/evm-indexer

Conversation

@Patrick-Ehimen

@Patrick-Ehimen Patrick-Ehimen commented Jul 8, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Wires up indexer/ from an empty stub to a fully functional EVM event pipeline
  • alloy-rs WebSocket provider connects to Alchemy per chain; chain ID confirmed on startup
  • ChainRunner<P> backfills historical logs in 2k-block chunks via eth_getLogs, then transitions to a live subscribe_logs stream — no gap between the two
  • One Tokio task spawned per chain (Ethereum, Arbitrum, Optimism, Base); DB pool shared across tasks; graceful Ctrl+C shutdown aborts all tasks
  • AdapterDispatch enum skeleton in place — NoOp placeholder until the LayerZero V2 adapter lands

What's not in this PR

No protocol adapters yet — AdapterDispatch::NoOp matches nothing, so no events are inserted. The next PR adds the LayerZero V2 adapter as the first real variant.

Test plan

  • Set DATABASE_URL, ALCHEMY_API_KEY, and remaining required env vars from .env.example
  • cargo run -p indexer — should log "connected to EVM node" × 4 chains, run migrations, then log "indexer running"
  • Set EVM_START_BLOCK=<recent_block> and confirm backfill chunk logs appear before the subscription hand-off
  • Ctrl+C shuts down cleanly with "shutting down" log

Wires up the indexer binary with a full EVM event pipeline:
- Tokio bootstrap with structured logging, DB connection, and migration runner
- alloy-rs WebSocket provider per chain (generic over transport type)
- RawLog conversion from alloy Log type
- AdapterDispatch enum skeleton for zero-overhead protocol dispatch
- ChainRunner with eth_getLogs backfill (2k-block chunks) and live subscribe_logs subscription
- One Tokio task per chain (Ethereum, Arbitrum, Optimism, Base) with graceful Ctrl+C shutdown
- EVM_START_BLOCK env var controls backfill depth; defaults to tip-only (no backfill)
@Patrick-Ehimen

Copy link
Copy Markdown
Member Author

Test results ✅

All 7 EVM chains connected and subscribed to live logs:

Chain Chain ID
Ethereum 1
Arbitrum 42161
Base 8453
Polygon 137
Avalanche 43114
Optimism 10
BSC 56

DB connection and migrations confirmed working against local Docker Postgres. WebSocket reconnection on drop is tracked separately in #2.

@Patrick-Ehimen
Patrick-Ehimen merged commit 7e75908 into main Jul 8, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant