Function sp_npos_elections::pjr::validate_pjr_challenge
source · pub fn validate_pjr_challenge<AccountId: IdentifierT>(
counter_example: AccountId,
supports: &Supports<AccountId>,
all_candidates: Vec<AccountId>,
all_voters: Vec<(AccountId, VoteWeight, Vec<AccountId>)>,
) -> bool
Expand description
Validate a challenge to an election result.
A challenge to an election result is valid if there exists some counter_example for which
pre_score(counter_example) >= threshold
. Validating an existing counter_example is
computationally cheaper than re-running the PJR check.
This function uses the standard threshold.
Returns true
if the challenge is valid: the proposed solution does not satisfy PJR.
Returns false
if the challenge is invalid: the proposed solution does in fact satisfy PJR.