Fix a type error with units of wei when determining ejection balance.

`EJECTION_BALANCE` is in units of ETH.

`state.validator_balances[index]` is in units of Gwei.

For the ejection computation to work as desired, we need to convert the
`EJECTION_BALANCE` constant from ETH to Gwei.
This commit is contained in:
Alex Stokes 2019-01-03 14:28:36 -06:00
parent 78e73633bc
commit 9a83ad7b9b
No known key found for this signature in database
GPG Key ID: 51CE1721B245C086
1 changed files with 1 additions and 1 deletions

View File

@ -1690,7 +1690,7 @@ def process_ejections(state: BeaconState) -> None:
and eject active validators with balance below ``EJECTION_BALANCE``. and eject active validators with balance below ``EJECTION_BALANCE``.
""" """
for index in active_validator_indices(state.validator_registry): for index in active_validator_indices(state.validator_registry):
if state.validator_balances[index] < EJECTION_BALANCE: if state.validator_balances[index] < EJECTION_BALANCE * GWEI_PER_ETH:
update_validator_status(state, index, new_status=EXITED_WITHOUT_PENALTY) update_validator_status(state, index, new_status=EXITED_WITHOUT_PENALTY)
``` ```