clena up get_crosslink_committees_at_slots

This commit is contained in:
Danny Ryan 2019-01-23 15:41:25 -06:00
parent dd075edd06
commit b18de2c86c
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A

View File

@ -942,24 +942,25 @@ def get_crosslink_committees_at_slot(state: BeaconState,
state_epoch_slot = state.slot - (state.slot % EPOCH_LENGTH) state_epoch_slot = state.slot - (state.slot % EPOCH_LENGTH)
assert state_epoch_slot <= slot + EPOCH_LENGTH assert state_epoch_slot <= slot + EPOCH_LENGTH
assert slot < state_epoch_slot + EPOCH_LENGTH assert slot < state_epoch_slot + EPOCH_LENGTH
offset = slot % EPOCH_LENGTH
if slot < state_epoch_slot: if slot < state_epoch_slot:
committees_per_slot = get_previous_epoch_committee_count_per_slot(state) committees_per_slot = get_previous_epoch_committee_count_per_slot(state)
shuffling = get_shuffling( seed = state.previous_epoch_randao_mix
state.previous_epoch_randao_mix, shuffling_slot = state.previous_epoch_calculation_slot
state.validator_registry, shuffling_start_shard = state.previous_epoch_start_shard
state.previous_epoch_calculation_slot,
)
slot_start_shard = (state.previous_epoch_start_shard + committees_per_slot * offset) % SHARD_COUNT
else: else:
committees_per_slot = get_current_epoch_committee_count_per_slot(state) committees_per_slot = get_current_epoch_committee_count_per_slot(state)
shuffling = get_shuffling( seed = state.current_epoch_randao_mix
state.current_epoch_randao_mix, shuffling_slot = state.current_epoch_calculation_slot
state.validator_registry, shuffling_start_shard = state.current_epoch_start_shard
state.current_epoch_calculation_slot,
) shuffling = get_shuffling(
slot_start_shard = (state.current_epoch_start_shard + committees_per_slot * offset) % SHARD_COUNT seed,
state.validator_registry,
shuffling_slot,
)
offset = slot % EPOCH_LENGTH
slot_start_shard = (shuffling_start_shard + committees_per_slot * offset) % SHARD_COUNT
return [ return [
( (