Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
squadgazzz committed Jan 20, 2025
1 parent 7917094 commit 98e7882
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions crates/driver/src/domain/competition/auction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,22 +151,22 @@ impl AuctionProcessor {
/// Fetches full app data for each order and returns an auction with
/// updated orders.
pub async fn process(&self, auction: Auction, solver: &eth::H160) -> Auction {
let (app_data_by_order, mut prioritized_orders) = join(
let (mut app_data_by_order, mut prioritized_orders) = join(
self.collect_orders_app_data(&auction),
self.prioritize_orders(&auction, solver),
)
.await;

// Filter out orders that failed to fetch app data.
prioritized_orders.retain_mut(|order| {
app_data_by_order.get(&order.uid).map_or(true, |result| {
app_data_by_order.remove(&order.uid).map_or(true, |result| {
match result {
Err(err) => {
tracing::warn!(order_uid=?order.uid, ?err, "failed to fetch app data for order, excluding from auction");
false
}
Ok(Some(app_data)) => {
order.app_data = app_data.clone().into();
order.app_data = app_data.into();
true
}
Ok(None) => true
Expand Down
4 changes: 2 additions & 2 deletions crates/driver/src/tests/setup/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl Driver {
config: &Config,
solvers: &Vec<(Solver, SocketAddr)>,
blockchain: &Blockchain,
orderbook: Orderbook,
orderbook: &Orderbook,
) -> Self {
let (config_file, config_temp_path) = match config.config_file.as_ref() {
Some(config_file) => (config_file.to_owned(), None),
Expand All @@ -51,7 +51,7 @@ impl Driver {
"--ethrpc".to_owned(),
blockchain.web3_url.clone(),
"--orderbook-url".to_owned(),
format!("http://{:?}", orderbook.addr).to_owned(),
format!("http://{}", orderbook.addr).to_owned(),
"--config".to_owned(),
config_file.to_str().unwrap().to_owned(),
];
Expand Down
2 changes: 1 addition & 1 deletion crates/driver/src/tests/setup/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ impl Setup {
},
&solvers_with_address,
&blockchain,
orderbook,
&orderbook,
)
.await;

Expand Down
2 changes: 1 addition & 1 deletion crates/driver/src/tests/setup/orderbook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl Orderbook {

/// Default mock handler that always returns 404 Not Found.
async fn mock_handler(Path(app_data): Path<String>) -> StatusCode {
println!("Received app_data request: {}", app_data);
println!("Orderbook received an app_data request: {}", app_data);
StatusCode::NOT_FOUND
}
}

0 comments on commit 98e7882

Please sign in to comment.