Skip to content

Commit

Permalink
Different weights per validator in test
Browse files Browse the repository at this point in the history
  • Loading branch information
ElFantasma committed Mar 18, 2024
1 parent 416517a commit e6425e4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions node/libs/roles/src/validator/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,9 @@ fn test_validator_committee_weights() {

let setup = Setup::new(rng, 6);
// Validators weights
let weights = [800, 800, 800, 6000, 800, 800];
let weights = [1000, 600, 800, 6000, 900, 700];
// Expected sum of the validators weights
let sums = [800, 1600, 2400, 8400, 9200, 10000];
let sums = [1000, 1600, 2400, 8400, 9300, 10000];
let validators: Vec<WeightedValidator> = weights
.iter()
.enumerate()
Expand All @@ -314,10 +314,10 @@ fn test_validator_committee_weights() {
let view: ViewNumber = rng.gen();
let msg = make_replica_prepare(rng, view, &setup);
let mut qc = PrepareQC::new(msg.view.clone());
for n in 0..6 {
for (n, weight) in sums.iter().enumerate() {
let key = &setup.keys[n];
qc.add(&key.sign_msg(msg.clone()), &setup.genesis);
let signers = &qc.map[&msg];
assert_eq!(genesis.validators.weight(signers.clone()), sums[n]);
assert_eq!(genesis.validators.weight(signers.clone()), *weight);
}
}

0 comments on commit e6425e4

Please sign in to comment.