From 936ee1cf635703ebb5208e9baf28c7e2d798e001 Mon Sep 17 00:00:00 2001 From: 0X-SquidSol Date: Thu, 9 Apr 2026 13:17:36 -0400 Subject: [PATCH] fix: align price validation ceiling in /funding/:slab with /markets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The /funding/:slab endpoint used MAX_SANE_PRICE_USD = 1,000,000 ($1M) while /markets uses 1,000,000,000 ($1B) for the same last_price field from the same markets_with_stats view. The comment even claimed "same ceiling used in /markets" which was incorrect. An asset priced between $1M and $1B would show a valid lastPrice in /markets but null in /funding/:slab metadata — inconsistent behavior. Aligns to $1B to match /markets. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/routes/funding.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/funding.ts b/src/routes/funding.ts index 74a0bc9..2adfd98 100644 --- a/src/routes/funding.ts +++ b/src/routes/funding.ts @@ -177,8 +177,8 @@ export function fundingRoutes(): Hono { })); // GH#1511: Sanitize last_price from markets_with_stats — same ceiling used - // in /api/markets to guard against unscaled admin-set test prices. - const MAX_SANE_PRICE_USD = 1_000_000; + // in /markets to guard against unscaled admin-set test prices. + const MAX_SANE_PRICE_USD = 1_000_000_000; const rawLastPrice = Number(stats.last_price ?? 0); const sanitizedLastPrice = rawLastPrice > 0 && rawLastPrice <= MAX_SANE_PRICE_USD ? rawLastPrice : null;