Skip to content

✅ [Fixed] No off-chain event indexer — every page load re-derives state from raw RPC calls #943

Description

@Ejirowebfi

Severity: Critical (as filed) · Area: API / Infra (api/_lib/indexer/, api/cron/index-tokens.ts) · Status: ✅ Resolved — re-verified against the tree on 2026-08-19

Description

Original defect. .kiro/specs/contract-event-indexing/ was an empty directory: the team had named the gap but not scoped or built it. The frontend's entire data layer ran on live synchronous RPC calls with a short-TTL in-memory cache as the only persistence, which truncated the explorer at the RPC's 100-event page cap, made pagination latency-bound, and meant any RPC outage took down all reads at once.

Why this is now closed. The spec is filled in and the indexer is built:

  • api/_lib/indexer/ implements the layer behind a TokenStore seam (types.ts), with backfill / steady-state paging / reconciliation (ingest.ts), Soroban RPC reads (sorobanChain.ts), and both a Postgres (postgresStore.ts) and in-memory (memoryStore.ts) store.
  • api/cron/index-tokens.ts is the scheduled ingest entrypoint, authenticated with CRON_SECRET and failing closed in production when unconfigured.
  • api/tokens/index.ts and api/tokens/[address].ts serve the paginated query surface the issue asked for; api/health/indexer.ts exposes ingest lag.
  • docs/indexer.md documents the design and — importantly for this issue's acceptance criteria — states the fallback contract explicitly: the indexer is never a source of truth, every value it serves is re-derivable from the chain, and a broken or stale indexer degrades to direct RPC rather than failing reads. Rollback is a feature flag.

Two residual gaps were found during the 2026-08 audit and are tracked separately, because each is a distinct defect rather than unfinished scope on this issue:

Tasks

Acceptance Criteria

  • A design document fills the previously-empty spec (docs/indexer.md plus .kiro/specs/contract-event-indexing/).
  • The all-tokens view is served completely, without the page-cap truncation.
  • The frontend has a documented fallback path to direct RPC when the indexer is unreachable.

Re-verified on 2026-08-19 during the 30-issue codebase audit tracked in ISSUES.md, which excludes this issue as already fixed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26Third CampaignCampaign: Third CampaignapiServerless API under api/auditFrom the ISSUES.md codebase auditbugSomething isn't workingdocumentationImprovements or additions to documentationreleasedseverity: criticalFunds/consensus/permanent-brick risk

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions