From 691218955bc9fe8cfdba55b03501945e0590e600 Mon Sep 17 00:00:00 2001 From: Derek Cofausper <256792747+decofe@users.noreply.github.com> Date: Fri, 27 Mar 2026 01:53:15 +0000 Subject: [PATCH] feat: raise HARD_LIMIT_MAX from 10k to 100k The 10k row limit silently truncates aggregate queries (GROUP BY + SUM) for high-volume tokens like PathUSD on the explorer. Aggregate queries return far fewer rows than raw scans, so 10k is unnecessarily restrictive. Co-authored-by: o-az <23618431+o-az@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d2c9a-d957-714c-add1-f823c928ddfe --- src/query/validator.rs | 6 +++--- src/service/mod.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/query/validator.rs b/src/query/validator.rs index e9e6e50e..b00768db 100644 --- a/src/query/validator.rs +++ b/src/query/validator.rs @@ -17,7 +17,7 @@ const ALLOWED_TABLES: &[&str] = &[ const MAX_QUERY_LENGTH: usize = 65_536; const MAX_SUBQUERY_DEPTH: usize = 4; -pub const HARD_LIMIT_MAX: i64 = 10_000; +pub const HARD_LIMIT_MAX: i64 = 100_000; /// Validates that a SQL query is safe to execute. /// @@ -914,13 +914,13 @@ mod tests { #[test] fn test_rejects_excessive_limit() { assert!(validate_query("SELECT * FROM blocks LIMIT 100000000").is_err()); - assert!(validate_query("SELECT * FROM blocks LIMIT 10001").is_err()); + assert!(validate_query("SELECT * FROM blocks LIMIT 100001").is_err()); } #[test] fn test_allows_reasonable_limit() { assert!(validate_query("SELECT * FROM blocks LIMIT 100").is_ok()); - assert!(validate_query("SELECT * FROM blocks LIMIT 10000").is_ok()); + assert!(validate_query("SELECT * FROM blocks LIMIT 100000").is_ok()); assert!(validate_query("SELECT * FROM blocks LIMIT 1 OFFSET 5").is_ok()); } diff --git a/src/service/mod.rs b/src/service/mod.rs index a32d20f4..ceb739a9 100644 --- a/src/service/mod.rs +++ b/src/service/mod.rs @@ -470,7 +470,7 @@ mod tests { fn test_query_options_default() { let options = QueryOptions::default(); assert_eq!(options.timeout_ms, 5000); - assert_eq!(options.limit, 10000); + assert_eq!(options.limit, 100000); } // ========================================================================