fix(indexer): price-window has_more counts in-band rows only (#270) #735
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!735
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "qa/270-price-window-has-more"
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?
Fixes #270.
fetch_limit_book_price_windowreportedhas_more: truewhenever the FIFO chain continued past the band, even when the whole in-band slice fit one page — because it usedhas_more = current.is_some(), the same rule as full-book pagination. For a price windowhas_moremust mean "another page may return more in-band rows for this band", not "the book continues outside the band".Fix (price window only —
fetch_limit_book_pageuntouched)has_more = false(in-band region is exhausted; the book is price-ordered). Zero extra LCD query — just the boolean flips.has_more = false.has_more = trueonly if it classifies in-band. The peek costs onefetch_limit_order, gated on the per-page budget (LIMIT_BOOK_LCD_QUERY_BUDGET = 101): if the budget is already spent,has_morestaystrue— a bounded over-report (next page returns the remaining in-band rows or one empty past-band page, thenfalse), mirroring the merged-streamhas_more = current.is_some() || budget_exhaustedpattern.next_after_order_idstays the last returned in-band id;orders[], band inclusivity, bid/ask rules, the budget constant, and LCD query counting are all unchanged.Side effect (documented in the fn doc-comment): a broken/wrong-side immediate successor now surfaces its corrupt-book 400 one page earlier for the price-window route — the same integrity checks the walk loop already applies; a healthy book never hits it.
Tests (
api_limit_book_insert_hints)…→4@1.0→5@0.5), above-band ask tail (…→13@1.5→14@2.0).price_window_has_more_excludes_out_of_band_tail— bid and ask through both exit paths: past_band tail, cap-at-floor, cap<depth multi-page (page-1has_more+ cursor, page-2 remainder thenfalse), empty band. Includes LCD query-count asserts: past_band adds 0 peek queries; a page-full in-band peek adds exactly 1.price_window_has_more_budget_exhaustion_over_reports— deep all-in-band book,limit=100: page fills as the budget is spent →has_more=trueover-report, cursor = last in-band id, 101 queries (peek suppressed, no 102nd LCD call).Verification
cargo test -p cl8y-dex-indexer --test api_limit_book_insert_hints: 5 passed.api_limit_book_lcd_mock5,api_limit_book_deep1 — still green (incl. the original[1.5,1.0]window case).cargo clippy -p cl8y-dex-indexer --all-targets: clean on touched files (remaining lints are pre-existing toolchain drift in other modules).docs/integrators.mddocuments the price-windowhas_moresemantics.Closes #270 once merged.
mentioned in issue #270
mentioned in commit
d8ed85583e