Don't use fixed nominator count for report_equivocation weight calculation (#14471)

* babe: fix report_equivocation weight calculation

* grandpa: fix report_equivocation weight calculation

* beefy: fix report_equivocation weight calculation

* runtime: add missing MaxNominators constant
This commit is contained in:
André Silva
2023-07-18 15:11:00 +01:00
committed by GitHub
parent a3a04c7e4d
commit 50a63c30d9
16 changed files with 59 additions and 36 deletions
+2 -2
View File
@@ -815,7 +815,7 @@ fn report_equivocation_has_valid_weight() {
// the weight depends on the size of the validator set,
// but there's a lower bound of 100 validators.
assert!((1..=100)
.map(<Test as Config>::WeightInfo::report_equivocation)
.map(|validators| <Test as Config>::WeightInfo::report_equivocation(validators, 1000))
.collect::<Vec<_>>()
.windows(2)
.all(|w| w[0] == w[1]));
@@ -823,7 +823,7 @@ fn report_equivocation_has_valid_weight() {
// after 100 validators the weight should keep increasing
// with every extra validator.
assert!((100..=1000)
.map(<Test as Config>::WeightInfo::report_equivocation)
.map(|validators| <Test as Config>::WeightInfo::report_equivocation(validators, 1000))
.collect::<Vec<_>>()
.windows(2)
.all(|w| w[0].ref_time() < w[1].ref_time()));