Repository navigation
fix(indexer): apply the rest of a block delivered in two parts - #79
Merged
Merged
Conversation
GetActionsReader can hand one block over twice: when a 100-action batch ends inside the block, or when one contract's get_actions saw the block and another's didn't yet. Both parts carry the same synthetic hash, and handleBlock skipped any block whose number and hash matched the last one processed, so the second part was dropped for good (the reader had already advanced its seq cursor and seen-set). Prod hit it on 2026-10-14: block 437155575's cambiatus.tk::transfer was indexed, its cambiatus.cm::transfersale was skipped, and that order is missing from Postgres. Skip a repeated block only when it carries no actions. Applying the second part is safe: the reader never re-sends an action it has seen, and every updater is ledgered on global_action_seq. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The indexer silently dropped the second part of a block that
GetActionsReaderhanded over in two parts.How a block gets split:
get_actionsbatch ends inside the block; orBoth parts carry the same synthetic hash (
synthetic-N).GetActionsHandler.handleBlockskipped any block whose number and hash matched the last processed one, so the second part never reached the updaters. The reader had already advanced its seq cursor and seen-set, so nothing re-read it. No error was logged.Prod hit it. On 2026-10-14 at 11:58 UTC, in block 437155575, the
cambiatus.tk::transferwas indexed and itscambiatus.cm::transfersalewas skipped. In the prod DB that block has 1 transfer and 0 orders. The pm2 logs show 1 split in about 330 action blocks over the last 3 weeks. Older logs are rotated away. Repairing that order is a separate decision; this PR doesn't touch data.Fix
handleBlockskips a repeated block only when it carries no actions. Applying the second part is safe:seenGlobalSeqs);global_action_seq(_processed_actions), so a real duplicate would be a no-op anyway.Test plan
test/split_block.test.js(new, no DB):yarn test: 17 passing.yarn formatis clean.mbrclaim, and claims (325) and checks (16) match chain exactly. The reader split 36 blocks in that run; before this fix, a run lost 7 claims this way.🤖 Generated with Claude Code