Skip to content

fix(testing): stop dropping an explicit proposer index of 0#1157

Merged
tcoratger merged 1 commit into
leanEthereum:mainfrom
tcoratger:fix-proposer-index-zero
Jun 18, 2026
Merged

fix(testing): stop dropping an explicit proposer index of 0#1157
tcoratger merged 1 commit into
leanEthereum:mainfrom
tcoratger:fix-proposer-index-zero

Conversation

@tcoratger

Copy link
Copy Markdown
Collaborator

Summary

BlockSpec.resolve_proposer_index used self.proposer_index or ValidatorIndex.proposer_for_slot(...). Because ValidatorIndex subclasses int with no __bool__, ValidatorIndex(0) is falsy (verified: ValidatorIndex(0) or 99 == 99), so a BlockSpec that explicitly pins proposer 0 was silently discarded and replaced by the round-robin default — a silently-wrong block.

Replaced the truthiness fallback with an explicit is not None check. The field is typed ValidatorIndex | None, so this is exact.

Latent today (no current vector pins proposer 0 via BlockSpec); behavior fix. Vectors that never pin proposer 0 are byte-identical. Found in the packages/testing audit (TYPES-01).

Lint: ruff check + ruff format clean.

resolve_proposer_index used `self.proposer_index or <default>`, but ValidatorIndex
subclasses int with no __bool__, so ValidatorIndex(0) is falsy and a proposer pinned to
validator 0 was silently replaced by the round-robin default. Use an explicit None check.
Vectors that never pin proposer 0 are unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@tcoratger tcoratger merged commit baa8ed4 into leanEthereum:main Jun 18, 2026
14 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.

1 participant