Fix bugs—thanks @hwwhww

This commit is contained in:
Justin 2020-11-15 17:23:44 +00:00 committed by GitHub
parent e7d52d9056
commit 114e388d12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -130,14 +130,14 @@ def get_sync_committee_indices(state: BeaconState, epoch: Epoch) -> Sequence[Val
""" """
Return the sync committee indices for a given state and epoch. Return the sync committee indices for a given state and epoch.
""" """
start_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)
active_validator_count = uint64(len(get_active_validator_indices(state, start_epoch))) active_validator_count = uint64(len(get_active_validator_indices(state, base_epoch)))
sync_committee_size = min(active_validator_count, MAX_SYNC_COMMITTEE_SIZE) sync_committee_size = min(active_validator_count, MAX_SYNC_COMMITTEE_SIZE)
seed = get_seed(state, base_epoch, DOMAIN_SYNC_COMMITTEE) seed = get_seed(state, base_epoch, DOMAIN_SYNC_COMMITTEE)
return [compute_shuffled_index(uint64(i), active_validator_count, seed) for i in range(sync_committee_size)] return [compute_shuffled_index(uint64(i), active_validator_count, seed) for i in range(sync_committee_size)]
``` ```
### `get_sync_committee` #### `get_sync_committee`
```python ```python
def get_sync_committee(state: BeaconState, epoch: Epoch) -> SyncCommittee: def get_sync_committee(state: BeaconState, epoch: Epoch) -> SyncCommittee:
@ -148,7 +148,7 @@ def get_sync_committee(state: BeaconState, epoch: Epoch) -> SyncCommittee:
validators = [state.validators[index] for index in indices] validators = [state.validators[index] for index in indices]
pubkeys = [validator.pubkey for validator in validators] pubkeys = [validator.pubkey for validator in validators]
compact_validators = [compactify_validator(i, v.slashed, v.effective_balance) for i, v in zip(indices, validators)] compact_validators = [compactify_validator(i, v.slashed, v.effective_balance) for i, v in zip(indices, validators)]
return SyncCommittee(pubkeys, bls.AggregatePubkeys(pubkeys), compact_validators) return SyncCommittee(pubkeys, bls.AggregatePKs(pubkeys), compact_validators)
``` ```
### Block processing ### Block processing