Skip to content

Voting + round-change#8

Merged
rphmeier merged 21 commits intomasterfrom
rh-voting
Sep 18, 2018
Merged

Voting + round-change#8
rphmeier merged 21 commits intomasterfrom
rh-voting

Conversation

@rphmeier
Copy link
Copy Markdown
Contributor

@rphmeier rphmeier commented Sep 10, 2018

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 Voter future, which relies on an Environment implementation for setting up timers and networking and to pass finality information to.

The Voter has a best_round and some background_rounds which 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 Environment layer: 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.

Copy link
Copy Markdown
Contributor

@gnunicorn gnunicorn left a comment

Choose a reason for hiding this comment

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

LGTM

last_round_estimate.0
}
Some(ref primary_block) => {
// we will vote for the best chain containing `p_hash` iff
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

typo iff

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"based on " ... I guess we are missing something here?

@rphmeier rphmeier merged commit 401da1f into master Sep 18, 2018
@andresilva andresilva deleted the rh-voting branch June 13, 2022 14:20
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