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
232
232
def _get_shards_and_committees_for_shard_indices (
233
233
shard_indices : Sequence [Sequence [int ]],
234
234
start_shard : int ,
235
+ total_validator_count : int ,
235
236
shard_count : int ) -> Iterable [ShardCommittee ]:
236
237
"""
237
238
Returns filled [ShardCommittee] tuple.
238
239
"""
239
240
for index , indices in enumerate (shard_indices ):
240
241
yield ShardCommittee (
241
242
shard = (start_shard + index ) % shard_count ,
242
- committee = indices
243
+ committee = indices ,
244
+ total_validator_count = total_validator_count ,
243
245
)
244
246
245
247
@@ -312,6 +314,7 @@ def get_new_shuffling(*,
312
314
yield _get_shards_and_committees_for_shard_indices (
313
315
shard_indices ,
314
316
start_shard ,
317
+ active_validators_size ,
315
318
shard_count ,
316
319
)
317
320
Original file line number Diff line number Diff line change @@ -22,15 +22,17 @@ class ShardCommittee(rlp.Serializable):
22
22
('shard' , uint64 ),
23
23
# Validator indices
24
24
('committee' , CountableList (uint24 )),
25
+ # Total validator count (for proofs of custody)
26
+ ('total_validator_count' , uint64 ),
25
27
]
26
28
27
29
def __init__ (self ,
28
30
shard : int ,
29
- committee : Sequence [int ])-> None :
30
- if committee is None :
31
- committee = ()
31
+ committee : Sequence [int ],
32
+ total_validator_count : int )-> None :
32
33
33
34
super ().__init__ (
34
35
shard = shard ,
35
36
committee = committee ,
37
+ total_validator_count = total_validator_count ,
36
38
)
Original file line number Diff line number Diff line change @@ -188,6 +188,7 @@ def sample_shard_committee_params():
188
188
return {
189
189
'shard' : 10 ,
190
190
'committee' : (1 , 3 , 5 ),
191
+ 'total_validator_count' : 100
191
192
}
192
193
193
194
Original file line number Diff line number Diff line change @@ -7,3 +7,4 @@ def test_defaults(sample_shard_committee_params):
7
7
shard_committee = ShardCommittee (** sample_shard_committee_params )
8
8
assert shard_committee .shard == sample_shard_committee_params ['shard' ]
9
9
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