@@ -217,13 +217,12 @@ def get_attestation_indices(crystallized_state: 'CrystallizedState',
217217@to_tuple
218218def get_active_validator_indices (validators : Sequence ['ValidatorRecord' ]) -> Iterable [int ]:
219219 """
220- Return the active validators.
220+ Gets indices of active validators from ``validators`` .
221221 """
222- o = []
223- for index , validator in enumerate (validators ):
224- if (validator .status == ValidatorStatusCode .ACTIVE ):
225- o .append (index )
226- return o
222+ return [
223+ i for i , v in enumerate (validators )
224+ if v .status in [ValidatorStatusCode .ACTIVE , ValidatorStatusCode .PENDING_EXIT ]
225+ ]
227226
228227
229228#
@@ -235,7 +234,6 @@ def _get_shards_and_committees_for_shard_indices(
235234 start_shard : int ,
236235 shard_count : int ) -> Iterable [ShardAndCommittee ]:
237236 """
238- FIXME
239237 Returns filled [ShardAndCommittee] tuple.
240238 """
241239 for index , indices in enumerate (shard_indices ):
@@ -255,7 +253,7 @@ def get_new_shuffling(*,
255253 shard_count : int ) -> Iterable [Iterable [ShardAndCommittee ]]:
256254 """
257255 Return shuffled ``shard_and_committee_for_slots`` (``[[ShardAndCommittee]]``) of
258- the given active ``validators``.
256+ the given active ``validators`` using ``seed`` as entropy .
259257
260258 Two-dimensional:
261259 The first layer is ``slot`` number
@@ -302,9 +300,10 @@ def get_new_shuffling(*,
302300 shard_count // cycle_length ,
303301 active_validators_size // cycle_length // target_committee_size ,
304302 )
303+ # Shuffle with seed
305304 shuffled_active_validator_indices = shuffle (active_validators , seed )
306305
307- # Split the shuffled list into cycle_length pieces
306+ # Split the shuffled list into epoch_length pieces
308307 validators_per_slot = split (shuffled_active_validator_indices , cycle_length )
309308 for index , slot_indices in enumerate (validators_per_slot ):
310309 # Split the shuffled list into committees_per_slot pieces
0 commit comments