Skip to content

fix(proto): remove unreachable InvalidBlockRange::EmptyRange - #2591

Merged
Mirko-von-Leipzig merged 2 commits into
0xMiden:nextfrom
kutluhaneth46:cursor/fix-unreachable-empty-block-range-88c1
Sep 9, 2026
Merged

Mirko-von-Leipzig merged 2 commits into
0xMiden:nextfrom
kutluhaneth46:cursor/fix-unreachable-empty-block-range-88c1

Conversation

@kutluhaneth46

@kutluhaneth46 kutluhaneth46 commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Fixes bug: InvalidBlockRange::EmptyRange can never be produced #2528: BlockRange::into_inclusive_range no longer has a dead EmptyRange branch.
  • RangeInclusive is empty exactly when start > end, which is already reported as StartGreaterThanEnd, so the EmptyRange variant could never be constructed.
  • Removes the unused variant and adds boundary tests (inverted / single-block / ascending).

Test plan

  • cargo test -p miden-node-proto into_inclusive_range

Changelog

changelog = "none"
reason    = "Internal change only."

RangeInclusive is empty exactly when start > end, which is already
rejected as StartGreaterThanEnd. Drop the dead EmptyRange variant and
add boundary tests for inverted, single-block, and ascending ranges.
@Mirko-von-Leipzig

Copy link
Copy Markdown
Collaborator

@kutluhaneth46 if you could fix the lint errors

@kutluhaneth46

Copy link
Copy Markdown
Contributor Author

Fixed the clippy lint (@Mirko-von-Leipzig): moved block_range_tests below the other items in block.rs so it no longer trips clippy::items-after-test-module. Docker dry-run failures look unrelated (rust:1.98.1-slim-trixie image missing upstream).

@kutluhaneth46

Copy link
Copy Markdown
Contributor Author

Follow-up: the clippy items-after-test-module fix is now pushed (2e9b01b) — block_range_tests moved to the end of crates/proto/src/domain/block.rs after the remaining items.

@Mirko-von-Leipzig
Mirko-von-Leipzig enabled auto-merge (squash) September 9, 2026 05:56
@Mirko-von-Leipzig
Mirko-von-Leipzig merged commit 5992676 into 0xMiden:next Sep 9, 2026
20 checks passed
@kutluhaneth46

Copy link
Copy Markdown
Contributor Author

Thanks for the review and merge, @Mirko-von-Leipzig.

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.

bug: InvalidBlockRange::EmptyRange can never be produced

2 participants