Skip to content

Support configurable merged-blocks bundle size#59

Merged
sduchesneau merged 4 commits into
developfrom
feature/variable-bundle-size
Jul 7, 2026
Merged

Support configurable merged-blocks bundle size#59
sduchesneau merged 4 commits into
developfrom
feature/variable-bundle-size

Conversation

@sduchesneau

Copy link
Copy Markdown
Contributor

Make the merged-blocks bundle size configurable instead of hardcoded 100.

Added

  • DefaultMergedBlocksBundleSize: package variable (default 100) controlling blocks-per-merged-file assumed by readers when no explicit size is given. Set once at process startup (like GetProtocolFirstStreamableBlock).
  • stream.WithMergedBlocksBundleSize: stream option to set the bundle size for a single stream (overrides the process-wide default; used by substreams tier2 which serves multiple chains at once).
  • FileSource fails fast with a clear error when a merged-blocks file contains a block beyond the configured bundle size.

Changed

  • ForkableHub bootstrap rounds its lowest kept block down to the configured bundle size instead of a hardcoded 100.

Related

Base of the variable-bundle-size series:

  • streamingfast/substreams feature/variable-bundle-size (pins this commit)
  • streamingfast/firehose-core feature/variable-bundle-size
  • streamingfast/firehose-ethereum feature/variable-bundle-size

Merge order: this → substreams → firehose-core → firehose-ethereum.

sduchesneau and others added 2 commits July 5, 2026 14:49
Adds DefaultMergedBlocksBundleSize (process-wide default, like
GetProtocolFirstStreamableBlock) and stream.WithMergedBlocksBundleSize
for per-stream override. FileSource now errors out when a file contains
blocks beyond the configured bundle size. Hub bootstrap rounding follows
the configured size.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@UlysseCorbeil UlysseCorbeil requested review from UlysseCorbeil and removed request for UlysseCorbeil July 6, 2026 18:56
Comment thread hub/hub.go
out = blknum - sub
}
out = out / 100 * 100
out = out / bundleSize * bundleSize

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is it "possible" to have bundleSize of 0, in config

FileSourceErrorOnMissingMergedBlocksFile called Shutdown() the moment
the walker hit a missing file. Shutdown() fires Terminating() right away,
so the consuming loop and the per-file reader goroutines abort mid-flight
and discard blocks from files that were already read but not yet
processed, truncating the output.

Push the error through the ordered fileStream like the stop-block path
does, so the consumer drains every queued block first and only then
surfaces the missing-file error.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sduchesneau sduchesneau merged commit 487b289 into develop Jul 7, 2026
3 checks passed
@sduchesneau sduchesneau deleted the feature/variable-bundle-size branch July 7, 2026 15:03
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