Files
observer/crates/blackbeard-data/migrations/0016_requeue_pool_calls.sql
T
grenadeandClaude Opus 5.5 6152ba85c2
ci / gate (push) Successful in 4m5s
deploy / validate (push) Skipped
deploy / build (push) Successful in 9m0s
deploy / deploy-web (push) Successful in 8s
deploy / deploy-api (push) Successful in 19s
fix(api): queue only direct pool calls about the asset, and re-read the rest
The direct-call scan matched any transaction reaching the DCL contract,
which hosts hundreds of pools: 4,881 strangers' swaps queued in the first
hour after launch, from 176 signers, each to be fetched from a
rate-limited public endpoint — enough on its own to keep the market page
starved. A call now counts only when it moves the asset itself or its
arguments name the asset's contract, which every pool id holding it does;
a buy with any token names the pool, a sell is a transfer of the asset.

ref_pending keeps no arguments, so the bad entries cannot be filtered in
place: migration 0016 drops every entry not signed by the relay and the
scan's cursor, and the scan reads the span again from our node.

Refs #39

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015pkwBsR54NRmZyU4QVhvfj
2026-10-06 19:01:29 +03:00

14 lines
814 B
SQL

-- Re-read direct pool calls with the asset filter in place.
-- blackbeard/observer#39.
--
-- The first cut of the direct-call scan queued every transaction that called
-- the DCL contract, which hosts hundreds of pools: 4,151 strangers' swaps in
-- twenty minutes after launch, each waiting to be fetched from a rate-limited
-- public endpoint. ref_pending keeps no arguments, so the queue cannot be
-- filtered after the fact. Instead every entry the scan queued — anything not
-- signed by the relay, whose entries come from the intents scan and are
-- right — is dropped, and the scan's cursor is removed so it reads the same
-- span again from our node, queueing only calls about the asset.
delete from ref_pending where signer <> 'intents.near';
delete from intents_scan where asset like 'pool-calls:%';