(fast1) Thread solution_id through price-estimation - #4855
Conversation
Adds an `Option<u64> solution_id` field to `Estimate`, `LegacyTrade`, `Trade` and `QuoteResponse`, plumbed through the trade-finding / verifier stack. Comes from the solver's quote response DTO and defaults to `None` for every existing call site. Standalone mechanical change: nothing yet reads `solution_id`. Later patches will store it in `proposed_solutions.id` for fast-path competition data. Signed-off-by: MartinquaXD <martin@cow.fi>
|
Claude finished @MartinquaXD's task in 1m 29s —— View job PR Review: Thread
|
fleupold
left a comment
There was a problem hiding this comment.
Not blocking, but for other reasons, I think it might be better if we chose and communicate a unique quote id with every quote request (rather than letting solvers chose it themselves optionally for fast path orders).
| /// `QuoteResponse.solution_id` and, ultimately, into | ||
| /// `proposed_solutions.id` when a fast-path quote is persisted. | ||
| #[serde(default)] | ||
| pub solution_id: Option<u64>, |
There was a problem hiding this comment.
I would prefer if we gave every quote request a unique id (not just the winning one) and send it as part of the request to solvers. This way they could later on see which specific call caused the winning quote and we could properly index every single quote response in our data infra as well.
That fast path quote request id could later serve as a solution id.
There was a problem hiding this comment.
Together with the quote request we already send a unique auction id. Later on we send the auction_id together with the solver's solution_id like we do with settle requests today.
There was a problem hiding this comment.
Sure, but why don't we simply create a unique quote request ID that we send to each solver (and the winning one becomes the actual quote ID)? This way we don't need them to also come up with a solution id (which may not be unique across solvers) and create this compound primary key (fake auction id + solution id).
This would also generalize for non fast path quotes, which currently are hard to identify in clickhouse and allow solvers to map which of the many quote request we send them ended up being used on the final order.
There was a problem hiding this comment.
I'm bringing this up now, because changing it later on will be much more expensive. If we see a benefit in having globally unique quote IDs, I think now is the moment to introduce them (and reuse them for fast path solution identification).
I also don't think the change would be that expensive to implement.
There was a problem hiding this comment.
For streamed quotes for instance, we probably need a unique ID for each response, so the client can place an order from any of the responses (and not wait for some final ID to arrive at the end).
| // Renamed to match the driver's `enableFastPath` field name. | ||
| #[serde( | ||
| rename = "enableFastPath", |
There was a problem hiding this comment.
nano nit:
| // Renamed to match the driver's `enableFastPath` field name. | |
| #[serde( | |
| rename = "enableFastPath", | |
| #[serde( | |
| // Renamed to match the driver's `enableFastPath` field name. | |
| rename = "enableFastPath", |
| /// Solver-assigned solution id for this quote. Threaded through to | ||
| /// `QuoteResponse.solution_id` and, ultimately, into | ||
| /// `proposed_solutions.id` when a fast-path quote is persisted. | ||
| #[serde(default)] | ||
| pub solution_id: Option<u64>, |
There was a problem hiding this comment.
The "threaded through" can rot and we can always use editor functions to follow, I'd say a description of the systems it needs to go through would be better
| /// Solver-assigned solution id for this trade, if the response carried | ||
| /// one. |
There was a problem hiding this comment.
nano-nit (apply to others if you take this suggestion):
| /// Solver-assigned solution id for this trade, if the response carried | |
| /// one. | |
| /// Solver-assigned solution id for this trade, | |
| /// if the response carried one. |
| /// execution for this order. | ||
| pub supports_fast_path: bool, | ||
| /// Solver-assigned solution id when the underlying quote response | ||
| /// carried one. Threaded end-to-end into `QuoteResponse.solution_id`. |
There was a problem hiding this comment.
comment about the threading applies here too
| /// response carries one. Populated into `proposed_solutions.id` when | ||
| /// the quote is persisted as fast-path competition data. |
There was a problem hiding this comment.
its not clear what this "proposed_solutions" is about
Description
Fast path quotes are supposed to be treated as firm commitments. In order to store the solutions properly in the DB and have the autopilot reference a specific solution in the
/settlecall we need to receive a solution ID from the driver and thread it through the program.Changes
add
solution_idto quote response DTO and thread the data through the programalso uses
serde(rename)for the currently misaligned flag indicating whether fast path orders are supported with the quote - this will be cleaned up laterHow to test
e2e tests coming up at the end of the PR stack