Skip to content

reorg fill missing blocks#317

Merged
nischitpra merged 1 commit intomainfrom
np/reorg_fill_missing_blocks
Apr 28, 2026
Merged

reorg fill missing blocks#317
nischitpra merged 1 commit intomainfrom
np/reorg_fill_missing_blocks

Conversation

@nischitpra
Copy link
Copy Markdown
Collaborator

@nischitpra nischitpra commented Apr 28, 2026

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Enhanced reorganization detection to gracefully handle missing or incomplete block data
    • Improved error handling to prevent application crashes from invalid block information

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 28, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 48102cb8-b5bc-4e15-8b51-a1c861d611a7

📥 Commits

Reviewing files that changed from the base of the PR and between 4f9cbc4 and c9f4fd1.

📒 Files selected for processing (2)
  • internal/committer/reorg.go
  • internal/libs/clickhouse.go

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


Walkthrough

These changes add defensive nil checks for ClickHouse block headers and enhance reorganization detection logic to identify and handle gaps where block headers are missing within the requested range.

Changes

Cohort / File(s) Summary
Reorg gap detection
internal/committer/reorg.go
Enhanced reorg detection to identify gaps where block headers are nil or contain nil Number fields within the [startBlock, endBlock) range. Records first/last missing block numbers and count, logs warnings, and includes the missing headers range in the inconsistent range. Updated sequential/hash continuity loop to skip nil header entries and modified lastHeaderBlock derivation to only update on non-nil headers.
Nil number safeguard
internal/libs/clickhouse.go
Added nil check for block.Number before dereferencing to prevent nil pointer errors during Uint64() conversion. Logs warning and continues when nil is encountered.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch np/reorg_fill_missing_blocks

Comment @coderabbitai help to get the list of available commands and usage tips.

@nischitpra nischitpra merged commit c3c0665 into main Apr 28, 2026
3 of 4 checks passed
@nischitpra nischitpra deleted the np/reorg_fill_missing_blocks branch April 28, 2026 15:57
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