This repository was archived by the owner on Sep 8, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +11
-4
lines changed Expand file tree Collapse file tree 4 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -232,14 +232,16 @@ def get_active_validator_indices(validators: Sequence['ValidatorRecord']) -> Tup
232232def _get_shards_and_committees_for_shard_indices (
233233 shard_indices : Sequence [Sequence [int ]],
234234 start_shard : int ,
235+ total_validator_count : int ,
235236 shard_count : int ) -> Iterable [ShardCommittee ]:
236237 """
237238 Returns filled [ShardCommittee] tuple.
238239 """
239240 for index , indices in enumerate (shard_indices ):
240241 yield ShardCommittee (
241242 shard = (start_shard + index ) % shard_count ,
242- committee = indices
243+ committee = indices ,
244+ total_validator_count = total_validator_count ,
243245 )
244246
245247
@@ -312,6 +314,7 @@ def get_new_shuffling(*,
312314 yield _get_shards_and_committees_for_shard_indices (
313315 shard_indices ,
314316 start_shard ,
317+ active_validators_size ,
315318 shard_count ,
316319 )
317320
Original file line number Diff line number Diff line change @@ -22,15 +22,17 @@ class ShardCommittee(rlp.Serializable):
2222 ('shard' , uint64 ),
2323 # Validator indices
2424 ('committee' , CountableList (uint24 )),
25+ # Total validator count (for proofs of custody)
26+ ('total_validator_count' , uint64 ),
2527 ]
2628
2729 def __init__ (self ,
2830 shard : int ,
29- committee : Sequence [int ])-> None :
30- if committee is None :
31- committee = ()
31+ committee : Sequence [int ],
32+ total_validator_count : int )-> None :
3233
3334 super ().__init__ (
3435 shard = shard ,
3536 committee = committee ,
37+ total_validator_count = total_validator_count ,
3638 )
Original file line number Diff line number Diff line change @@ -188,6 +188,7 @@ def sample_shard_committee_params():
188188 return {
189189 'shard' : 10 ,
190190 'committee' : (1 , 3 , 5 ),
191+ 'total_validator_count' : 100
191192 }
192193
193194
Original file line number Diff line number Diff line change @@ -7,3 +7,4 @@ def test_defaults(sample_shard_committee_params):
77 shard_committee = ShardCommittee (** sample_shard_committee_params )
88 assert shard_committee .shard == sample_shard_committee_params ['shard' ]
99 assert shard_committee .committee == sample_shard_committee_params ['committee' ]
10+ assert shard_committee .total_validator_count == sample_shard_committee_params ['total_validator_count' ]
You can’t perform that action at this time.
0 commit comments