Add the Solana auction domain types and the open-orders cut - #4717
Add the Solana auction domain types and the open-orders cut#4717squadgazzz wants to merge 1 commit into
Conversation
|
Claude finished @squadgazzz's task in 2m 47s —— View job PR ReviewReviewed the auction domain types and the open-orders cut against the Verified:
One robustness note posted inline ( Nothing blocking. |
| .await? | ||
| .into_iter() | ||
| .map(Order::from_row) | ||
| .collect::<Result<_>>()?; |
There was a problem hiding this comment.
collect::<Result<_>>()? makes a single unconvertible row abort the entire cut, so the whole auction (all other valid orders) is dropped for that cycle. The SQL predicates in open_orders don't guarantee convertibility: sell_amount/buy_amount are numeric(78,0) with no non-negative or <= u64::MAX check, and valid_to is bigint narrowed to u32 here — any row that fails to_amount/try_into (a value wider than u64, negative, or valid_to > u32::MAX) takes down solving for every order in the cycle.
Since these are exactly the defensive conversions the wider DB types force, consider skipping + logging the offending row instead of failing the whole cut, e.g. filter_map the errors with a tracing::warn!. Given the demo scope this may be acceptable, but on-chain SPL amounts being u64 doesn't stop the orderbook/indexer from writing something the loop can't convert.
Description
PR06 of the Solana autopilot track, stacked on PR05 (#4711). Adds the auction domain: the solvable order typed over the shared chain vocabulary, the auction the loop fans out, and the cut from database rows.
The open-orders read is deliberately naive (unexpired, signed, not cancelled on chain), demo scope. The incremental fetch, checkpoint buffer, and the filter pipeline belong to the solvable-orders cache (BE-190). An order without an
order_pdarow counts as open: the PDA only appears on chain at settlement time.Changes
auction:OrderandAuctionoverchain_types::solana, with the loop'sAuctionInfoand an id-ignoringPartialEqfor the dedupe, pluscutassembling an auction from rowsdb:open_orderswith the solvability predicatesHow to test
New unit tests, plus an ignored DB test for the solvability predicates (run with the #4715 schema applied:
cargo nextest run -p autopilot-svm --run-ignored ignored-only). All pass locally.Related issues
Resolves BE-182.