W9-C5 Price validation bypassed when indexer is unavailable — buy and sell limit orders bypass market price enforcement #166
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#166
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Issue Summary
When the indexer is running, the UI enforces price rules on limit orders: buy limits must be placed below the current market reference price, and sell (ask) limits must be placed above it. When the indexer goes down, this validation is lost entirely for both sides — the UI accepts buy limit orders above market price and ask limit orders below market price. The trader receives no warning that price validation is degraded.
Reproduction Steps
Expected Behavior
Price validation for limit orders should not depend on the indexer being available. If the reference price cannot be retrieved, the UI should either source it from the chain directly or block order submission entirely until validation data is available, rather than silently dropping the guard.
Actual Behavior
With the indexer down, buy limit orders above market price and ask limit orders below market price are both accepted and submitted without any warning. The normal validation messages do not appear for either side.
Environment Details
localterra(local Docker)VITE_NETWORK=local npm run devWallet / Device Details
Severity / Impact
P2 / Pre-launch. If the contract enforces price rules on-chain the order will fail and waste gas. If the contract does not enforce the same rules, a trader could get an unintended fill at an adverse price. Either outcome is harmful — one wastes fees, the other risks funds. The silent removal of a validation guard during degraded operation is a trust and safety concern. Found under W9-C5 (Empty and error rows — Interactivity and Trader use dimensions).
cc: @PlasticDigits
mentioned in issue #116
mentioned in commit
eadda1c182mentioned in commit
534769b384Implementation summary (GitLab #166)
Merged to
main(commit onmainincludes merge + conflict resolution with #164 trade banner copy).What changed
getPool/ LCD) when decimals are known (indexer pair row or token registry only — no guessed decimals for unknown CW20s).evaluateLimitOrderPricePlaceGatenow takes a resolved ref + optionalrefResolutionLoading/refResolutionError. A positive typed limit cannot submit without a valid reference (no silent bypass when indexer tape is gone).useLimitOrderPriceRefBundleshared byTradeOrderTicketandLimitOrdersPage;LimitOrderPriceInputWithContextshows last trade vs AMM pool spot in the reference line.indexerTradeOutageCopy.tsdocuments pool/LCD fallback for limit reference;TradePagekeepsdata-testid="trade-indexer-outage-banner".docs/frontend.md,docs/limit-orders.md,skills/AGENTS_FRONTEND_LIMIT_ORDER_PRICE.mdupdated and cross-linked.Verification checklist
npm run test:unitandnpm run buildinfrontend-dapp/pass on your machine.@totdking Could you verify on localterra (indexer stopped) that the regression from the issue is gone? Leaving #166 open until you sign off.
mentioned in commit
ab7b62bd79mentioned in issue #174
mentioned in issue #154
mentioned in commit
f4c8cbc656mentioned in commit
fb7c8b883amentioned in commit
3325cd5422Verification complete — closing #166
Verified on localterra with full stack (LocalTerra, host Postgres, indexer, frontend, 30/30 bot swarm).
Root cause (remaining gap after initial #166 merge)
When the indexer is down, pool-based limit price reference requires token decimals. Local deploy pairs (e.g. EMBER/CORAL) are not in the static token registry, so
pairDecimalsForLimitPriceRefreturned null, the pool query never ran, and validation was bypassed for positive limit prices.Fix (merged to
mainin3325cd5)resolvePairDecimalsForLimitPriceRefFromChain— resolves CW20 decimals via on-chaintoken_infowhen registry/indexer row is missing.useLimitOrderPriceRefBundlewith loading/error flags for the place gate.Checklist
/limits, EMBER/CORAL).npm run test:unitandnpm run buildpass.limitOrderPriceReference.integration.test.ts,useLimitOrderPriceRefBundle.integration.test.tsx.Visual verification via Playwright (Cursor browser MCP not available in this session).
mentioned in issue #205
mentioned in issue #215
mentioned in issue #218