Skip to content

Commit

Permalink
Add some logging
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinquaXD committed Aug 9, 2022
1 parent 4edd1b7 commit c403f45
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion crates/driver/src/commit_reveal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,25 @@ impl CommitRevealSolver {
async fn commit_impl(&self, auction: Auction) -> Result<(SettlementSummary, Settlement)> {
let prices = auction.external_prices.clone();
let solutions = self.solver.solve(auction).await?;
tracing::debug!(?solutions, "received solutions");
let solutions = solutions
.into_iter()
.map(|solution| (self.solver.clone(), solution))
.collect();

let gas_price = self.gas_estimator.estimate().await?;
let (mut rated_settlements, _) = self
let (mut rated_settlements, errors) = self
.settlement_rater
.rate_settlements(solutions, &prices, gas_price)
.await?;

// TODO properly log simulation errors with tenderly links
tracing::debug!(
"settlement rating yielded {} successes and {} errors",
rated_settlements.len(),
errors.len()
);

rated_settlements.sort_by(|a, b| a.1.objective_value().cmp(&b.1.objective_value()));
if let Some((_, winning_settlement, _)) = rated_settlements.pop() {
let summary = SettlementSummary {
Expand Down

0 comments on commit c403f45

Please sign in to comment.