Merge pull request #525 from ethereum/JustinDrake-patch-1-1

Remove exit counts
This commit is contained in:
Danny Ryan 2019-01-30 10:29:39 -08:00 committed by GitHub
commit 820777aab0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 9 deletions

View File

@ -486,7 +486,6 @@ The following data structures are defined as [SimpleSerialize (SSZ)](https://git
'validator_registry': [Validator], 'validator_registry': [Validator],
'validator_balances': ['uint64'], 'validator_balances': ['uint64'],
'validator_registry_update_epoch': 'uint64', 'validator_registry_update_epoch': 'uint64',
'validator_registry_exit_count': 'uint64',
# Randomness and committees # Randomness and committees
'latest_randao_mixes': ['bytes32'], 'latest_randao_mixes': ['bytes32'],
@ -533,8 +532,6 @@ The following data structures are defined as [SimpleSerialize (SSZ)](https://git
'withdrawal_epoch': 'uint64', 'withdrawal_epoch': 'uint64',
# Epoch when validator was penalized # Epoch when validator was penalized
'penalized_epoch': 'uint64', 'penalized_epoch': 'uint64',
# Exit counter when validator exited
'exit_count': 'uint64',
# Status flags # Status flags
'status_flags': 'uint64', 'status_flags': 'uint64',
} }
@ -1196,7 +1193,6 @@ def process_deposit(state: BeaconState,
exit_epoch=FAR_FUTURE_EPOCH, exit_epoch=FAR_FUTURE_EPOCH,
withdrawal_epoch=FAR_FUTURE_EPOCH, withdrawal_epoch=FAR_FUTURE_EPOCH,
penalized_epoch=FAR_FUTURE_EPOCH, penalized_epoch=FAR_FUTURE_EPOCH,
exit_count=0,
status_flags=0, status_flags=0,
) )
@ -1243,9 +1239,6 @@ def exit_validator(state: BeaconState, index: ValidatorIndex) -> None:
return return
validator.exit_epoch = get_entry_exit_effect_epoch(get_current_epoch(state)) validator.exit_epoch = get_entry_exit_effect_epoch(get_current_epoch(state))
state.validator_registry_exit_count += 1
validator.exit_count = state.validator_registry_exit_count
``` ```
#### `penalize_validator` #### `penalize_validator`
@ -1409,7 +1402,6 @@ def get_initial_beacon_state(initial_validator_deposits: List[Deposit],
validator_registry=[], validator_registry=[],
validator_balances=[], validator_balances=[],
validator_registry_update_epoch=GENESIS_EPOCH, validator_registry_update_epoch=GENESIS_EPOCH,
validator_registry_exit_count=0,
# Randomness and committees # Randomness and committees
latest_randao_mixes=[ZERO_HASH for _ in range(LATEST_RANDAO_MIXES_LENGTH)], latest_randao_mixes=[ZERO_HASH for _ in range(LATEST_RANDAO_MIXES_LENGTH)],
@ -1963,7 +1955,8 @@ def process_penalties_and_exits(state: BeaconState) -> None:
all_indices = list(range(len(state.validator_registry))) all_indices = list(range(len(state.validator_registry)))
eligible_indices = filter(eligible, all_indices) eligible_indices = filter(eligible, all_indices)
sorted_indices = sorted(eligible_indices, key=lambda index: state.validator_registry[index].exit_count) # Sort in order of exit epoch, and validators that exit within the same epoch exit in order of validator index
sorted_indices = sorted(eligible_indices, key=lambda index: state.validator_registry[index].exit_epoch)
withdrawn_so_far = 0 withdrawn_so_far = 0
for index in sorted_indices: for index in sorted_indices:
prepare_validator_for_withdrawal(state, index) prepare_validator_for_withdrawal(state, index)