Skip to content

Implement seamless ledger re-org handling in the indexing engine #416

Description

@Fatimasanusi

Description

Blockchain network re-organizations can invalidate previously indexed events, resulting in the backend displaying phantom fractional shares.

Architecture & Context

The indexing engine must maintain a rolling window of "unfinalized" blocks. If a ledger sequence diverges from the expected hash, the backend must systematically rollback database mutations up to the common ancestor and replay the correct events.

Technical Requirements

  • Track ledger_hash and previous_ledger_hash in the database.
  • Implement a rollback function that deletes events linked to orphaned ledgers.
  • Automatically trigger the re-sync pipeline upon detecting a hash mismatch.

Acceptance Criteria

  • Simulated chain re-org correctly purges invalid database rows.
  • System automatically recovers and syncs the new canonical chain.
  • Client APIs temporarily return a 503 Service Unavailable during rollback.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions