Conversation
gnunicorn
approved these changes
Sep 17, 2018
| last_round_estimate.0 | ||
| } | ||
| Some(ref primary_block) => { | ||
| // we will vote for the best chain containing `p_hash` iff |
Contributor
Author
There was a problem hiding this comment.
no, iff is shorthand for "if and only if"
src/voter.rs
Outdated
|
|
||
| if last_state.finalized != new_state.finalized && new_state.completable { | ||
| // send notification only when the round is completable and we've cast votes. | ||
| // this is a workaround for avoiding restarting the round based on |
Contributor
There was a problem hiding this comment.
"based on " ... I guess we are missing something here?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request implements the actual algorithm of the finality gadget, including choosing when to start rounds, how to react to messages, choosing blocks to cast votes on, and producing finality notifications.
Most of the changes here is the introduction of a
Voterfuture, which relies on anEnvironmentimplementation for setting up timers and networking and to pass finality information to.The
Voterhas abest_roundand somebackground_roundswhich are prior. Background rounds are kept and continued to be polled until a block with the same number as their round-estimate is finalized. This is safe because the round-estimate is a calculation of the best possible block that could be finalized in that round -- once we've finalized something equal to or beyond that point, the round becomes irrelevant.This does pass on a lot of the work of correct communication to the
Environmentlayer: all signing, message routing, and buffering of incoming messages is left outside of this crate for now (although creating some common utilities for that) may be useful in the future.