From 0a9b306d60df2fbc673f2f8fdebffc0b4f85b70a Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Wed, 18 Mar 2020 09:55:09 -0600 Subject: [PATCH] PR feedback from @hwwhww --- specs/phase0/beacon-chain.md | 5 +++++ tests/core/pyspec/eth2spec/test/context.py | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/specs/phase0/beacon-chain.md b/specs/phase0/beacon-chain.md index 02b139d0d..45a7df3d9 100644 --- a/specs/phase0/beacon-chain.md +++ b/specs/phase0/beacon-chain.md @@ -1009,6 +1009,7 @@ def get_total_balance(state: BeaconState, indices: Set[ValidatorIndex]) -> Gwei: def get_total_active_balance(state: BeaconState) -> Gwei: """ Return the combined effective balance of the active validators. + Note: ``get_total_balance`` returns ``EFFECTIVE_BALANCE_INCREMENT`` Gwei minimum to avoid divisions by zero. """ return get_total_balance(state, set(get_active_validator_indices(state, get_current_epoch(state)))) ``` @@ -1290,6 +1291,10 @@ def get_unslashed_attesting_indices(state: BeaconState, ```python def get_attesting_balance(state: BeaconState, attestations: Sequence[PendingAttestation]) -> Gwei: + """ + Return the combined effective balance of the set of unslashed validators participating in ``attestations``. + Note: ``get_total_balance`` returns ``EFFECTIVE_BALANCE_INCREMENT`` Gwei minimum to avoid divisions by zero. + """ return get_total_balance(state, get_unslashed_attesting_indices(state, attestations)) ``` diff --git a/tests/core/pyspec/eth2spec/test/context.py b/tests/core/pyspec/eth2spec/test/context.py index bdf26e637..84c617a08 100644 --- a/tests/core/pyspec/eth2spec/test/context.py +++ b/tests/core/pyspec/eth2spec/test/context.py @@ -73,8 +73,8 @@ def default_activation_threshold(spec): def zero_activation_threshold(spec): """ - Helper method to use the default balance activation threshold for state creation for tests. - Usage: `@with_custom_state(threshold_fn=one_gwei_activation_threshold, ...)` + Helper method to use 0 gwei as the activation threshold for state creation for tests. + Usage: `@with_custom_state(threshold_fn=zero_activation_threshold, ...)` """ return 0