Problem
dealbot deal jobs call synapse.storage.createContext({ providerId }) → synapse-sdk StorageContext.resolveByProviderId, which fires getActivePieceCount + getAllDataSetMetadata per active data set (batch size ≥50) to metadata-select a set to reuse. On calibration dealbot has up to ~196 active data sets with a single provider (see #605), so one resolve fires ~132 eth_calls, ×2–3 per deal, with all SPs phase-locked to the same scheduler tick → 300–500 eth_call/s bursts at the top of the minute. These drain chain.love's calib token (currently 1000 req/min) in ~2–3s → eRPC ErrUpstreamsExhausted 429 storms (~9,748 chain.love 429s / 20h, ~12k Ankr-free budget trips). Mainnet is clean today (lower volume) but runs the same armed code path.
Evidence
Fix plan
Related
FilOzone/synapse-sdk#631, #851, #848; FilOzone/pdp#265; #603 (RPC timeout).
Done criteria
- Calibration deal-flow
eth_calls per deal bounded (not O(active data sets)).
- Calibration
ErrUpstreamsExhausted/429 storms eliminated; mainnet stays clean after v1.9.0.
Problem
dealbot deal jobs call
synapse.storage.createContext({ providerId })→ synapse-sdkStorageContext.resolveByProviderId, which firesgetActivePieceCount+getAllDataSetMetadataper active data set (batch size ≥50) to metadata-select a set to reuse. On calibration dealbot has up to ~196 active data sets with a single provider (see #605), so one resolve fires ~132eth_calls, ×2–3 per deal, with all SPs phase-locked to the same scheduler tick → 300–500eth_call/s bursts at the top of the minute. These drain chain.love's calib token (currently 1000 req/min) in ~2–3s → eRPCErrUpstreamsExhausted429 storms (~9,748 chain.love 429s / 20h, ~12k Ankr-free budget trips). Mainnet is clean today (lower volume) but runs the same armed code path.Evidence
getActivePieceCount2,219,getAllDataSetMetadata656 — standalone, no Multicall3 (matchesresolveByProviderId, not the piece-cleanupaggregate3path).getActivePieceCountis O(n)-in-pieces and OOG-reverts on large sets (getActivePieceCount fails with out-of-gas for large datasets pdp#265,getPdpDataSetfails on large data sets becausegetActivePieceCountreverts inside multicall synapse-sdk#851), so it dominates the failure sample.Fix plan
resolveByProviderId: replace batch enrichment with p-queue sliding window synapse-sdk#631 — metadata-filter first, replace O(n)getActivePieceCount > 0withgetActivePiecesByCursor(limit=1)(#848), bounded concurrency with real early-exit,Promise.allSettled. Validate with the rpc-tracer against a ~196-data-set fixture, thenpatch-packageinto dealbot.rateLimitAutoTune, set static budget ≈ chain.love cap, exclude 429 fromfailsafe.retry.Related
FilOzone/synapse-sdk#631, #851, #848; FilOzone/pdp#265; #603 (RPC timeout).
Done criteria
eth_calls per deal bounded (not O(active data sets)).ErrUpstreamsExhausted/429 storms eliminated; mainnet stays clean after v1.9.0.