Skip to content

[FinChippay/Finchippay-Solution] Issue #64 — Event Ingestion Idempotency & Replayable Cursor (Issue #633) - #661

Open
Jaamaldeen wants to merge 1 commit into
FinChippay:mainfrom
Jaamaldeen:fix/event-ingestion-idempotency
Open

[FinChippay/Finchippay-Solution] Issue #64 — Event Ingestion Idempotency & Replayable Cursor (Issue #633)#661
Jaamaldeen wants to merge 1 commit into
FinChippay:mainfrom
Jaamaldeen:fix/event-ingestion-idempotency

Conversation

@Jaamaldeen

Copy link
Copy Markdown

Summary

Makes Horizon/contract event ingestion fully idempotent and replayable by adding atomic cursor persistence with ingestion_batches table, unique deduplication constraints on (ledger_sequence, txn_hash, op_index, event_type), and a new admin replay endpoint. A crash or reorg will no longer double-count or drop payment events.

Closes #633

Type of change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor / chore
  • Smart contract change

Related issue

Issue #64 — Event Ingestion Idempotency & Replayable Cursor
Re: [FinChippay/Finchippay-Solution] #633

Changes

  • Add ingestion_batches table for atomic cursor persistence
  • Add txn_hash and op_index columns to contract_events for deduplication
  • Add unique constraint on (ledger_sequence, txn_hash, op_index, event_type)
  • Update eventIndexer.js to write cursor + events atomically in a single transaction
  • Add replayFrom(from_ledger) function to reprocess history without duplication
  • Create admin replay endpoint POST /api/admin/replay
  • Add GET /api/admin/replay/status to check indexer status
  • Update eventParser.js to extract txn_hash and op_index from raw events
  • Add 13 comprehensive unit tests covering all scenarios
  • All 13 tests passing

Testing

  • Tested locally on Testnet
  • Added/updated unit tests
  • Manually tested UI flow

Checklist

- Add ingestion_batches table for cursor persistence
- Add txn_hash and op_index columns for deduplication
- Update eventIndexer.js with atomic batch transactions
- Add replayFrom() function for admin replay
- Create admin replay endpoint
- Update eventParser.js to extract transaction data
- Add comprehensive tests for idempotency and replay
- All 13 tests passing
@github-actions github-actions Bot added the needs-review PR ready for Greptile AI code review label Aug 17, 2026
@github-actions

Copy link
Copy Markdown

🤖 Greptile AI Code Review

Greptile will automatically review this PR (11 file(s) changed).

Review gates:

  • ✅ CodeQL Security Scan
  • ✅ Custom rules (.greptile/config.json)
  • ✅ Architecture guidelines (.greptile/rules.md)

To manually trigger a re-review, comment @greptileai on this PR.
To skip review, add the skip-review label.

@Jaamaldeen

Copy link
Copy Markdown
Author

@Topmatrixmor2014 please check it out

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

Labels

needs-review PR ready for Greptile AI code review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue #64 — Event Ingestion Idempotency & Replayable Cursor

2 participants