From 2c92f95b95fa8c99ff4be44787229caac49ee78c Mon Sep 17 00:00:00 2001 From: Martin Magnus Date: Fri, 25 Oct 2024 14:39:39 +0200 Subject: [PATCH] [EASY] Don't report encoding errors for merged solutions (#3084) # Description The majority of solutions that get discarded due to failing encoding/simulating/scoring are actually merged solutions. These solutions get merged by the driver and not by the solver. The driver does it naively so it's not really surprising that it tries to merge solutions which are incompatible (e.g. they could use the same liquidity source). # Changes To avoid alerting on false positives the solver has no control over we now only report solutions that come directly from the solver in a non-working state (i.e. only 1 sub-solution contained). --- crates/driver/src/domain/competition/mod.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/crates/driver/src/domain/competition/mod.rs b/crates/driver/src/domain/competition/mod.rs index 168c0d14cc..da3b3d112f 100644 --- a/crates/driver/src/domain/competition/mod.rs +++ b/crates/driver/src/domain/competition/mod.rs @@ -128,12 +128,16 @@ impl Competition { }) .collect::>() .filter_map(|(id, result)| async move { - result - .tap_err(|err| { - observe::encoding_failed(self.solver.name(), &id, err); - notify::encoding_failed(&self.solver, auction.id(), &id, err); - }) - .ok() + match result { + Ok(solution) => Some(solution), + // don't report on errors coming from solution merging + Err(_err) if id.solutions().len() > 1 => None, + Err(err) => { + observe::encoding_failed(self.solver.name(), &id, &err); + notify::encoding_failed(&self.solver, auction.id(), &id, &err); + None + } + } }); // Encode settlements as they arrive until there are no more new settlements or