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
fix: keep every Portal request under MAX_RAW_QUERY_SIZE (256KB) — merge log filters + fail loud
Root cause (from sqd-network transport/src/protocol.rs): the Portal 400 "Query is too large" checks
the raw request BODY size against MAX_RAW_QUERY_SIZE = 256*1024, NOT range/data — so my earlier
range-bisect was treating the wrong variable (reverted). The 24-event EVault superset blew the body
up because ponder emits one filter per event, and the fork repeated the full child-address list once
per event (24 × ~265 addrs ≈ 270KB).
- mergeLogRequests(): fold log requests sharing an address set + topic1..3 into one, unioning topic0
→ identical results, ~N× smaller body. Euler's worst (eth: 897 children × 24 topics) ≈ 41KB, 6× under.
- Uniform proactive guard in fetchBatch (the single POST choke point) covers EVERY request type
(logs/traces/txs/discovery): a body over 256KB throws an explicit error naming the size + the driver
(log vs tx from/to address counts) instead of an opaque Portal 400. tx from/to sets can't be safely
address-split, so those fail loud by design.
- 2 regression tests (merge folds N filters → 1; over-limit body fails loud). 24/24.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
`Portal request body ${(body.length/1024).toFixed(1)}KB exceeds MAX_RAW_QUERY_SIZE ${MAX_RAW_QUERY_SIZE/1024}KB @ ${cursor}. `+
235
+
`Filter addresses in this request: ${nLog} log + ${nTx} tx(from/to). `+
236
+
`Log filters are already merged+batched (PORTAL_MAX_ADDRESSES=${PORTAL_MAX_ADDRESSES}); if this is a tx filter, its from/to set is too large to fit one request and cannot be safely split — narrow the filter.`,
// dense window exceeded the Portal's query estimate → halve it and retry. Continuation
314
-
// then covers [hi+1, to] as usual, so no data is skipped.
315
-
if(hi<=cursor)throwerr;// a single block still too large ⇒ a real limit, surface it
316
-
hi=cursor+Math.floor((hi-cursor)/2);
317
-
continue;
331
+
// Portal caps request BYTES (MAX_RAW_QUERY_SIZE), not range — so bisecting blocks can't
332
+
// help. mergeLogRequests already de-dups addresses across event filters; if a body still
333
+
// exceeds the cap the address batch itself is too big → fail loud with the actual lever.
334
+
thrownewError(`Portal query body exceeds MAX_RAW_QUERY_SIZE even after merging event filters — lower PORTAL_MAX_ADDRESSES (currently ${PORTAL_MAX_ADDRESSES}) to shrink the address batch. @ ${cursor}`);
318
335
}
319
336
if(err?.datasetStartsAt!==undefined){
320
337
// dataset begins after this chunk's start (doesn't reach genesis) → skip the missing
0 commit comments