Skip to content

fix(indexer): guarantee projection idempotency for concurrent/out-of-order replays - #1439

Open
aurorabini wants to merge 1 commit into
Akanimoh12:test-implement-dripsfrom
aurorabini:fix/issue-1260-idempotency
Open

fix(indexer): guarantee projection idempotency for concurrent/out-of-order replays#1439
aurorabini wants to merge 1 commit into
Akanimoh12:test-implement-dripsfrom
aurorabini:fix/issue-1260-idempotency

Conversation

@aurorabini

Copy link
Copy Markdown

Summary

Guarantees indexer projection idempotency (issue #1260). PRs, backfill (#1259), and other recovery paths depend on this.

  • EventLog dedup guard: persistEventLog now treats a P2002 unique-constraint violation (txHash, topic, ledger) as a replay instead of propagating — so two workers processing the same ledger range concurrently can't double-count.
  • Exhaustive double-processing test: a new tests/idempotency.test.ts processes every fixture event twice and asserts identical aggregate state across all projection tables (Tip, Refund, User, Goal, Subscription, CreditScore, CreditScoreHistory, EventLog).
  • Out-of-order delivery covered: fixtures replayed in reverse ledger order produce no duplicate rows.
  • Concurrent replay covered: duplicate inserts raced via Promise.all leave exactly one row per event.

Closes #1260

…order replays

Harden EventLog persistence against the P2002 race when two workers replay
the same ledger range, and prove idempotency with an exhaustive test that
processes every fixture event twice and asserts identical state, plus
concurrent-replay and out-of-order delivery coverage.

Closes Akanimoh12#1260
@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

@aurorabini Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Guarantee indexer projection idempotency

1 participant