Fix bugs—thanks @hwwhww
This commit is contained in:
parent
e7d52d9056
commit
114e388d12
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue