hotstuff_rs::hotstuff::roles

Function is_phase_voter

source
pub(crate) fn is_phase_voter(
    replica: &VerifyingKey,
    validator_set_state: &ValidatorSetState,
    justify: &PhaseCertificate,
) -> bool
Expand description

Determine whether or not replica should phase-vote for the Proposal or Nudge that justify was taken from. This depends on whether replica’s PhaseVotes can become part of quorum certificates that directly extend justify.

If this predicate evaluates to false, then it is fruitless to vote for the Proposal or Nudge that justify was taken from, since according to the protocol, the next leader will ignore the replica’s phase votes anyway.

§is_phase_voter Logic

replica’s phase vote can become part of PCs that directly extend justify if-and-only-if replica is part of the appropriate validator set in the validator_set_state, which is either the Committed Validator Set (CVS), or the Previous Validator Set (PVS). In turn, which of CVS and PVS is the appropriate validator set depends on two factors:

  1. Whether or not validator_set_update.update_decided(), and
  2. What justify.phase is:

The below table specifies which validator set replica must be in order to be a voter in every possible combination of the two factors:

Validator Set Update DecidedValidator Set Update Not Decided
Phase == Generic, Prepare, Precommit, or DecideCVSPVS
Phase == CommitCVSCVS

§Preconditions

justify satisfies safe_pc and is_correct, and the block tree updates associated with this justify have already been applied.