Skip to content

tools check merged-blocks: add --validate-block-count - #357

Open
matthewdarwin wants to merge 3 commits into
streamingfast:developfrom
pinax-network:feat/check-hide-short-segments
Open

matthewdarwin wants to merge 3 commits into
streamingfast:developfrom
pinax-network:feat/check-hide-short-segments

Conversation

@matthewdarwin

@matthewdarwin matthewdarwin commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

What

tools check merged-blocks --validate-blocks prints 🔶 Segment <file> contained only N blocks (< 100), this can happen on some chains for every merged-blocks file holding fewer blocks than the bundle size. On chains that skip block numbers, Solana for example (skipped slots), nearly every file is short. A full-chain run then prints hundreds of thousands of these lines, and the real findings (holes, unlinkable blocks, bundle-boundary problems) are hard to spot.

--validate-block-count (MergedBlocksCheckOptions.ValidateBlockCount) controls that check.

  • CLI: it defaults to true, so the output is unchanged unless an operator passes --validate-block-count=false on a chain where short files are expected.
  • Unchanged either way: holes, unlinkable blocks and bundle-boundary problems are still reported and summarized.
  • Direct callers of check.CheckMergedBlocksWithOptions: the field is false when left unset, so they need ValidateBlockCount: true to keep the line. The deprecated check.CheckMergedBlocks sets it. The CHANGELOG entry says so. Within firehose-core the only callers are the CLI and that wrapper.

Tests

TestCheckMergedBlocks_ValidateBlockCount uses a store with a short file whose blocks skip numbers but still link, and a bloated file.

  • With ValidateBlockCount: true, the short-file line is printed.
  • Without it, the line isn't printed. The bloated file is still reported, and the skipped block numbers are not treated as holes.

go test -race ./cmd/tools/check/, go vet and gofmt pass. firecore tools check merged-blocks --help shows the flag with (default true).

Independent of #356 (--parallel), which moves this line into segment.go; whichever merges second needs a one-line rebase.

🤖 Generated with Claude Code

Drops the "Segment ... contained only N blocks" line printed for each
merged-blocks file holding fewer blocks than the bundle size. On chains
that skip block numbers (Solana skips slots) nearly every file is short
and the line drowns the real findings. Off by default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@maoueh maoueh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would like a better name, not sure exactly of the name, but I'm not finding this naming clear enough.

The name like this felt like short holes wouldn't be reported. It could be inverted also maybe an be ValidateBlockCount true

…lock-count

The short-segment line is now an option that is on by default
(--validate-block-count, MergedBlocksCheckOptions.ValidateBlockCount), turned
off with --validate-block-count=false, so the name says what is checked rather
than reading like holes would be hidden. The deprecated CheckMergedBlocks sets it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@matthewdarwin matthewdarwin changed the title tools check merged-blocks: add --hide-short-segments tools check merged-blocks: add --validate-block-count Nov 19, 2026
@matthewdarwin

Copy link
Copy Markdown
Contributor Author

Thanks, good point: the name read as if short holes would be hidden. I inverted it as you suggested. It's now --validate-block-count / MergedBlocksCheckOptions.ValidateBlockCount, on by default in the CLI, and --validate-block-count=false turns the short-segment line off. Holes are reported either way. The deprecated CheckMergedBlocks sets it to true. Anyone calling CheckMergedBlocksWithOptions directly now has to set it to keep the line, which the CHANGELOG notes.

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.

2 participants