You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fast-path (out-of-competition) execution reuses a quote's solution to settle the matching order during an exclusivity window instead of running a full auction. For that the driver must keep the solution it computes at quote time (rn /quote discards it). Now we cache the fast-path quote solution in the driver, keyed by (auction_id, solution_id), and usesthose ids on the quote response so a later settle can find it.
Why cache the solution and not a ready Settlement: a quote runs against an unsigned order, so a submittable settlement can't be encoded/simulated until the real signed order exists at settle time. (tried this, goes beyond scope of the PR 🤔 )
Changes
add a quote_solutions cache to Competition (CachedQuoteSolution { auction, solution }) + cache_quote_solution(): no simulation, bounded like the settlements deque.
/quote caches the solution when the quote is fast-path and the request carries an auctionId, and echoes solutionId + auctionId on the response.
/quote request accepts auctionId; the handler now passes the whole Competition to Order::quote (was just &risk_detector) so it can reach the cache — the risk-detector filtering is unchanged.
add openApi docs and fix the request flag name fastPath → enableFastPath to match the code.
Out of scope / follow-ups:
Orderbook allocating auctionId from the shared auctions sequence and sending it in the /quote request (BE-56) — not included; the driver accepts the id but nothing supplies one yet
Fast-path settle path: read the cache, re-encode against the real signed order, submit (BE-57 / quote-reuse fork)
Observer/accounting for fast-path settlements (BE-61)
PR Review: Cache fast-path quote solutions in the driver
Read changed files & understand the change
Review domain logic (competition cache, quote.rs)
Review API DTOs & openapi
Review tests
Overall this is a clean, well-scoped change and the code reads well. Caching the solution (not a Settlement) is the right call given the unsigned quote order, the eviction/locking mirrors the existing settlements deque, the API renaming fastPath → enableFastPath is a doc fix (not a real break), and the request/response DTOs, openapi, and tests all line up consistently.
One point worth revisiting — posted inline:
Cache eviction bound is mis-sized for quotes (competition/mod.rs:558): reusing max_solutions_to_propose() * MAX_CONCURRENT_AUCTIONS (=5) from the settlements cache doesn't map to quote cadence; a cached fast-path solution could be evicted before its /settle arrives in the exclusivity window. Non-blocking since the settle path (BE-57) isn't wired up yet, but worth sizing against expected fast-path quote volume (or a time-based expiry) before it lands.
Nothing else stood out — the fast-path/auction_id gating in quote.rs, the Quote::try_new borrow change, and the serde skip_serializing_if on the new response fields are all correct.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fast-path (out-of-competition) execution reuses a quote's solution to settle the matching order during an exclusivity window instead of running a full auction. For that the driver must keep the solution it computes at quote time (rn
/quotediscards it). Now we cache the fast-path quote solution in the driver, keyed by(auction_id, solution_id), and usesthose ids on the quote response so a later settle can find it.Why cache the solution and not a ready
Settlement: a quote runs against an unsigned order, so a submittable settlement can't be encoded/simulated until the real signed order exists at settle time. (tried this, goes beyond scope of the PR 🤔 )Changes
quote_solutionscache toCompetition(CachedQuoteSolution { auction, solution }) +cache_quote_solution(): no simulation, bounded like thesettlementsdeque./quotecaches the solution when the quote is fast-path and the request carries anauctionId, and echoessolutionId+auctionIdon the response./quoterequest acceptsauctionId; the handler now passes the wholeCompetitiontoOrder::quote(was just&risk_detector) so it can reach the cache — the risk-detector filtering is unchanged.fastPath→enableFastPathto match the code.Out of scope / follow-ups:
auctionIdfrom the sharedauctionssequence and sending it in the/quoterequest (BE-56) — not included; the driver accepts the id but nothing supplies one yetRelated Issues
BE-58
Follow-ups: BE-56, BE-57, BE-61.