Skip to content

Commit

Permalink
[EASY] Bug: Count the protocol fees for the scoring in all the cases (#…
Browse files Browse the repository at this point in the history
…2569)

# Description
We need to count the protocol fees for the scoring in all the cases.

See @fleupold 's comment:
#2544 (comment)

# Changes
- Count the protocol fees for the scoring in all the cases

## How to test
1. Regression tests
  • Loading branch information
m-lord-renkse authored Mar 28, 2024
1 parent aac88df commit 3feb99e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
9 changes: 1 addition & 8 deletions crates/driver/src/domain/competition/solution/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ pub struct Solution {
score: SolverScore,
weth: eth::WethAddress,
gas: Option<eth::Gas>,
fee_handler: FeeHandler,
}

impl Solution {
Expand All @@ -73,7 +72,6 @@ impl Solution {
score,
weth,
gas,
fee_handler,
};

// Check that the solution includes clearing prices for all user trades.
Expand Down Expand Up @@ -190,11 +188,7 @@ impl Solution {
trade.order().side,
executed,
custom_prices,
if self.fee_handler == FeeHandler::Driver {
trade.order().protocol_fees.clone()
} else {
vec![]
},
trade.order().protocol_fees.clone(),
))
}

Expand Down Expand Up @@ -289,7 +283,6 @@ impl Solution {
},
weth: self.weth,
// Same solver are guaranteed to have the same fee handler
fee_handler: self.fee_handler,
gas: match (self.gas, other.gas) {
(Some(gas), Some(other_gas)) => Some(gas + other_gas),
(Some(gas), None) => Some(gas),
Expand Down
2 changes: 1 addition & 1 deletion crates/driver/src/tests/cases/protocol_fees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ async fn protocol_fee_calculated_on_the_solver_side() {
buy: 40.ether().into_wei(),
},
},
expected_score: 20.ether().into_wei(),
expected_score: 35.ether().into_wei(),
fee_handler: FeeHandler::Solver,
};

Expand Down

0 comments on commit 3feb99e

Please sign in to comment.