-
Notifications
You must be signed in to change notification settings - Fork 145
Make epoch first class and update epoch transition rule #256
Make epoch first class and update epoch transition rule #256
Conversation
get_committee_count_per_slot, get_previous_epoch_committee_count_per_slot, get_current_epoch_committee_count_per_slot, entry_exit_effect_slot
GENESIS_EPOCH, FAR_FUTURE_SLOT, SEED_LOOKAHEAD, ENTRY_EXIT_DELAY, ETH1_DATA_VOTING_PERIOD, MIN_VALI DATOR_WITHDRAWAL_EPOCHS
AttestationData.justified_slot, Exit. slot, State(validator_registry_update_slot/previous_epoch_calculation_slot/current_epoch_calculation_slot/previous_justified_slot/justified_slot/finalized_slot), Validator.(activation_slot/exit_slot/withdrawal_slot/penalized_slot), Crosslink.slot, Fork.slot
is_active_validator, get_active_validator_indices, get_shuffling, get_crosslink_committees_at_slot
get_randao_mix, get_active_index_root, generate_seed, get_fork_version, get_domain, verify_slashable_vote_data, is_double_vote, is_surround_vote
get_initial_beacon_state, validate_proof_of_possession, activate_validator, exit_validator, penalize_validator
fix get_previous_epoch_attestations/get_current_epoch_attestations
fix process_crosslinks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
excellent work!
process_validator_registry, process_final_updates
05675c6
to
98c55f8
Compare
current_epoch = state.current_epoch(config.EPOCH_LENGTH) | ||
next_epoch = state.next_epoch(config.EPOCH_LENGTH) | ||
previous_index = current_epoch % config.LATEST_PENALIZED_EXIT_LENGTH | ||
current_index = next_epoch % config.LATEST_PENALIZED_EXIT_LENGTH | ||
|
||
state = state.copy( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we update latest_index_roots
in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's handled in process_validator_registry
?
https://github.com/ethereum/trinity/blob/master/eth2/beacon/state_machines/forks/serenity/epoch_processing.py#L142-L172
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhh you're right!!!
I was looking for these changes needed to be updated:
index_root = hash_eth2(
b''.join(
[
index.to_bytes(32, 'big')
for index in active_validator_indices
]
)
)
latest_index_roots = update_tuple_item(
state.latest_index_roots,
next_epoch % config.LATEST_INDEX_ROOTS_LENGTH,
index_root,
)
to
In spec: Set state.latest_index_roots[(next_epoch + ENTRY_EXIT_DELAY) % LATEST_INDEX_ROOTS_LENGTH] = hash_tree_root(get_active_validator_indices(state, next_epoch + ENTRY_EXIT_DELAY))
.
But now I found these changes belong to #258. 😢
docstring, TODO, naming
What was wrong?
Fix #235
How was it fixed?
*_slot
to*_epoch
GENESIS_EPOCH
FAR_FUTURE_SLOT
->FAR_FUTURE_EPOCH
SEED_LOOKAHEAD
ENTRY_EXIT_DELAY
ETH1_DATA_VOTING_PERIOD
MIN_VALIDATOR_WITHDRAWAL_EPOCHS
get_epoch_start_slot
slot_to_epoch
get_committee_count_per_slot
->get_epoch_committee_count
get_previous_epoch_committee_count_per_slot
->get_previous_epoch_committee_count
get_current_epoch_committee_count_per_slot
->get_current_epoch_committee_count
entry_exit_effect_slot
->get_entry_exit_effect_epoch
is_active_validator
(Validator.is_active
)get_active_validator_indices
get_shuffling
get_crosslink_committees_at_slot
get_randao_mix
get_active_index_root
generate_seed
get_fork_version
get_domain
verify_slashable_vote_data
is_double_vote
is_surround_vote
get_initial_beacon_state
validate_proof_of_possession
activate_validator
exit_validator
penalize_validator
state.latest_randao_mixes
process_randao
or update afterRANDAO processing #252 is merged
process_eth1_data
or update afterImplement per-block processing - eth1 data #253 is merged
process_attester_slashings
process_exits
get_current_epoch_attestations
/get_previous_epoch_attestations
helper functionsprocess_et1_data_votes
process_justification
process_crosslinks
process_rewards_and_penalties
process_ejections
update_validator_registry
process_penalties_and_exits
(part of [validator-registry-and-shuffling-seed-dat](https://github.com/ethereum/eth2.0-specs/blob/master/specs/core/0_beacon-chain.md#validator-registry-and-shuffling-seed-data) )
process_validator_registry
process_final_updates
Cute Animal Picture