Skip to content

Commit

Permalink
Add is_winner to solver competition endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
m-lord-renkse committed Nov 14, 2024
1 parent 5671152 commit c7cde9c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/autopilot/src/run_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ impl RunLoop {
.iter()
.map(|(token, price)| (token.0, price.get().into()))
.collect(),
is_winner: participant.is_winner(),
})
.collect(),
};
Expand Down
2 changes: 2 additions & 0 deletions crates/e2e/tests/e2e/solver_competition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,10 @@ async fn solver_competition(web3: Web3) {

// Non winning candidate
assert!(competition.common.solutions[0].ranking == 2);
assert!(competition.common.solutions[0].is_winner == false);
// Winning candidate
assert!(competition.common.solutions[1].ranking == 1);
assert!(competition.common.solutions[1].is_winner == true);
}

async fn fairness_check(web3: Web3) {
Expand Down
2 changes: 2 additions & 0 deletions crates/model/src/solver_competition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ pub struct SolverSettlement {
#[serde_as(as = "BTreeMap<_, HexOrDecimalU256>")]
pub clearing_prices: BTreeMap<H160, U256>,
pub orders: Vec<Order>,
pub is_winner: bool,
}

#[serde_as]
Expand Down Expand Up @@ -208,6 +209,7 @@ mod tests {
executed_amount: 14.into(),
},
],
is_winner: true,
}],
},
};
Expand Down
3 changes: 3 additions & 0 deletions crates/orderbook/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1504,6 +1504,9 @@ components:
description: Maps from solver name to object describing that solver's settlement.
items:
$ref: "#/components/schemas/SolverSettlement"
isWinner:
type: boolean
description: whether the solution is a winner or not
SolverSettlement:
type: object
properties:
Expand Down

0 comments on commit c7cde9c

Please sign in to comment.