From eaae70b3b376a9ebf5949156365503a77d050241 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Tue, 30 Jun 2020 17:16:48 +0800 Subject: [PATCH] Minor refactoring --- specs/phase1/beacon-chain.md | 2 +- specs/phase1/custody-game.md | 3 +-- specs/phase1/validator.md | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/specs/phase1/beacon-chain.md b/specs/phase1/beacon-chain.md index c3ae4102e..6e7433758 100644 --- a/specs/phase1/beacon-chain.md +++ b/specs/phase1/beacon-chain.md @@ -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` diff --git a/specs/phase1/custody-game.md b/specs/phase1/custody-game.md index e454e28c0..8bcfc0433 100644 --- a/specs/phase1/custody-game.md +++ b/specs/phase1/custody-game.md @@ -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 diff --git a/specs/phase1/validator.md b/specs/phase1/validator.md index 130765268..954193d25 100644 --- a/specs/phase1/validator.md +++ b/specs/phase1/validator.md @@ -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