-
Notifications
You must be signed in to change notification settings - Fork 46
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
VoterSet and Bitfield Refactoring #93
Merged
Merged
Commits on Jan 17, 2020
-
Refactor bitfield and voter set.
Bitfield: * Simplify definition, as Bitfield::Blank and LiveBitfield(vec![]) are equivalent. * Dynamically-sized with lazy allocation makes for a more ergonomic API and keeps bitfields smaller. If there are few voters, most votes are likely on the same nodes / blocks but in that case bitfields are almost never resized anyway. As there are more and more voters, votes are spread across more and more nodes / blocks and thus not all nodes need a fully-sized bitfield. * Avoid allocations when merging bitfields. Previously merging would always allocate a new bitfield, now the other bitfield is merged into `self` and only allocates if `self` needs to be resized. * Avoid allocations when casting votes and computing weights. Previously both casting of new votes and computing weights involved creating and merging bitfields. Now incorporating a vote into the vote graph is a `set_bit` operation while computing the vote weight on a node is based a bitfield-merging iterator that does not allocate. * Better tests. VoterSet: * Make it impossible to construct inconsistent sets as well as empty sets. Both were previously possible. * Better tests. Related changes: * Introduce a `weights` module for encapsulating vote-weight arithmetic behind newtypes. * Introduce a `round::context` module for encapsulating the context of a round in which vote weights are computed, consisting of the voter set and recorded equivocations.
Configuration menu - View commit details
-
Copy full SHA for 4897f71 - Browse repository at this point
Copy the full SHA 4897f71View commit details -
Configuration menu - View commit details
-
Copy full SHA for b9c3d88 - Browse repository at this point
Copy the full SHA b9c3d88View commit details -
Configuration menu - View commit details
-
Copy full SHA for ceb788d - Browse repository at this point
Copy the full SHA ceb788dView commit details -
Configuration menu - View commit details
-
Copy full SHA for fd098e6 - Browse repository at this point
Copy the full SHA fd098e6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0b594b6 - Browse repository at this point
Copy the full SHA 0b594b6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 72d053e - Browse repository at this point
Copy the full SHA 72d053eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 6bf8c3c - Browse repository at this point
Copy the full SHA 6bf8c3cView commit details -
Configuration menu - View commit details
-
Copy full SHA for f3a7f8a - Browse repository at this point
Copy the full SHA f3a7f8aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 84aadc2 - Browse repository at this point
Copy the full SHA 84aadc2View commit details -
Configuration menu - View commit details
-
Copy full SHA for a14ced3 - Browse repository at this point
Copy the full SHA a14ced3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0958168 - Browse repository at this point
Copy the full SHA 0958168View commit details -
Sorting keys in a VoterSet is now redundant.
Due to switching to a BTreeMap.
Configuration menu - View commit details
-
Copy full SHA for 7ded42e - Browse repository at this point
Copy the full SHA 7ded42eView commit details
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.