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

count equivocations on all votes #36

Merged
merged 3 commits into from
Jan 4, 2019
Merged

Conversation

rphmeier
Copy link
Contributor

@rphmeier rphmeier commented Dec 19, 2018

Closes #34

The previous behavior was that equivocations would be counted on all branches that were actually equivocated for. Now, if we see a voter double-voting, we count it as "infinite-voting" and treat it as if we have received a vote for every possible block. This means that we can ignore any equivocations beyond the first.

Rewrites most of the bitfield module. The idea is that now, each VoteWeight is its own bitfield which counts all the voters who have voted on a specific node in the graph, and there is also a round-global bitfield of all equivocators.

When calculating the vote-weights corresponding to a node, we calculate the union of node_bitfield and equivocators_bitfield, and figure out the total weight based on that. I couldn't figure out a more allocation-efficient way of doing this. A pool for bitfield storage might be an improvement.

Since we now have a need for a global-ish lookup of validator indices to weights (before it was only equivocators -> weights), I introduced the VoterSet type which is used in lieu of HashMap<Id, u64> in the codebase.

Copy link
Contributor

@andresilva andresilva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, it's simpler since there's no need to special case the double-counting. currently we may produce invalid commit messages since on equivocations we only include one of the equivocated votes that justifies the commit, whereas now equivocated votes justify any commit for that round and should always be included. I guess this can be addressed with #37..

src/bitfield.rs Outdated Show resolved Hide resolved
src/round.rs Outdated Show resolved Hide resolved
andresilva and others added 2 commits December 28, 2018 14:49
Co-Authored-By: rphmeier <rphmeier@gmail.com>
Co-Authored-By: rphmeier <rphmeier@gmail.com>
@rphmeier rphmeier merged commit 472b198 into master Jan 4, 2019
@rphmeier rphmeier deleted the rh-redundant-equivocations branch January 4, 2019 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants