hotstuff_rs::hotstuff::roles

Function is_validator

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

Determine whether the replica is an “active” validator, given the current validator_set_state.

An active validator can:

§is_validator logic

Whether or not replica is an active validator given the current validator_set_state depends on two factors:

  1. Whether replica is part of the Committed Validator Set (CVS), the Previous Validator Set (PVS), both validator sets, or neither.
  2. Whether validator_set_state.update_decided() or not.

The below table specifies exactly the return value of is_validator in every possible combination of the two factors:

Validator Set Update DecidedValidator Set Update Not Decided
Part of CVS (and maybe also PVS)truetrue
Part of PVS onlyfalsetrue
Part of neither neither CVS or PVSfalsefalse