Skip to content

Commit baa8ed4

Browse files
tcoratgerclaude
andauthored
fix(testing): stop dropping an explicit proposer index of 0 (#1157)
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>
1 parent 1ef93a9 commit baa8ed4

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

packages/testing/src/consensus_testing/test_types/block_spec.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ class BlockSpec(CamelModel):
7373

7474
def resolve_proposer_index(self, num_validators: int) -> ValidatorIndex:
7575
"""Return the proposer index, falling back to the spec's round-robin schedule."""
76-
return self.proposer_index or ValidatorIndex.proposer_for_slot(
77-
self.slot, Uint64(num_validators)
78-
)
76+
if self.proposer_index is not None:
77+
return self.proposer_index
78+
return ValidatorIndex.proposer_for_slot(self.slot, Uint64(num_validators))
7979

8080
def resolve_parent_root(
8181
self,

0 commit comments

Comments
 (0)