def _get_shuffling_contextis_next_epoch_registry_change( state: 'BeaconState', next_epoch: Epoch, committee_config: CommitteeConfig) -> ShufflingContext: current_committees_per_epoch = get_current_epoch_committee_count( state=state, shard_count=committee_config.SHARD_COUNT, slots_per_epoch=committee_config.SLOTS_PER_EPOCH, target_committee_size=committee_config.TARGET_COMMITTEE_SIZE, ) return ShufflingContext( committees_per_epoch=get_next_epoch_committee_count( state=state, shard_count=committee_config.SHARD_COUNT, slots_per_epoch=committee_config.SLOTS_PER_EPOCH, target_committee_size=committee_config.TARGET_COMMITTEE_SIZE, ), seed=helpers.generate_seed( state=state, epoch=next_epoch, slots_per_epoch=committee_config.SLOTS_PER_EPOCH, min_seed_lookahead=committee_config.MIN_SEED_LOOKAHEAD, activation_exit_delay=committee_config.SLOTS_PER_EPOCH, latest_active_index_roots_length=committee_config.LATEST_ACTIVE_INDEX_ROOTS_LENGTH, latest_randao_mixes_length=committee_config.LATEST_RANDAO_MIXES_LENGTH, ), shuffling_epoch=next_epoch, # for mocking this out in tests. shuffling_start_shard=( state.current_shuffling_start_shard + current_committees_per_epoch ) % committee_config.SHARD_COUNT, )
def _get_shuffling_contextis_next_epoch_registry_change( state: 'BeaconState', next_epoch: Epoch, committee_config: CommitteeConfig) -> ShufflingContext: current_committees_per_epoch = get_current_epoch_committee_count( state=state, shard_count=committee_config.SHARD_COUNT, slots_per_epoch=committee_config.SLOTS_PER_EPOCH, target_committee_size=committee_config.TARGET_COMMITTEE_SIZE, ) return ShufflingContext( committees_per_epoch=get_next_epoch_committee_count( state=state, shard_count=committee_config.SHARD_COUNT, slots_per_epoch=committee_config.SLOTS_PER_EPOCH, target_committee_size=committee_config.TARGET_COMMITTEE_SIZE, ), seed=helpers.generate_seed( state=state, epoch=next_epoch, committee_config=committee_config, ), shuffling_epoch=next_epoch, # for mocking this out in tests. shuffling_start_shard=(state.current_shuffling_start_shard + current_committees_per_epoch) % committee_config.SHARD_COUNT, )
def _get_shuffling_contextis_next_epoch_no_registry_change_no_reseed( state: 'BeaconState', committee_config: CommitteeConfig) -> ShufflingContext: return ShufflingContext( committees_per_epoch=get_current_epoch_committee_count( state=state, shard_count=committee_config.SHARD_COUNT, slots_per_epoch=committee_config.SLOTS_PER_EPOCH, target_committee_size=committee_config.TARGET_COMMITTEE_SIZE, ), seed=state.current_shuffling_seed, shuffling_epoch=state.current_shuffling_epoch, shuffling_start_shard=state.current_shuffling_start_shard, )
def _get_shuffling_context_is_previous_epoch( state: 'BeaconState', committee_config: CommitteeConfig) -> ShufflingContext: return ShufflingContext( committees_per_epoch=get_previous_epoch_committee_count( state=state, shard_count=committee_config.SHARD_COUNT, slots_per_epoch=committee_config.SLOTS_PER_EPOCH, target_committee_size=committee_config.TARGET_COMMITTEE_SIZE, ), seed=state.previous_shuffling_seed, shuffling_epoch=state.previous_shuffling_epoch, shuffling_start_shard=state.previous_shuffling_start_shard, )