Skip to content

Fix: Block stream ignoring configured endBlock in specific cases#6474

Merged
dimitrovmaksim merged 2 commits intographprotocol:masterfrom
dimitrovmaksim:fix/end-block-skip-optimization
Apr 1, 2026
Merged

Fix: Block stream ignoring configured endBlock in specific cases#6474
dimitrovmaksim merged 2 commits intographprotocol:masterfrom
dimitrovmaksim:fix/end-block-skip-optimization

Conversation

@dimitrovmaksim
Copy link
Copy Markdown
Member

Fixes two issues that caused subgraphs to scan blocks well beyond their configured endBlock.

  1. Block-skip optimization bypasses max_end_block check when block has no triggers, which causes the block stream to scan for blocks beyond the max end block until another condition is met.
  2. An edge case where max_end_block is set to None when multiple data sources share the same endBlock. max_end_block was computed by comparing data_sources.len() with end_blocks.len(), but end_blocks is a BTreeSet, which removes duplicated values, resulting in data_sources and end_blocks legths to not be equal in this case.

@dimitrovmaksim dimitrovmaksim changed the title Fix/end block skip optimization Fix: Block stream ignoring configured endBlock in specific cases Mar 31, 2026
@dimitrovmaksim dimitrovmaksim self-assigned this Mar 31, 2026
Copy link
Copy Markdown
Collaborator

@lutter lutter left a comment

Choose a reason for hiding this comment

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

Nice!

@dimitrovmaksim dimitrovmaksim force-pushed the fix/end-block-skip-optimization branch from e458193 to eda46fd Compare April 1, 2026 09:56
@dimitrovmaksim dimitrovmaksim merged commit 1d39f7d into graphprotocol:master Apr 1, 2026
6 checks passed
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