-
Notifications
You must be signed in to change notification settings - Fork 997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
epoch transition at start of epoch #732
Conversation
Can we get some background on why we need this change? |
Minor comments:
|
The get helpers are particularly useful being defined for validators/clients outside of the state transition. We can just do the array access directly within the state transition here knowing that it is safe in this context if you really want to move these lines around. |
Seems like 'eth1 data', 'randao', and 'block header' can be processed in parallel to all of the beacon transactions with just a final state root check at the end. I think if we merge the header and state root sections, we might encourage missing this parallelization opportunity. |
* set epoch_boundary_root - chain finalizes! * fix slotStart to offset GENESIS_SLOT * work around bug that will be fixed by ethereum/consensus-specs#732 * compile with debug info (there was a GC-related crash in C land)
* set epoch_boundary_root - chain finalizes! * fix slotStart to offset GENESIS_SLOT * work around bug that will be fixed by ethereum/consensus-specs#732 * compile with debug info (there was a GC-related crash in C land)
and ethereum/consensus-specs#732 epoch transition work around
Having epoch transitions during the last slot of the epoch leaves the state transitioned halfway between the two epochs. Fields related to shuffling, seed, justification, etc are updated for the following epoch but the
state.slot
still is set for the current epoch. This disparity between parts of the state splitting across epochs creates a number of off-by-one issues throughout helpers and verification.For example, the attestation off by one issue that was fixed with a kludge was due to this disparity (#627).
A more important issue that Prysmatic has run into is that the shuffling assignments break when in this in between state. At the end of an epoch, say slot 63, all of the fields related to shuffling (
current_shuffling_seed
,current_shuffling_start_shard
, etc) have been updated to reflect values for epoch starting at 64, but the state is still at slot 63. If in this state and you call something likeget_crosslink_committees_for_slot
for slot 64, the helper thinks you are requesting for thenext_epoch
and regenerates incorrect seeds.changelog
note: the diff looks nasty but this is primarily just a reordering of components of the state transition function. removing the attestation kludge (+ 1) is the only non-ordering change
For clarity, the state transition now looks like this:
https://github.com/ethereum/research/blob/d15e5c78a9a296c2ebe641034c3a3998e9a9c87f/spec_pythonizer/state_transition.py#L75-L84