@@ -138,25 +138,6 @@ def get_hashes_to_sign(latest_block_hashes: Sequence[Hash32],
138138 yield block .hash
139139
140140
141- @to_tuple
142- def get_signed_parent_hashes (latest_block_hashes : Sequence [Hash32 ],
143- block : 'BaseBeaconBlock' ,
144- attestation : 'AttestationRecord' ,
145- epoch_length : int ) -> Iterable [Hash32 ]:
146- """
147- Given an attestation and the block they were included in,
148- the list of hashes that were included in the signature.
149- """
150- yield from get_hashes_from_latest_block_hashes (
151- latest_block_hashes ,
152- block .slot ,
153- from_slot = attestation .slot - epoch_length + 1 ,
154- to_slot = attestation .slot - len (attestation .oblique_parent_hashes ),
155- epoch_length = epoch_length ,
156- )
157- yield from attestation .oblique_parent_hashes
158-
159-
160141@to_tuple
161142def get_new_latest_block_hashes (old_block_hashes : Sequence [Hash32 ],
162143 parent_slot : int ,
@@ -199,7 +180,7 @@ def get_shard_committees_at_slot(state: 'BeaconState',
199180 slot : int ,
200181 epoch_length : int ) -> Tuple [ShardCommittee ]:
201182 """
202- Returns the ``ShardCommittee`` for the ``slot``.
183+ Return the ``ShardCommittee`` for the ``slot``.
203184 """
204185 return _get_shard_committees_at_slot (
205186 latest_state_recalculation_slot = state .latest_state_recalculation_slot ,
@@ -209,30 +190,9 @@ def get_shard_committees_at_slot(state: 'BeaconState',
209190 )
210191
211192
212- @to_tuple
213- def get_attestation_indices (crystallized_state : 'CrystallizedState' ,
214- attestation : 'AttestationRecord' ,
215- epoch_length : int ) -> Iterable [int ]:
216- """
217- FIXME
218- Return committee of the given attestation.
219- """
220- shard_id = attestation .shard_id
221-
222- shards_committees_for_slot = get_shard_committees_at_slot (
223- crystallized_state ,
224- attestation .slot ,
225- epoch_length ,
226- )
227-
228- for shard_committee in shards_committees_for_slot :
229- if shard_committee .shard_id == shard_id :
230- yield from shard_committee .committee
231-
232-
233193def get_active_validator_indices (validators : Sequence ['ValidatorRecord' ]) -> Tuple [int , ...]:
234194 """
235- Gets indices of active validators from ``validators``.
195+ Get indices of active validators from ``validators``.
236196 """
237197 return tuple (
238198 i for i , v in enumerate (validators )
@@ -250,7 +210,7 @@ def _get_shards_committees_for_shard_indices(
250210 total_validator_count : int ,
251211 shard_count : int ) -> Iterable [ShardCommittee ]:
252212 """
253- Returns filled [ShardCommittee] tuple.
213+ Return filled [ShardCommittee] tuple.
254214 """
255215 for index , indices in enumerate (shard_indices ):
256216 yield ShardCommittee (
@@ -383,7 +343,7 @@ def get_beacon_proposer_index(state: 'BeaconState',
383343 slot : int ,
384344 epoch_length : int ) -> int :
385345 """
386- Returns the beacon proposer index for the ``slot``.
346+ Return the beacon proposer index for the ``slot``.
387347 """
388348 shard_committees = get_shard_committees_at_slot (
389349 state ,
@@ -408,14 +368,6 @@ def get_beacon_proposer_index(state: 'BeaconState',
408368#
409369# Bitfields
410370#
411- @to_tuple
412- def _get_shard_committees (shard_committees : Sequence [ShardCommittee ],
413- shard : int ) -> Iterable [ShardCommittee ]:
414- for item in shard_committees :
415- if item .shard == shard :
416- yield item
417-
418-
419371@to_tuple
420372def get_attestation_participants (state : 'BeaconState' ,
421373 slot : int ,
@@ -427,14 +379,21 @@ def get_attestation_participants(state: 'BeaconState',
427379 from ``participation_bitfield``.
428380 """
429381 # Find the relevant committee
430- shard_committees = _get_shard_committees (
431- shard_committees = get_shard_committees_at_slot (
432- state ,
433- slot ,
434- epoch_length ,
435- ),
436- shard = shard ,
382+ # Filter by slot
383+ shard_committees_at_slot = get_shard_committees_at_slot (
384+ state ,
385+ slot ,
386+ epoch_length ,
387+ )
388+ # Filter by shard
389+ shard_committees = tuple (
390+ [
391+ shard_committee
392+ for shard_committee in shard_committees_at_slot
393+ if shard_committee .shard == shard
394+ ]
437395 )
396+
438397 try :
439398 shard_committee = shard_committees [0 ]
440399 except IndexError :
0 commit comments