Update comments
This commit is contained in:
parent
c877d142bd
commit
12593e8782
|
@ -129,8 +129,7 @@ def eth2_fast_aggregate_verify(pubkeys: Sequence[BLSPubkey], message: Bytes32, s
|
||||||
```python
|
```python
|
||||||
def get_sync_committee_indices(state: BeaconState, epoch: Epoch) -> Sequence[ValidatorIndex]:
|
def get_sync_committee_indices(state: BeaconState, epoch: Epoch) -> Sequence[ValidatorIndex]:
|
||||||
"""
|
"""
|
||||||
Return the sync committee indices for a given state and epoch.
|
Return the sequence of sync committee indices (which may include duplicate indices) for a given state and epoch.
|
||||||
Note that there may be duplicate indices in the resulting list.
|
|
||||||
"""
|
"""
|
||||||
MAX_RANDOM_BYTE = 2**8 - 1
|
MAX_RANDOM_BYTE = 2**8 - 1
|
||||||
base_epoch = Epoch((max(epoch // EPOCHS_PER_SYNC_COMMITTEE_PERIOD, 1) - 1) * EPOCHS_PER_SYNC_COMMITTEE_PERIOD)
|
base_epoch = Epoch((max(epoch // EPOCHS_PER_SYNC_COMMITTEE_PERIOD, 1) - 1) * EPOCHS_PER_SYNC_COMMITTEE_PERIOD)
|
||||||
|
@ -144,7 +143,7 @@ def get_sync_committee_indices(state: BeaconState, epoch: Epoch) -> Sequence[Val
|
||||||
candidate_index = active_validator_indices[shuffled_index]
|
candidate_index = active_validator_indices[shuffled_index]
|
||||||
random_byte = hash(seed + uint_to_bytes(uint64(i // 32)))[i % 32]
|
random_byte = hash(seed + uint_to_bytes(uint64(i // 32)))[i % 32]
|
||||||
effective_balance = state.validators[candidate_index].effective_balance
|
effective_balance = state.validators[candidate_index].effective_balance
|
||||||
if effective_balance * MAX_RANDOM_BYTE >= MAX_EFFECTIVE_BALANCE * random_byte:
|
if effective_balance * MAX_RANDOM_BYTE >= MAX_EFFECTIVE_BALANCE * random_byte: # Sample with replacement
|
||||||
sync_committee_indices.append(candidate_index)
|
sync_committee_indices.append(candidate_index)
|
||||||
i += 1
|
i += 1
|
||||||
return sync_committee_indices
|
return sync_committee_indices
|
||||||
|
|
Loading…
Reference in New Issue