fix small bug in sytax

This commit is contained in:
Danny Ryan 2019-03-19 13:25:34 -06:00
parent cf06cb59c3
commit 23ef802da5
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
2 changed files with 9 additions and 3 deletions

View File

@ -2089,7 +2089,7 @@ def update_validator_registry(state: BeaconState) -> None:
activate_validator(state, index, is_genesis=False)
# Exit validators within the allowable balance churn
if state.current_epoch < state.validator_registry_update_epoch + LATEST_SLASHED_EXIT_LENGTH:
if current_epoch < state.validator_registry_update_epoch + LATEST_SLASHED_EXIT_LENGTH:
balance_churn = (
state.latest_slashed_balances[state.validator_registry_update_epoch % LATEST_SLASHED_EXIT_LENGTH] -
state.latest_slashed_balances[current_epoch % LATEST_SLASHED_EXIT_LENGTH]

View File

@ -316,12 +316,18 @@ def test_attestation(state, pubkeys, privkeys):
def test_voluntary_exit(state, pubkeys, privkeys):
pre_state = deepcopy(state)
validator_index = get_active_validator_indices(pre_state.validator_registry, get_current_epoch(pre_state))[-1]
validator_index = get_active_validator_indices(
pre_state.validator_registry,
get_current_epoch(pre_state)
)[-1]
# move state forward PERSISTENT_COMMITTEE_PERIOD epochs to allow for exit
pre_state.slot += spec.PERSISTENT_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH
# artificially trigger registry update at next epoch transition
pre_state.validator_registry_update_epoch -= 1
pre_state.finalized_epoch = get_current_epoch(pre_state) - 1
for crosslink in pre_state.latest_crosslinks:
crosslink.epoch = pre_state.finalized_epoch
pre_state.validator_registry_update_epoch = pre_state.finalized_epoch - 1
post_state = deepcopy(pre_state)