Skip to content

backend(eventIndexer): quarantine system lacks a mechanism to reprocess or retry quarantined events after bug fix #658

@ogazboiz

Description

@ogazboiz

Join our community: https://t.me/+DOylgFv1jyJlNzM0

Description

backend/src/services/eventIndexer.ts has a quarantine system for malformed or unparseable events. Events that fail parsing are moved to a quarantine table. However, there is no admin endpoint or CLI tool to reprocess quarantined events after the parsing bug is fixed.

This means if a contract upgrade changes the event schema and the parser is later updated to handle the new format, all events quarantined during the gap period remain permanently stuck in quarantine. The database will be missing data for that period.

Expected Behavior

Add an admin endpoint or background job that:

  1. Lists quarantined events (with filter by contract address, event type, date range)
  2. Allows replaying quarantined events through the current parser
  3. On success, moves the event from quarantine to the normal event table
  4. On failure, keeps it in quarantine with an updated retry_count

Suggested Fix

// POST /admin/indexer/reprocess-quarantine
const quarantined = await query('SELECT * FROM quarantine_events WHERE event_type = $1', [eventType]);
for (const event of quarantined.rows) {
  try {
    await processEvent(parseRawEvent(event));
    await query('DELETE FROM quarantine_events WHERE id = $1', [event.id]);
  } catch (err) {
    await query('UPDATE quarantine_events SET retry_count = retry_count + 1 WHERE id = $1', [event.id]);
  }
}

Impact

Medium. Any parser bug that causes event quarantine creates a permanent data gap. Without replay capability, the only fix is a full re-index from genesis, which is expensive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions