Skip to content

Add Soroban event ingestion idempotency key derived from txHash and ledger in src/services/eventProcessor.ts #470

Description

@1nonlypiece

Add Soroban event ingestion idempotency key derived from txHash and ledger in src/services/eventProcessor.ts

Description

src/services/eventProcessor.ts writes events to the processed_events table (db/migrations/20260225220000_create_processed_events.cjs) but does not derive the idempotency key from txHash:ledger:eventIndex, leaving duplicate-event detection brittle. Compute and persist a canonical key as a unique index so retries cannot insert duplicates.

Requirements and context

  • Must be secure, tested, and documented
  • Should be efficient and easy to review
  • New Knex migration adding event_key text unique not null
  • Backfill existing rows where possible
  • Update src/services/eventProcessor.ts and src/services/eventParser.ts
  • Add src/tests/eventProcessor.idempotency.test.ts
  • Update docs/event-processing.md

Suggested execution

  • Fork the repo and create a branch
  • git checkout -b feat/event-key-idempotency
  • Implement changes
    • Add migration and backfill script
    • Update processor and parser
    • Add tests and docs
  • Test and commit
    • Run npm run migrate:latest && npm test
    • Include test output and notes

Example commit message

feat: canonical idempotency key for Soroban events

Guidelines

  • Minimum 95 percent test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbackendDisciplr API serverdatabaseintegrationCross-service integration

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions