Misc fixes of `get_next_epoch_crosslink_committees`
This commit is contained in:
parent
4cdb66728a
commit
378e1ba9a6
|
@ -833,7 +833,7 @@ def get_next_epoch_committee_count(state: BeaconState) -> int:
|
||||||
```python
|
```python
|
||||||
def get_crosslink_committees_at_slot(state: BeaconState,
|
def get_crosslink_committees_at_slot(state: BeaconState,
|
||||||
slot: SlotNumber,
|
slot: SlotNumber,
|
||||||
registry_change=False: bool) -> List[Tuple[List[ValidatorIndex], ShardNumber]]:
|
registry_change: bool=False) -> List[Tuple[List[ValidatorIndex], ShardNumber]]:
|
||||||
"""
|
"""
|
||||||
Return the list of ``(committee, shard)`` tuples for the ``slot``.
|
Return the list of ``(committee, shard)`` tuples for the ``slot``.
|
||||||
|
|
||||||
|
|
|
@ -345,15 +345,23 @@ Either (2) or (3) occurs if (1) fails. The choice between (2) and (3) is determi
|
||||||
|
|
||||||
```python
|
```python
|
||||||
def get_next_epoch_crosslink_committees(state: BeaconState,
|
def get_next_epoch_crosslink_committees(state: BeaconState,
|
||||||
validator_index: ValidatorIndex) -> List[Tuple[ValidatorIndex], ShardNumber]:
|
validator_index: ValidatorIndex) -> List[Tuple[List[ValidatorIndex], ShardNumber]]:
|
||||||
current_epoch = get_current_epoch(state)
|
current_epoch = get_current_epoch(state)
|
||||||
next_epoch = current_epoch + 1
|
next_epoch = current_epoch + 1
|
||||||
next_epoch_start_slot = get_epoch_start_slot(next_epoch)
|
next_epoch_start_slot = get_epoch_start_slot(next_epoch)
|
||||||
potential_committees = []
|
potential_committees = []
|
||||||
for validator_registry in [False, True]:
|
for registry_change in [False, True]:
|
||||||
for slot in range(next_epoch_start_slot, next_epoch_start_slot + EPOCH_LENGTH):
|
for slot in range(next_epoch_start_slot, next_epoch_start_slot + EPOCH_LENGTH):
|
||||||
shard_committees = get_crosslink_committees_at_slot(state, slot, validator_registry)
|
crosslink_committees = get_crosslink_committees_at_slot(
|
||||||
selected_committees = [committee for committee in shard_committees if validator_index in committee[0]]
|
state,
|
||||||
|
slot,
|
||||||
|
registry_change=registry_change,
|
||||||
|
)
|
||||||
|
selected_committees = [
|
||||||
|
committee # type: Tuple[List[ValidatorIndex], ShardNumber]
|
||||||
|
for committee in crosslink_committees
|
||||||
|
if validator_index in committee[0]
|
||||||
|
]
|
||||||
if len(selected_committees) > 0:
|
if len(selected_committees) > 0:
|
||||||
potential_assignments.append(selected_committees)
|
potential_assignments.append(selected_committees)
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue