Skip to content

Add event replay API for re-indexing specific ledger ranges - #2

Open
oluwaseyi1996-netizen wants to merge 9 commits into
mainfrom
feature/event-replay-api
Open

Add event replay API for re-indexing specific ledger ranges#2
oluwaseyi1996-netizen wants to merge 9 commits into
mainfrom
feature/event-replay-api

Conversation

@oluwaseyi1996-netizen

Copy link
Copy Markdown
Owner
  • Implement POST /v1/admin/replay endpoint with validation
  • Add API key authentication and advisory lock check
  • Implement background replay job with idempotency using ON CONFLICT DO NOTHING
  • Add soroban_pulse_replay_jobs_total metrics counter
  • Add comprehensive tests for validation and authentication
  • Update OpenAPI documentation with admin endpoints
  • Validate ledger range (from_ledger <= to_ledger, max 10,000 ledgers)
  • Return 403 if current replica is not the active indexer
  • Support both Authorization: Bearer and X-Api-Key authentication headers

Fixes Soroban-Pulse#207

Summary

Related Issue

Closes #

Changes

Testing

  • cargo test passes
  • cargo clippy reports no warnings
  • Manually tested locally

Notes

CLOSES Soroban-Pulse#207

Alice and others added 9 commits April 26, 2026 17:29
…#193)

Transaction hashes from blockchain explorers are often uppercase or
mixed-case. Rather than rejecting them with 400, normalize to lowercase
before validation and querying so clients can copy-paste hashes freely.

- validate_tx_hash now accepts both uppercase and lowercase hex chars
- get_events_by_tx calls to_lowercase() before validation and querying
- OpenAPI doc updated: hashes are case-insensitive
- Replaced tx_hash_uppercase_hex_returns_400 test with normalization tests
- Added mixed-case normalization test

Closes Soroban-Pulse#193
…e#192)

Adds a CI job that validates the generated OpenAPI spec and ensures
docs/openapi.json stays in sync with the code.

- Add src/bin/dump_openapi.rs: binary that dumps the utoipa-generated
  spec to stdout, usable in CI without starting the server
- Commit docs/openapi.json: generated spec checked into the repo so
  spec changes are visible in PR diffs (like cargo fmt --check)
- Add 'openapi' CI job to .github/workflows/ci.yml:
  - Builds dump_openapi binary
  - Validates spec with @stoplight/spectral-cli@6.11.1 (pinned)
  - Fails if docs/openapi.json does not match the generated spec
- Fix pre-existing compile errors across handlers.rs, routes.rs,
  metrics.rs, middleware.rs, models.rs, db.rs, main.rs

Closes Soroban-Pulse#192
…ase-normalization

feat: normalize tx_hash to lowercase before validation (Soroban-Pulse#193)
…pec-ci

feat: add OpenAPI spec CI validation and committed spec (Soroban-Pulse#192)
- Implement POST /v1/admin/replay endpoint with validation
- Add API key authentication and advisory lock check
- Implement background replay job with idempotency using ON CONFLICT DO NOTHING
- Add soroban_pulse_replay_jobs_total metrics counter
- Add comprehensive tests for validation and authentication
- Update OpenAPI documentation with admin endpoints
- Validate ledger range (from_ledger <= to_ledger, max 10,000 ledgers)
- Return 403 if current replica is not the active indexer
- Support both Authorization: Bearer and X-Api-Key authentication headers

Fixes Soroban-Pulse#207
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.

Add event replay API for re-indexing specific ledger ranges

3 participants