From 750790c78453a864bf8de718ab2f87536d154399 Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Wed, 30 Jan 2019 18:38:12 -0800 Subject: [PATCH 1/5] Remove the unnecessary double backticks on 'validator' in docstring. The usual convention is that we mark function parameters in docstrings with double backticks. There is no (longer a) parameter called 'validator' so we update the docstring to conform to the convention. --- specs/core/0_beacon-chain.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 7baca73e6..aeaf6d782 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -1020,7 +1020,7 @@ def is_power_of_two(value: int) -> bool: ```python def get_effective_balance(state: State, index: ValidatorIndex) -> Gwei: """ - Return the effective balance (also known as "balance at stake") for a ``validator`` with the given ``index``. + Return the effective balance (also known as "balance at stake") for a validator with the given ``index``. """ return min(state.validator_balances[index], MAX_DEPOSIT_AMOUNT) ``` From 5f29cc91bc71cc8725c93887858580e4122b8359 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Thu, 31 Jan 2019 19:06:13 +0800 Subject: [PATCH 2/5] Remove the repeated checks --- specs/core/0_beacon-chain.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index aeaf6d782..109308367 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -1742,9 +1742,6 @@ For each `attestation` in `block.body.attestations`: committee for committee, shard in get_crosslink_committees_at_slot(state, attestation.data.slot) if shard == attestation.data.shard ][0] - verify_bitfield(attestation.aggregation_bitfield, len(crosslink_committee)) - verify_bitfield(attestation.custody_bitfield, len(crosslink_committee)) - for i in range(len(crosslink_committee): if get_bitfield_bit(attestation.aggregation_bitfield, i) == 0b0: assert get_bitfield_bit(attestation.custody_bitfield, i) == 0b0 From 190d9d288736ec43b833eb32ba8fb4b7aee1046c Mon Sep 17 00:00:00 2001 From: vbuterin Date: Thu, 31 Jan 2019 07:44:14 -0600 Subject: [PATCH 3/5] Added closing bracket --- specs/core/0_beacon-chain.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 109308367..d93cb21d7 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -1742,7 +1742,7 @@ For each `attestation` in `block.body.attestations`: committee for committee, shard in get_crosslink_committees_at_slot(state, attestation.data.slot) if shard == attestation.data.shard ][0] - for i in range(len(crosslink_committee): + for i in range(len(crosslink_committee)): if get_bitfield_bit(attestation.aggregation_bitfield, i) == 0b0: assert get_bitfield_bit(attestation.custody_bitfield, i) == 0b0 From 0b8ccf1e64f97326f360de7b48b1ae871b2f992c Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Fri, 1 Feb 2019 23:45:09 +0800 Subject: [PATCH 4/5] Update 0_beacon-chain.md (#547) --- specs/core/0_beacon-chain.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index d93cb21d7..13f480171 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -940,7 +940,6 @@ def generate_seed(state: BeaconState, """ Generate a seed for the given ``epoch``. """ - return hash( get_randao_mix(state, epoch - SEED_LOOKAHEAD) + get_active_index_root(state, epoch) @@ -1000,7 +999,7 @@ def get_attestation_participants(state: BeaconState, ### `is_power_of_two` -``` +```python def is_power_of_two(value: int) -> bool: """ Check if ``value`` is a power of two integer. From d53d333733acc187f4257cc2dcc420b2b05e8650 Mon Sep 17 00:00:00 2001 From: Gregory Markou Date: Fri, 1 Feb 2019 14:04:17 -0800 Subject: [PATCH 5/5] fix startup typo --- specs/core/0_beacon-chain.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index d93cb21d7..1e33e7e87 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -1552,7 +1552,7 @@ def get_initial_beacon_state(initial_validator_deposits: List[Deposit], if get_effective_balance(state, validator_index) >= MAX_DEPOSIT_AMOUNT: activate_validator(state, validator_index, is_genesis=True) - genesis_active_index_root = hash_tree_root(get_active_validator_indices(state, GENESIS_EPOCH)) + genesis_active_index_root = hash_tree_root(get_active_validator_indices(state.validator_registry, GENESIS_EPOCH)) for index in range(LATEST_INDEX_ROOTS_LENGTH): state.latest_index_roots[index] = genesis_active_index_root state.current_epoch_seed = generate_seed(state, GENESIS_EPOCH) @@ -1737,7 +1737,7 @@ For each `attestation` in `block.body.attestations`: ```python assert attestation.custody_bitfield == b'\x00' * len(attestation.custody_bitfield) # [TO BE REMOVED IN PHASE 1] assert attestation.aggregation_bitfield != b'\x00' * len(attestation.aggregation_bitfield) - + crosslink_committee = [ committee for committee, shard in get_crosslink_committees_at_slot(state, attestation.data.slot) if shard == attestation.data.shard