Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a hide_competition_before_deadline configuration to restrict solver competition data visibility until the auction deadline is reached. Feedback identifies a performance issue in the V1 API implementation where an additional database query is executed per request, suggesting a join or DTO update instead. Additionally, a correction was suggested for error handling consistency when acquiring database connections in the new get_auction_deadline method.
MartinquaXD
left a comment
There was a problem hiding this comment.
LGTM.
Last nit: I think we should use <= block since the observed block already happened and revealing the information now can no longer affect the auction in question.
| -- exclude settlements from another environment for which observation is guaranteed to not exist | ||
| WHERE sc.id = $1 | ||
| LEFT JOIN competition_auctions ca ON sc.id = ca.id | ||
| WHERE sc.id = $1 AND ($2::bigint IS NULL OR ca.deadline < $2) |
There was a problem hiding this comment.
| WHERE sc.id = $1 AND ($2::bigint IS NULL OR ca.deadline < $2) | |
| WHERE sc.id = $1 AND ($2::bigint IS NULL OR ca.deadline <= $2) |
| -- outer joins because the data might not have been indexed yet | ||
| LEFT OUTER JOIN settlements s ON sc.id = s.auction_id | ||
| LEFT JOIN competition_auctions ca ON sc.id = ca.id | ||
| WHERE ($2::bigint IS NULL OR ca.deadline < $2) |
There was a problem hiding this comment.
| WHERE ($2::bigint IS NULL OR ca.deadline < $2) | |
| WHERE ($2::bigint IS NULL OR ca.deadline <= $2) |
| JOIN settlements s ON sc.id = s.auction_id | ||
| LEFT JOIN competition_auctions ca ON sc.id = ca.id | ||
| WHERE sc.id = (SELECT id FROM competition) AND s.solution_uid IS NOT NULL | ||
| AND ($2::bigint IS NULL OR ca.deadline < $2) |
There was a problem hiding this comment.
| AND ($2::bigint IS NULL OR ca.deadline < $2) | |
| AND ($2::bigint IS NULL OR ca.deadline <= $2) |
| const FETCH_AUCTION_ID: &str = r#" | ||
| SELECT id | ||
| FROM competition_auctions | ||
| WHERE ($1::bigint IS NULL OR deadline < $1) |
There was a problem hiding this comment.
| WHERE ($1::bigint IS NULL OR deadline < $1) | |
| WHERE ($1::bigint IS NULL OR deadline <= $1) |
| SELECT id, order_uids, price_tokens, price_values, block, deadline | ||
| FROM competition_auctions | ||
| WHERE id = $1; | ||
| WHERE id = $1 AND ($2::bigint IS NULL OR deadline < $2); |
There was a problem hiding this comment.
| WHERE id = $1 AND ($2::bigint IS NULL OR deadline < $2); | |
| WHERE id = $1 AND ($2::bigint IS NULL OR deadline <= $2); |
Description
Hides solver competition API data until the auction's submission deadline block has passed. Feature-gated via hide-competition-before-deadline (default off) to avoid breaking external solver monitoring that depends on these endpoints.
Changes
How to test