Skip to content

feat(indexer): configure the cold-start ledger - #20

Open
rahulatrkm wants to merge 1 commit into
YieldAnchor:mainfrom
rahulatrkm:feat/configurable-indexer-start-ledger
Open

rahulatrkm wants to merge 1 commit into
YieldAnchor:mainfrom
rahulatrkm:feat/configurable-indexer-start-ledger

Conversation

@rahulatrkm

Copy link
Copy Markdown
Contributor

Closes #7

Change

Add optional INDEXER_START_LEDGER using the existing fallback-and-report configuration parser. It accepts non-negative safe integers, including zero. Unset/blank values use the existing default; invalid values are reported and fall back.

Precedence is explicit: saved checkpoint first, configured ledger only on cold starts, current ledger tip otherwise. Configuration never rewinds or overrides a saved cursor. Logs identify the selected source, and normal response-cursor continuation is preserved. The README and unset environment example document the retention-window limitation.

Verification

Before implementation, 11 parser assertions and six watcher assertions failed. Tests execute the real parser/config/watcher with fake timers and stub RPC/database boundaries, covering zero, invalid inputs, checkpoints ahead of or behind the configured value, default tip lookup and cursor continuation.

  • Full pnpm test: 237 passed, including 43 validation, 42 indexer and 13 contract tests.
  • Full pnpm run typecheck, pnpm run format:check and pnpm run build: passed.
  • pnpm run lint: exit 0, with three pre-existing warnings in unchanged wallet code.
  • git diff --check: passed.

No live RPC backfill or real database test is claimed. Expired events cannot be recovered by this option; the requested ledger must remain inside the provider's retention window. This branch is independent of the other watcher PRs, so test additions may need reconciliation when merging in sequence.

Prepared and tested by GitHub Copilot on behalf of rahulatrkm. Independent human review is not claimed. No bounty or payment claim is attached.

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.

feat: let the indexer start from a chosen ledger so it can backfill missed events

1 participant