Split SolutionImprovementThresholds into two types (#11221)

* Splitting `SolutionImprovementThreshold` in 2
One for Signed phase and one for Unsigned phase.

* Adding some tests

* Fixes after code review.
- Removing `GetDefault`.
- Shorter naming.
- More explicit test.
This commit is contained in:
Georges
2022-04-20 13:15:18 +01:00
committed by GitHub
parent 831753d42c
commit 85f7d63531
5 changed files with 75 additions and 15 deletions
@@ -624,7 +624,7 @@ impl<T: Config> Pallet<T> {
ensure!(
Self::queued_solution().map_or(true, |q: ReadySolution<_>| raw_solution
.score
.strict_threshold_better(q.score, T::SolutionImprovementThreshold::get())),
.strict_threshold_better(q.score, T::BetterUnsignedThreshold::get())),
Error::<T>::PreDispatchWeakSubmission,
);
@@ -1066,7 +1066,7 @@ mod tests {
.desired_targets(1)
.add_voter(7, 2, bounded_vec![10])
.add_voter(8, 5, bounded_vec![10])
.solution_improvement_threshold(Perbill::from_percent(50))
.better_unsigned_threshold(Perbill::from_percent(50))
.build_and_execute(|| {
roll_to(25);
assert!(MultiPhase::current_phase().is_unsigned());