Skip to content
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

get_crosslink_committees reads previous_seed during genesis_epoch #639

Closed
paulhauner opened this issue Feb 16, 2019 · 0 comments · Fixed by #672
Closed

get_crosslink_committees reads previous_seed during genesis_epoch #639

paulhauner opened this issue Feb 16, 2019 · 0 comments · Fixed by #672
Labels
general:bug Something isn't working

Comments

@paulhauner
Copy link
Contributor

Problem

Summary

During GENESIS_EPOCH, get_crosslink_committees_at_slot(..) reads state.previous_shuffling_epoch when epoch == current_epoch.

Detail

get_crosslink_committees_at_slot(...) first checks for epoch == previous_epoch, then checks for epoch == current_epoch.

During the genesis epoch, current_epoch == previous_epoch and the function so uses state.previous_shuffling_epoch == ZERO_HASH for shuffling.

During the next epoch (GENESIS_EPOCH + 1), when you wish to get the shuffling for GENESIS_EPOCH, you also trigger the current_epoch == previous_epoch path. However, state.previous_shuffling_epoch != ZERO_HASH anymore -- it is now the value that was set during get_genesis_beacon_state(...) (a.k.a. current_shuffling_seed during GENESIS_EPOCH).

Proposed Solutions

  1. (Preferred) Swap the if statements for so we first check for epoch == current_epoch, then epoch == previous_epoch.
  2. (Seems wrong) During get_genesis_beacon_state(..) ensure state.previous_shuffling_seed is also set to generate_seed(state, GENESIS_EPOCH).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
general:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants