Skip to content

feat(indexer): recover missing blocks#488

Open
stanlou wants to merge 4 commits intodevelopfrom
feat/indexer-recover-blocks
Open

feat(indexer): recover missing blocks#488
stanlou wants to merge 4 commits intodevelopfrom
feat/indexer-recover-blocks

Conversation

@stanlou
Copy link
Copy Markdown
Collaborator

@stanlou stanlou commented Apr 2, 2026

closes #480

@stanlou stanlou requested a review from rpanic April 2, 2026 13:43
Comment thread packages/indexer/src/tasks/IndexBlockTask.ts Outdated
this.indexMissingBlocksTask.name,
serialized
);
} catch (error) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's leave that to the queue implementation to handle errors that come from this. Generally, catching stuff early and not handling it (just emitting it is not handling it imo) lead to weird and non-recoverable behaviour.
Throwing stuff is okay, sometimes stuff just breaks down, but then the sequencer should crash and restart.
At least that's the ideal philosophy I try to approach these things nowadays. Idk I just thought I'd share this - here it's definitely not missing critical so it might be unwise to let the sequencer crash because of a peripherial system. Yeah idk let's talk about it more i guess

Comment thread packages/indexer/src/IndexerNotifier.ts Outdated
const currentHeight = await this.blockRepository.getCurrentBlockHeight();

if (incomingHeight > currentHeight) {
if (firstBlockHeight > currentHeight) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, I'd like a few comments here on why this works (internal consistency given by the DB) bcs that fact is not immediately apparent

input: IndexBlockTaskParameters[]
): Promise<IndexBlockResult> {
const incomingHeight = Number(input.block.height.toBigInt());
const firstBlockHeight = Number(input[0].block.height.toBigInt());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here - do we have the gurantee that those are in-order?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have two scenarios here:

  • In normal indexing, we only receive a single block.
  • If we receive multiple blocks, it means we’re indexing missing blocks that were generated using Array.from()

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.

Indexer: Recovery missing blocks

2 participants