Skip to content

Commit

Permalink
change if leading to fail on equal score (#589)
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasad1 authored Jun 2, 2023
1 parent 956ada5 commit 0890748
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/commands/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -609,8 +609,7 @@ pub(crate) fn score_passes_strategy(
match strategy {
SubmissionStrategy::Always => true,
SubmissionStrategy::IfLeading =>
our_score == best_score ||
our_score.strict_threshold_better(best_score, Perbill::zero()),
our_score.strict_threshold_better(best_score, Perbill::zero()),
SubmissionStrategy::ClaimBetterThan(epsilon) =>
our_score.strict_threshold_better(best_score, epsilon),
SubmissionStrategy::ClaimNoWorseThan(epsilon) =>
Expand Down Expand Up @@ -656,12 +655,12 @@ mod tests {
assert!(score_passes_strategy(s(5), s(10), SubmissionStrategy::Always));

// if leading
assert!(score_passes_strategy(s(0), s(0), SubmissionStrategy::IfLeading));
assert!(!score_passes_strategy(s(0), s(0), SubmissionStrategy::IfLeading));
assert!(score_passes_strategy(s(1), s(0), SubmissionStrategy::IfLeading));
assert!(score_passes_strategy(s(2), s(0), SubmissionStrategy::IfLeading));
assert!(!score_passes_strategy(s(5), s(10), SubmissionStrategy::IfLeading));
assert!(!score_passes_strategy(s(9), s(10), SubmissionStrategy::IfLeading));
assert!(score_passes_strategy(s(10), s(10), SubmissionStrategy::IfLeading));
assert!(!score_passes_strategy(s(10), s(10), SubmissionStrategy::IfLeading));

// if better by 2%
assert!(!score_passes_strategy(s(50), s(100), SubmissionStrategy::ClaimBetterThan(two)));
Expand Down

0 comments on commit 0890748

Please sign in to comment.