Background & current state
The indexer (NEW-024) ingests events from Soroban RPC, but transient RPC errors, endpoint switches (rpcPool.js), or rollbacks can produce gaps or duplicate/inconsistent rows. Without reconciliation, downstream leaderboards/analytics drift from chain truth.
Goal
Add reorg/gap detection and automatic reconciliation so the indexed state self-heals after RPC hiccups or ledger inconsistencies.
Technical design
- Track per-ledger ingestion with contiguous-range invariants; on detecting a gap (missing ledger range) or a hash/cursor mismatch, re-fetch and reconcile the affected range idempotently.
- Quarantine unparseable events into a
dead_events table for inspection rather than crashing.
- Periodic consistency sweep comparing indexed counts vs. on-chain getters (e.g.,
get_participant_count).
Edge cases
- Large gap after long downtime → bounded backfill (NEW-028) instead of infinite loop.
- Duplicate delivery → idempotent upserts make reconciliation safe.
- Persistent parse failure → quarantine + alert, keep indexing.
- RPC returns inconsistent data across endpoints → prefer canonical + log divergence.
Task breakdown
Acceptance criteria
Testing & verification
- Fault-injection: drop/duplicate/corrupt ledger ranges; assert eventual consistency.
Out of scope
- Initial indexer build (NEW-024); rollups (NEW-026).
Dependencies / related
- Builds on NEW-024; uses NEW-028 for large gaps.
Difficulty: medium · Effort: M · indexer
Background & current state
The indexer (NEW-024) ingests events from Soroban RPC, but transient RPC errors, endpoint switches (
rpcPool.js), or rollbacks can produce gaps or duplicate/inconsistent rows. Without reconciliation, downstream leaderboards/analytics drift from chain truth.Goal
Add reorg/gap detection and automatic reconciliation so the indexed state self-heals after RPC hiccups or ledger inconsistencies.
Technical design
dead_eventstable for inspection rather than crashing.get_participant_count).Edge cases
Task breakdown
dead_eventsquarantine + metrics/alerts.Acceptance criteria
Testing & verification
Out of scope
Dependencies / related
Difficulty: medium · Effort: M · indexer