PR feedback from @hwwhww
This commit is contained in:
parent
e2ef4365e2
commit
0a9b306d60
|
@ -1009,6 +1009,7 @@ def get_total_balance(state: BeaconState, indices: Set[ValidatorIndex]) -> Gwei:
|
||||||
def get_total_active_balance(state: BeaconState) -> Gwei:
|
def get_total_active_balance(state: BeaconState) -> Gwei:
|
||||||
"""
|
"""
|
||||||
Return the combined effective balance of the active validators.
|
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))))
|
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
|
```python
|
||||||
def get_attesting_balance(state: BeaconState, attestations: Sequence[PendingAttestation]) -> Gwei:
|
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))
|
return get_total_balance(state, get_unslashed_attesting_indices(state, attestations))
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -73,8 +73,8 @@ def default_activation_threshold(spec):
|
||||||
|
|
||||||
def zero_activation_threshold(spec):
|
def zero_activation_threshold(spec):
|
||||||
"""
|
"""
|
||||||
Helper method to use the default balance activation threshold for state creation for tests.
|
Helper method to use 0 gwei as the activation threshold for state creation for tests.
|
||||||
Usage: `@with_custom_state(threshold_fn=one_gwei_activation_threshold, ...)`
|
Usage: `@with_custom_state(threshold_fn=zero_activation_threshold, ...)`
|
||||||
"""
|
"""
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue