-
Notifications
You must be signed in to change notification settings - Fork 977
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
Correct swap direction when permuting a list #774
Comments
Note that it's shuffling the input list in-place, see: https://github.com/protolambda/eth2-shuffle/blob/fd840f1036c1f8f6d7625ffe6ff4d9c60f942876/shuffle_test.go#L103 Admittedly, it's a big source of confusion in testing, but it the algorithm is still correct. The thing is, I am applying and testing it with my semantic interpretation: "permute-index returns the permuted, i.e. the new position, for any given original list position", and then it places this validator at this new position. The spec seems to intepret it differently: "permute index returns the original input position for any index in the output list", and then it fetches the validator from the original input. I think my interpretation makes more sense when you're talking about "permuting". It's a change of the list. |
I think this is addressed in #776. Please reopen if not :) |
Problem
There is a difference between @protolambda's optimised list shuffling and
get_shuffling
method in the spec. This difference is in the way permuted index is applied in order to get a shuffled list.Both approaches seem to work well. But we need a consensus here.
As for me
output[permuted(i)] = input[i]
looks like a right direction cause thenpermute(index, value)
can be written as(permute(index), value)
.What do you guys think about that?
The text was updated successfully, but these errors were encountered: