Skip to content

Commit

Permalink
[EASY] Simplify scoring error (#2599)
Browse files Browse the repository at this point in the history
# Description
Related to code review fixes -
#2585 (comment)

Commented but forgot to actually commit changes before merging.

As mentioned, further improvements will be done as part of
#2597
  • Loading branch information
sunce86 authored Apr 8, 2024
1 parent 2e6fbac commit c8d14ff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions crates/driver/src/domain/competition/solution/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ impl Solution {
sell: *self
.prices
.get(&trade.order().sell.token.wrap(self.weth))
.ok_or(error::Solution::InvalidClearingPrices)?,
.ok_or(error::Scoring::InvalidClearingPrices)?,
buy: *self
.prices
.get(&trade.order().buy.token.wrap(self.weth))
.ok_or(error::Solution::InvalidClearingPrices)?,
.ok_or(error::Scoring::InvalidClearingPrices)?,
};
let custom_prices = scoring::CustomClearingPrices {
sell: match trade.order().side {
Expand Down Expand Up @@ -518,8 +518,8 @@ pub mod error {

#[derive(Debug, thiserror::Error)]
pub enum Scoring {
#[error(transparent)]
Solution(#[from] Solution),
#[error("invalid clearing prices")]
InvalidClearingPrices,
#[error(transparent)]
Math(#[from] Math),
#[error(transparent)]
Expand Down
4 changes: 2 additions & 2 deletions crates/driver/src/infra/notify/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ pub fn scoring_failed(
err: &solution::error::Scoring,
) {
let notification = match err {
solution::error::Scoring::Solution(solution::error::Solution::InvalidClearingPrices) => {
solution::error::Scoring::InvalidClearingPrices => {
notification::Kind::ScoringFailed(ScoreKind::InvalidClearingPrices)
}
_ => return,
solution::error::Scoring::Math(_) | solution::error::Scoring::Score(_) => return,
};

solver.notify(auction_id, Some(solution_id.clone()), notification);
Expand Down

0 comments on commit c8d14ff

Please sign in to comment.