Minor refactoring

This commit is contained in:
Hsiao-Wei Wang 2020-06-30 17:16:48 +08:00
parent 96b71a19de
commit eaae70b3b3
No known key found for this signature in database
GPG Key ID: 95B070122902DEA4
3 changed files with 3 additions and 4 deletions

View File

@ -532,7 +532,7 @@ def get_active_shard_count(state: BeaconState) -> uint64:
```python
def get_online_validator_indices(state: BeaconState) -> Set[ValidatorIndex]:
active_validators = get_active_validator_indices(state, get_current_epoch(state))
return set([i for i in active_validators if state.online_countdown[i] != 0])
return set(i for i in active_validators if state.online_countdown[i] != 0) # non-duplicate
```
#### `get_shard_committee`

View File

@ -554,7 +554,6 @@ def process_custody_slashing(state: BeaconState, signed_custody_slashing: Signed
slash_validator(state, custody_slashing.whistleblower_index)
```
## Per-epoch processing
### Handling of reveal deadlines
@ -586,7 +585,7 @@ def process_custody_final_updates(state: BeaconState) -> None:
# Reset withdrawable epochs if challenge records are empty
records = state.custody_chunk_challenge_records
validator_indices_in_records = set([record.responder_index for record in records])
validator_indices_in_records = set(record.responder_index for record in records) # non-duplicate
for index, validator in enumerate(state.validators):
if validator.exit_epoch != FAR_FUTURE_EPOCH:
not_all_secrets_are_revealed = validator.all_custody_secrets_revealed_epoch == FAR_FUTURE_EPOCH

View File

@ -162,7 +162,7 @@ def get_shard_winning_roots(state: BeaconState,
committee = get_beacon_committee(state, on_time_attestation_slot, committee_index)
# Loop over all shard transition roots, looking for a winning root
shard_transition_roots = set([a.data.shard_transition_root for a in shard_attestations])
shard_transition_roots = set(a.data.shard_transition_root for a in shard_attestations) # non-duplicate
for shard_transition_root in sorted(shard_transition_roots):
transition_attestations = [
a for a in shard_attestations