Skip to content

Commit

Permalink
Filter jit orders for settlement throughput metric (#2847)
Browse files Browse the repository at this point in the history
# Description
We have been seeing an increasing number of alerts about insufficient
settlement throughput (specifically on Gnosis Chain). From what I can
tell this is mainly due to jit orders with tiny amounts not being
considered by more sophisticated (external) solvers and thus increasing
this metric.

The easiest fix is to simply exclude those orders from the metric.

Alternatively, we could also define a "surplus threshold" and ignore
orders that have very little surplus. However, I think since these jit
orders are passive liquidity and our "settlement throughput" metric
intends to be user facing, filtering these orders out completely seems
like a good and simpler choice

# Changes
- [x] Add filter to remove all orders that were not part of the auction

## How to test
Once deployed in prod, expect much reduced logs of the form
  • Loading branch information
fleupold authored Jul 31, 2024
1 parent f84ff2f commit dbde7ba
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/autopilot/src/run_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,16 @@ impl RunLoop {
}
}
let solution_uids = solution.order_ids().copied().collect::<HashSet<_>>();
let auction_uids = auction.orders.iter().map(|o| o.uid).collect::<HashSet<_>>();

let unsettled_orders: HashSet<_> = solutions
.iter()
// Report orders that were part of any solution candidate
.flat_map(|p| p.solution.order_ids())
// but not part of the winning one
.filter(|uid| !solution_uids.contains(uid))
// yet still part of the auction (filter out jit orders)
.filter(|uid| auction_uids.contains(uid))
.collect();
Metrics::matched_unsettled(driver, unsettled_orders);
}
Expand Down

0 comments on commit dbde7ba

Please sign in to comment.