fix(testing): stop dropping an explicit proposer index of 0#1157
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BlockSpec.resolve_proposer_indexusedself.proposer_index or ValidatorIndex.proposer_for_slot(...). BecauseValidatorIndexsubclassesintwith no__bool__,ValidatorIndex(0)is falsy (verified:ValidatorIndex(0) or 99 == 99), so aBlockSpecthat 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 Nonecheck. The field is typedValidatorIndex | 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 formatclean.