Skip to content

fix(indexer): find cached logs missing their transaction in sync-repair - #148

Merged
aminsammara merged 1 commit into
mainfrom
amin/sync-repair-missing-tx
Nov 14, 2026
Merged

aminsammara merged 1 commit into
mainfrom
amin/sync-repair-missing-tx

Conversation

@aminsammara

Copy link
Copy Markdown
Collaborator

Problem

With #147, status shows why the prod atp-indexer-si-v7 builder crash-loops (5,967 restarts, stuck at 37.1%):

ERROR Error while processing event event=ATP:Claimed chain=mainnet block_number=24439439
TypeError: Cannot read properties of undefined (reading 'hash')
    at Object.fn (/app/src/events/atp/claimed.ts:36:33)
Log:
  index     155
  address   0xd2d54780390e655ae7ee2f53e4e02495bbd0735a
Transaction:
  (empty object)
Block:
  number      24439439

The Claimed log for ATP 0xd2d5… is in ponder_sync.logs, and its block is cached, but its transaction row is missing. Ponder builds the event with an empty transaction, so event.transaction.hash throws. This is the same partial-commit damage from the duplicate-pg bug (#140), with the transaction insert lost instead of the block insert. diagnose only looked for missing blocks, which is why the earlier repair (MIN_BAD=26074117) did not cover block 24439439.

The live v4 schema shows the same ATP with totalWithdrawn = 0, although it claimed at this block, so this is also one of the missing claims #138 set out to recover.

Fix

diagnose also reports cached logs with no matching ponder_sync.transactions row (on chain_id, block_number, transaction_index). Factory-discovery logs are excluded, as in the existing check. The repair is unchanged: run repair with the lowest first_block across all three checks.

Testing

The query was run on PGlite against a mock ponder_sync: it reports only the log whose transaction is missing, and skips factory addresses and logs that have their transaction.

The prod builder crash-loops on ATP:Claimed at block 24439439 because the log
for ATP 0xd2d5 is cached with its block but without its transaction, so
event.transaction is undefined. diagnose only looked for missing blocks;
also report logs with no transaction row so MIN_BAD covers these holes.
@aminsammara
aminsammara requested a review from a team as a code owner November 14, 2026 08:02
@aminsammara
aminsammara merged commit 78ba308 into main Nov 14, 2026
5 checks passed
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.

1 participant