You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BACKit uses PostgreSQL as the frontend read model and Soroban events as the source of on-chain activity. RPC interruptions, parsing failures, reprocessing, or a deployment configuration mistake can leave calls, stakes, resolutions, and payout claims missing or duplicated in PostgreSQL. There is currently no operator workflow that quantifies drift and repairs affected records safely.
Goal
Build an idempotent reconciliation process that compares indexed records with authoritative Soroban events/state and repairs recoverable drift without modifying on-chain state.
Acceptance criteria
Introduce a reconciliation service and BullMQ job that can scan a configurable ledger range and selected contract IDs.
Compare at least call creation, stake, resolution, and payout claim records using stable event identity (contractId, ledger, transaction hash, and event index or equivalent).
Classify discrepancies as MISSING_OFFCHAIN, DUPLICATE_OFFCHAIN, VALUE_MISMATCH, UNKNOWN_CONTRACT, or UNRECOVERABLE.
Dry-run mode produces a structured report without database writes.
Repair mode upserts missing records transactionally and quarantines unsafe mismatches for admin review; it never submits a Soroban transaction.
Re-running the same ledger range creates no duplicate records and no duplicate notifications.
Store reconciliation run metadata, range, contract/network, counts, status, duration, and failure reason.
Add protected admin endpoints to start a run and inspect runs/discrepancies with pagination and filters.
Prevent overlapping runs for the same network and contract set using a distributed lock.
Emit metrics/logs for indexer lag, discrepancy count by type, repaired records, and failed repairs.
Tests cover an RPC page boundary, retry after interruption, duplicate events, missing records, value mismatch, and idempotent reruns.
Add an operator runbook describing dry-run review, repair execution, and rollback/incident steps.
Technical pointers
packages/backend/src/indexer
packages/backend/src/event-store
packages/backend/src/payouts
packages/backend/src/common/queues
packages/backend/src/admin
Out of scope
Replacing the existing indexer
Altering contract state
Supporting contracts outside the configured BACKit deployment set
Package:
packages/backendComplexity: High
Problem
BACKit uses PostgreSQL as the frontend read model and Soroban events as the source of on-chain activity. RPC interruptions, parsing failures, reprocessing, or a deployment configuration mistake can leave calls, stakes, resolutions, and payout claims missing or duplicated in PostgreSQL. There is currently no operator workflow that quantifies drift and repairs affected records safely.
Goal
Build an idempotent reconciliation process that compares indexed records with authoritative Soroban events/state and repairs recoverable drift without modifying on-chain state.
Acceptance criteria
contractId, ledger, transaction hash, and event index or equivalent).MISSING_OFFCHAIN,DUPLICATE_OFFCHAIN,VALUE_MISMATCH,UNKNOWN_CONTRACT, orUNRECOVERABLE.Technical pointers
packages/backend/src/indexerpackages/backend/src/event-storepackages/backend/src/payoutspackages/backend/src/common/queuespackages/backend/src/adminOut of scope