Cap indexer API4 per-request cost on GT events, progress, and blacklist-check (#694) #1193
No reviewers
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic!1193
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/694-api4-per-request-caps"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #694
Summary
OWASP API4 per-request caps (audit
INTERNAL_GROK46_1787908099RE-01 / RE-02 / RE-03). Request-count governors stay; each HTTP hit is now bounded.GET /gt/eventsCOUNTs swap+liq with the same gem-exclusion WHERE, then 400event count exceeds 5000when overMAX_GT_EVENT_ROWS(5000). No truncation. GET still does notSELECTpair_reserves(post-#684 event columns).GET /api/v1/route/solve/progressis onlcd_heavy_router(10 RPS).GetDiscountis cached 12s per(trader, sender). Optional progress-onlydiscount_bpsis ignored by solve quote math.blacklist-checktokens≤ 16,pairs≤ 8 (trim/empty-drop). Oversize 400 (fail-closed). Route is onlcd_heavy_router. Factory errors stay sanitized 502.traderwhen the parent quote already hasdiscount_bps; exponential backoff after consecutive progress failures. Quote math /refetchIntervals unchanged.Playbook:
skills/AGENTS_INDEXER_API4_PER_REQUEST.md(A694-1–A694-8). QA:make verify-issue-694.Test plan
make verify-issue-694(twice: 5/5, real test counts)security.rs: 429 on progress +/best+ blacklist-check; tokens 17 / pairs 9 → 400; at-cap + empty → 200; LCD down → 502api_gt.rs: 5001 rows → 400; 5000 rows → 200api_route_solve.rs: 3 progress polls, 1 LCDGetDiscountdiscount_bpsquery param (45 tests)/gt/eventsstays bounded; progress with trader is not 1:1 LCDAcceptance criteria
/gt/eventsnever returns more than 5000; over-cap is 400 (documented message, no truncation)/gt/eventsdoes notSELECTall ofpair_reserves(already true post-#684; grep-guarded)traderdoes not LCDGetDiscounton every poll within the 12s TTLtokens/pairsover cap → 400; at-cap still queries factory; factory error still sanitized 502security.rscovers 429 on progress + blacklist-check +/bestand the new 400smake verify-issue-694exists and is wired in Makefile / AGENTS.mddocs/indexer-invariants.mdrecords the caps and LCD-heavy routesNot in this MR
INTERNAL_GROK46_1787908099(follow-up when this lands)pair_reservesWHERE pair_id = ANY— GET never reads that table after #684mentioned in commit
3c4060aba0mentioned in issue #694
mentioned in issue #695
mentioned in issue #698
mentioned in issue #699
mentioned in issue #700
mentioned in commit
ba1d41bfd5