Update 0_beacon-chain.md

This commit is contained in:
Justin 2019-04-14 18:10:44 +10:00 committed by GitHub
parent da4a1430ea
commit 229af3deda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 18 deletions

View File

@ -594,10 +594,6 @@ The types are defined topologically to aid in facilitating an executable version
'latest_randao_mixes': ['bytes32', LATEST_RANDAO_MIXES_LENGTH], 'latest_randao_mixes': ['bytes32', LATEST_RANDAO_MIXES_LENGTH],
'latest_start_shard': 'uint64', 'latest_start_shard': 'uint64',
# Exit queue
'exit_queue_epoch': 'uint64',
'exit_queue_churn': 'uint64',
# Finality # Finality
'previous_epoch_attestations': [PendingAttestation], 'previous_epoch_attestations': [PendingAttestation],
'current_epoch_attestations': [PendingAttestation], 'current_epoch_attestations': [PendingAttestation],
@ -1324,19 +1320,21 @@ def initiate_validator_exit(state: BeaconState, index: ValidatorIndex) -> None:
if validator.exit_epoch != FAR_FUTURE_EPOCH: if validator.exit_epoch != FAR_FUTURE_EPOCH:
return return
# Update exit queue counters # Compute exit queue parameters
delayed_activation_exit_epoch = get_delayed_activation_exit_epoch(get_current_epoch(state)) exit_queue_epoch = sorted([validator.exit_epoch for validator in state.validator_registry if
if state.exit_queue_epoch < delayed_activation_exit_epoch: validator.exit_epoch != FAR_FUTURE_EPOCH
state.exit_queue_epoch = delayed_activation_exit_epoch ].append(GENESIS_EPOCH), key=lambda index: state.validator_registry[index].exit_epoch)[-1]
state.exit_queue_churn = 0
state.exit_queue_churn += 1 delayed_activation_exit_epoch = get_delayed_activation_exit_epoch(get_current_epoch(state))
if state.exit_queue_churn > get_churn_limit(state): if exit_queue_epoch < delayed_activation_exit_epoch:
state.exit_queue_epoch += 1 exit_queue_epoch = delayed_activation_exit_epoch
state.exit_queue_churn = 0
exit_queue_churn = len([v for v in state.validator_registry if v.exit_epoch == exit_queue_epoch])
if exit_queue_churn > get_churn_limit(state):
exit_queue_epoch += 1
# Set validator exit epoch and withdrawable epoch # Set validator exit epoch and withdrawable epoch
validator.exit_epoch = state.exit_queue_epoch validator.exit_epoch = exit_queue_epoch
validator.withdrawable_epoch = validator.exit_epoch + MIN_VALIDATOR_WITHDRAWABILITY_DELAY validator.withdrawable_epoch = validator.exit_epoch + MIN_VALIDATOR_WITHDRAWABILITY_DELAY
# Extend queue # Extend queue
@ -1475,10 +1473,6 @@ def get_genesis_beacon_state(genesis_validator_deposits: List[Deposit],
latest_randao_mixes=Vector([ZERO_HASH for _ in range(LATEST_RANDAO_MIXES_LENGTH)]), latest_randao_mixes=Vector([ZERO_HASH for _ in range(LATEST_RANDAO_MIXES_LENGTH)]),
latest_start_shard=GENESIS_START_SHARD, latest_start_shard=GENESIS_START_SHARD,
# Exit queue
exit_queue_epoch=GENESIS_EPOCH,
exit_queue_churn=0,
# Finality # Finality
previous_epoch_attestations=[], previous_epoch_attestations=[],
current_epoch_attestations=[], current_epoch_attestations=[],