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

non-determinism in shuffling from SEED_LOOKAHEAD #405

Closed
djrtwo opened this issue Jan 7, 2019 · 3 comments
Closed

non-determinism in shuffling from SEED_LOOKAHEAD #405

djrtwo opened this issue Jan 7, 2019 · 3 comments
Labels
general:bug Something isn't working

Comments

@djrtwo
Copy link
Contributor

djrtwo commented Jan 7, 2019

Issue

shufflings are calculated using a seed from SEED_LOOKAHEAD slots ago

get_shuffling(state.latest_randao_mixes[(state.slot - SEED_LOOKAHEAD) % LATEST_RANDAO_MIXES_LENGTH], state.validator_registry, next_start_shard, state.slot)

The spec uses SEED_LOOKAHEAD for two reasons:

  1. to provide more stability in the seed when used. The deeper in the chain the seed is picked from, the more likely there is consensus on the seed when used.
  2. to provide lookahead on validator shard_committee shuffling so that the validator knows SEED_LOOKAHEAD slots in advance what shard they are going to have to crosslink and get get prepared.

(2) is broken as is. The call to get_shuffling utilizes a seed from the past but uses the active validators from present (because passes in state.slot).

Proposed solution

One solution is to use the active_validators from state.slot - SEEDLOOKAHEAD slots ago to get the shard_committees rather than state.slot. This would ensure that committees are known SEED_LOOKAHEAD slots in advance, and this works fine as long as SEED_LOOKAHEAD < ENTRY_EXIT_DELAY (which it currently is).

@djrtwo djrtwo added the general:bug Something isn't working label Jan 7, 2019
@vbuterin
Copy link
Contributor

vbuterin commented Jan 8, 2019

I believe the idea is that active_validators should itself be predictable ENTRY_EXIT_DELAY slots in the future because all entry and exit events are delayed by ENTRY_EXIT_DELAY slots.

Am I missing some reason why this is not sufficient?

@djrtwo
Copy link
Contributor Author

djrtwo commented Jan 8, 2019

EDIT: You're right. We can predict the active_validators ENTRY_EXIT_DELAY slots in the future. To ensure that the point at which we get the seed (SEED_LOOKAHEAD slots in the past) is a safe point of prediction, ENTRY_EXIT_DELAY <= SEED_LOOKAHEAD

@djrtwo
Copy link
Contributor Author

djrtwo commented Jan 8, 2019

closing in favor of #407

@djrtwo djrtwo closed this as completed Jan 8, 2019
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

No branches or pull requests

2 participants