Update 0_beacon-chain.md

This commit is contained in:
Justin 2019-03-16 11:23:41 +00:00 committed by GitHub
parent 709e0df39f
commit e5ff0d59ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 13 deletions

View File

@ -595,7 +595,6 @@ The types are defined topologically to aid in facilitating an executable version
'validator_registry': [Validator], 'validator_registry': [Validator],
'validator_balances': ['uint64'], 'validator_balances': ['uint64'],
'validator_registry_update_epoch': 'uint64', 'validator_registry_update_epoch': 'uint64',
'validator_registry_update_slashed_balances': 'uint64',
# Randomness and committees # Randomness and committees
'latest_randao_mixes': ['bytes32', LATEST_RANDAO_MIXES_LENGTH], 'latest_randao_mixes': ['bytes32', LATEST_RANDAO_MIXES_LENGTH],
@ -2103,9 +2102,12 @@ def update_validator_registry(state: BeaconState) -> None:
activate_validator(state, index, is_genesis=False) activate_validator(state, index, is_genesis=False)
# Exit validators within the allowable balance churn # Exit validators within the allowable balance churn
total_at_start = state.validator_registry_update_slashed_balances if state.current_epoch < state.validator_registry_update_epoch + LATEST_SLASHED_EXIT_LENGTH:
total_at_end = state.latest_slashed_balances[current_epoch % LATEST_SLASHED_EXIT_LENGTH] balance_churn = (
balance_churn = total_at_end - total_at_start state.latest_slashed_balances[state.validator_registry_update_epoch % LATEST_SLASHED_EXIT_LENGTH] -
state.latest_slashed_balances[current_epoch % LATEST_SLASHED_EXIT_LENGTH]
)
for index, validator in enumerate(state.validator_registry): for index, validator in enumerate(state.validator_registry):
if validator.exit_epoch == FAR_FUTURE_EPOCH and validator.initiated_exit: if validator.exit_epoch == FAR_FUTURE_EPOCH and validator.initiated_exit:
# Check the balance churn would be within the allowance # Check the balance churn would be within the allowance
@ -2117,7 +2119,6 @@ def update_validator_registry(state: BeaconState) -> None:
exit_validator(state, index) exit_validator(state, index)
state.validator_registry_update_epoch = current_epoch state.validator_registry_update_epoch = current_epoch
state.validator_registry_update_slashed_balances = total_at_end
``` ```
Run the following function: Run the following function: