Skip to content

Implement Idempotent Sync LogicΒ #14

@dDevAhmed

Description

@dDevAhmed

πŸ“š Overview

Blockchain data ingestion must be idempotent by design.

This issue focuses on ensuring that re-running the indexer β€” intentionally or accidentally β€” never corrupts backend state.


🎯 Objectives

Guarantee that:

  • Events are processed once
  • Duplicate executions are harmless
  • Backend state remains deterministic

🧠 Problem Context

Indexers can restart due to:

  • Deployments
  • Crashes
  • Network issues

Without idempotency:

  • Balances drift
  • Rewards double-count
  • Trust is broken

🧩 Technical Scope

1️⃣ Event Uniqueness

Define uniqueness constraints using:

  • txHash
  • logIndex
  • blockNumber

Enforce at DB level.


2️⃣ Processing Guards

  • Check existence before writes
  • Use transactional writes where needed
  • Fail safely on conflicts

3️⃣ Restart Safety

  • Indexer can resume from last processed block
  • Reprocessing same range produces same DB state

βœ… Acceptance Criteria

  • Re-running indexer produces identical state
  • Duplicate events are ignored safely
  • DB constraints enforce uniqueness
  • Tests cover replay scenarios

⏳ Complexity & Effort

Complexity: Medium
Estimated Effort: ~0.5 day


🏷️ Labels

  • backend
  • blockchain-sync
  • idempotency
  • medium-complexity
  • drips-wave

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

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