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

Attester slashings are done in an arbitrary order and do not commute #1125

Closed
michaelsproul opened this issue May 27, 2019 · 0 comments · Fixed by #1126
Closed

Attester slashings are done in an arbitrary order and do not commute #1125

michaelsproul opened this issue May 27, 2019 · 0 comments · Fixed by #1126

Comments

@michaelsproul
Copy link
Contributor

While testing Lighthouse against the new test vectors I encountered a discrepancy in the attester slashing tests which seems to arise from the spec iterating over the indices to slash in the arbitrary order used by Python's hashset implementation. The buggy line is:

for index in set(attesting_indices_1).intersection(attesting_indices_2):

in process_attester_slashing.

If slashings commuted the order could be arbitrary, but due to the exit_epoch being based upon the churn limit (and therefore the validators who have been previously slashed), you get different exit_epochs and different final states for different slashing orders. One test that exemplifies this is success_double (mainnet) which slashes [2, 143, 287, 353, 464, 475, 487, 496], which in Python set ordering is {353, 2, 487, 143, 464, 496, 475, 287}.

I think the best solution is to specify that the indices should be sorted before iteration, but I'm open to other ideas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant