-
Notifications
You must be signed in to change notification settings - Fork 996
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
Introduce swap-or-not shuffle #576
Conversation
See #563 for discussion.
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.
Great work 👍
If my suggestions are applied, the code will be runnable.
Co-Authored-By: vbuterin <v@buterin.com>
Co-Authored-By: vbuterin <v@buterin.com>
Co-Authored-By: vbuterin <v@buterin.com>
should we use little endian for consistency? (sorry @vbuterin) |
Sure, sounds fine to me. |
done |
|
we lost the (1) -- docstring looks good |
@djrtwo |
Co-Authored-By: vbuterin <v@buterin.com>
To the implementers: 70e482b is the optimized version for shuffling the whole validator registry. |
I'm working on a new implementation experiment-repo, written in Go. For the new "swap-or-not" shuffling algorithm. Love optimizing this stuff (and don't have a ETH 2.0 client to work on more general stuff 😞 ). Here are the preliminary benchmark results (ran locally on a laptop, more about comparison):
Repo here: https://github.com/protolambda/eth2-shuffle |
Posting some relevant gitter chatter here:
Now, the issue is: pivot = int.from_bytes(hash(seed + round.to_bytes(1, 'little')), 'little') % list_size Spec currently says: pivot = bytes_to_int(hash(seed + int_to_bytes1(round))[0:8]) % list_size There's two inconsistency issues:
Some test-vectors would be really useful. |
|
Here is an issue for reworking the test vectors to the swap or not -- ethereum/eth2.0-test-generators#10 |
See #563 for discussion.
Here is a more efficient implementation for shuffling an entire set; it can live here until we come up with an explicit "efficient implementation" doc: