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
{{ message }}
Repository navigation
solana-orderbook: report the competition solutions in the order status - #5119
The order status endpoint tells the caller which solvers included an order and at what amounts, so the frontend can show them. GET /api/v1/orders/{uid}/status answered the solved, executing and traded statuses with an empty value list, a leftover from before the autopilot persisted competitions (BE-220).
The orderbook now lists every solution of the auction the status reports, worst to best as the EVM orderbook does, with the executed amounts when the solution includes the order and none when it does not. For a traded order that auction is the one that settled the order's latest trade. Otherwise it is the latest auction in which a solution executed the order, where EVM takes the latest auction overall.
Changes
solved, executing and traded statuses carry the auction's solutions from proposed_solutions and proposed_trade_executions
Index on proposed_trade_executions (order_uid) for that lookup
Reviewed the DTO conversion, the status handler wiring, and the find_order_solutions query against the solana.* schema and the autopilot's persistence/ranking code. This looks solid.
Verified correct:
uid DESC matches the intended worst→best-with-winner-last order: the autopilot assigns uid as the index of ranked (winners first, descending score) chained with filtered_out, so descending uid yields ascending score with the winner last (filtered-out solutions lead, same as the EVM enumerated() order).
The COALESCE auction pick is sound: settlements.auction_id is NOT NULL, so the latest-trade branch is reliable, and it correctly falls back to the latest executing auction when no settlement is indexed yet.
The LEFT JOIN can't multiply rows (pte PK is (auction_id, solution_uid, order_uid) filtered to one order), and executed_sell/executed_buy are always both-present or both-absent so the .zip() is safe.
solutions is a lazily-awaited future, so the extra query only runs for the three solution-carrying statuses.
New index backs both the fallback subquery and the join; trades(order_uid) already exists for the trade lookup.
One thing to fix (not in this diff):
crates/solana-orderbook/openapi.yml:421-425 — the CompetitionOrderStatus description still says the value list is "empty until the autopilot persists competition results", which this PR makes inaccurate. Worth updating so the spec matches the new behavior. Fix this →
Nothing else blocking — nice job keeping it aligned with the EVM endpoint and documenting the intentional divergences (latest trade vs first, latest executing auction vs latest overall) in the description.
· solana-services/be-431-order-status-solutions
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
The order status endpoint tells the caller which solvers included an order and at what amounts, so the frontend can show them.
GET /api/v1/orders/{uid}/statusanswered thesolved,executingandtradedstatuses with an emptyvaluelist, a leftover from before the autopilot persisted competitions (BE-220).The orderbook now lists every solution of the auction the status reports, worst to best as the EVM orderbook does, with the executed amounts when the solution includes the order and none when it does not. For a traded order that auction is the one that settled the order's latest trade. Otherwise it is the latest auction in which a solution executed the order, where EVM takes the latest auction overall.
Changes
solved,executingandtradedstatuses carry the auction's solutions fromproposed_solutionsandproposed_trade_executionsproposed_trade_executions (order_uid)for that lookupHow to test
New DB test, updated unit tests.
Related issues
BE-431