Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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, eachVoteWeight
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
andequivocators_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 ofHashMap<Id, u64>
in the codebase.