ensure that next committee assignemtns is stable when need to be

This commit is contained in:
Danny Ryan 2019-02-27 11:37:54 -07:00
parent e2f4e32332
commit c9ac8170f0
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
1 changed files with 7 additions and 4 deletions

View File

@ -876,18 +876,21 @@ def get_crosslink_committees_at_slot(state: BeaconState,
shuffling_epoch = state.previous_shuffling_epoch shuffling_epoch = state.previous_shuffling_epoch
shuffling_start_shard = state.previous_shuffling_start_shard shuffling_start_shard = state.previous_shuffling_start_shard
elif epoch == next_epoch: elif epoch == next_epoch:
current_committees_per_epoch = get_current_epoch_committee_count(state)
committees_per_epoch = get_next_epoch_committee_count(state)
shuffling_epoch = next_epoch
epochs_since_last_registry_update = current_epoch - state.validator_registry_update_epoch epochs_since_last_registry_update = current_epoch - state.validator_registry_update_epoch
if registry_change: if registry_change:
committees_per_epoch = get_next_epoch_committee_count(state)
shuffling_epoch = next_epoch
seed = generate_seed(state, next_epoch) seed = generate_seed(state, next_epoch)
current_committees_per_epoch = get_current_epoch_committee_count(state)
shuffling_start_shard = (state.current_shuffling_start_shard + current_committees_per_epoch) % SHARD_COUNT shuffling_start_shard = (state.current_shuffling_start_shard + current_committees_per_epoch) % SHARD_COUNT
elif epochs_since_last_registry_update > 1 and is_power_of_two(epochs_since_last_registry_update): elif epochs_since_last_registry_update > 1 and is_power_of_two(epochs_since_last_registry_update):
committees_per_epoch = get_next_epoch_committee_count(state)
shuffling_epoch = next_epoch
seed = generate_seed(state, next_epoch) seed = generate_seed(state, next_epoch)
shuffling_start_shard = state.current_shuffling_start_shard shuffling_start_shard = state.current_shuffling_start_shard
else: else:
committees_per_epoch = get_current_epoch_committee_count(state)
shuffling_epoch = state.current_shuffling_epoch
seed = state.current_shuffling_seed seed = state.current_shuffling_seed
shuffling_start_shard = state.current_shuffling_start_shard shuffling_start_shard = state.current_shuffling_start_shard