mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-20 01:11:08 +00:00
NPoS Challenge Mode (#8236)
* Add PJR challenge functions - Updates the PJR check to return a counterexample if one exists - Adds functions to cheaply check counterexamples This is in support of off-chain PJR challenges: if a miner discovers that an accepted election solution does not satisfy PJR, it will be eligible for substantial rewards. This helps ensure that validator elections have an absolute quality floor, so even if someone manages to censor well-behaved solutions to give themselves unfair representation, we can catch them in the act and penalize them. * counterexample -> counter_example * reorganize: high -> low abstraction * reorganize challenges high -> low abstraction * add note justifying linear search * Simplify max_pre_score validation Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * add minor test of pjr challenge validation Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
844e25522c
commit
49be0579db
@@ -112,7 +112,7 @@ fn iteration(mut candidate_count: usize, mut voter_count: usize, seed: u64) {
|
||||
let threshold = standard_threshold(rounds, voters.iter().map(|voter| voter.budget()));
|
||||
|
||||
assert!(
|
||||
pjr_check_core(&candidates, &voters, threshold),
|
||||
pjr_check_core(&candidates, &voters, threshold).is_ok(),
|
||||
"unbalanced sequential phragmen must satisfy PJR",
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user