From 8ff68254db4d05873cf804aa613360ab0eb0ae79 Mon Sep 17 00:00:00 2001 From: Mateo Date: Thu, 12 Dec 2024 15:22:45 +0100 Subject: [PATCH] fix --- crates/driver/src/domain/competition/bad_tokens.rs | 4 +--- crates/driver/src/infra/api/mod.rs | 6 +++--- crates/driver/src/infra/config/file/mod.rs | 1 + 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/crates/driver/src/domain/competition/bad_tokens.rs b/crates/driver/src/domain/competition/bad_tokens.rs index 34abea5d27..95f8d36f7c 100644 --- a/crates/driver/src/domain/competition/bad_tokens.rs +++ b/crates/driver/src/domain/competition/bad_tokens.rs @@ -151,9 +151,7 @@ impl Detector { } async fn determine_sell_token_quality(&self, order: &Order, now: Instant) -> Option { - let Some(detector) = self.simulation_detector.as_ref() else { - return None; - }; + let detector = self.simulation_detector.as_ref()?; if let Some(quality) = self.cache.get_quality(order.sell.token, now) { return Some(quality); diff --git a/crates/driver/src/infra/api/mod.rs b/crates/driver/src/infra/api/mod.rs index 11145c2f84..aefa013cd5 100644 --- a/crates/driver/src/infra/api/mod.rs +++ b/crates/driver/src/infra/api/mod.rs @@ -82,7 +82,7 @@ impl Api { let router = routes::reveal(router); let router = routes::settle(router); - let bad_tokens = solver.bad_token_detector().and_then(|bad_token_detector| { + let bad_tokens = solver.bad_token_detector().map(|bad_token_detector| { // maybe make this as part of the bad token builder? let config = bad_token_detector .unsupported_tokens @@ -96,13 +96,13 @@ impl Api { ) .collect::>(); - Some(Arc::new( + Arc::new( // maybe do proper builder pattern here? bad_tokens::Detector::default() .with_simulation_detector(&self.eth.clone()) .with_config(config) .with_cache(trace_detector.clone()), - )) + ) }); let router = router.with_state(State(Arc::new(Inner { diff --git a/crates/driver/src/infra/config/file/mod.rs b/crates/driver/src/infra/config/file/mod.rs index eac55ce173..c3e5dd2942 100644 --- a/crates/driver/src/infra/config/file/mod.rs +++ b/crates/driver/src/infra/config/file/mod.rs @@ -70,6 +70,7 @@ struct Config { archive_node_url: Option, /// Cache configuration for the bad tokend detection + #[serde(default)] bad_token_detection_cache: BadTokenDetectionCache, }