fix(quotes): existing KENA pool stays unpriceable across refreshes #1479

Closed
opened 2026-10-12 00:32:05 +00:00 by PlasticDigits · 2 comments
Owner

Existing KENA pool does not become quote-ready

Problem and required behavior

KENA has an indexed KENA/cLUNC pool with positive cached liquidity, but ordinary direct and routed inputs cannot obtain an executable quote. Repeated quote requests return 503 missing_observations, including both directions of the direct pool. Replacing that error with a loading bar improves the interface but does not restore pricing: a structurally excluded reference can remain unavailable indefinitely.

Small pool size alone must not make a supported, safely priceable market permanently unquotable. Calculate amount-specific net output for representable inputs using a reviewed, manipulation-resistant reference policy. Genuine dust, insufficient liquidity, unsupported semantics, restrictions and protection failures remain distinct blockers. The result displayed in the main receive field must execute under the exact selected UI percentage; do not introduce a second indicative-price panel or weaken signing to make a quote appear available.

This bundles small-market reference/admission coverage, accurate readiness classification and the loading-to-usable-quote transition. The solution must work generically for similarly sized supported pools, not through a KENA address/symbol exception.

Fresh reproduction and evidence scope

Read-only investigation on 2026-10-12 00:21:27–00:22:23 UTC separately pinned backend revision ea627f7b0e8d5ebc9fde2bb5b243f451cf159f4d before and after each of two trials. Source reviewed at main 2d1627ffa33eb3e08199acfff574a5b63fcfbd39; the relevant application trees are unchanged from that deployed revision. The repeat trial waited 21 seconds, beyond the original 20-second observation lifetime. Requests were paced at least 500 ms, had 10-second deadlines and bounded bodies. No actors, wallets, signing, broadcasts, screenshots or production state mutations were used.

Public execution identities:

  • KENA: terra1ps34wcgyjjp93hf2wvmt3t7v9ky9xm43yhzf6anq8kyp777egsdq0eua67 — 6 decimals.
  • cLUNC: terra1437qslye72t7qmmahn4t5chz50r8a62g45phwkquwpyu2l62u6ksqssgdg — 6 decimals.
  • KENA/cLUNC pair: terra1vwsq6jd2kxkt4d5w6435fajla3qxgr2vvhjvvufxvlerp3pfjsesm9gpds.

GET /api/v1/pairs/{pair} returned this pair in both trials, fee 180 bps, code_id_frozen:false, and cached liquidity $25.91498401637648 / $25.92004207903216. It also reported is_active:true. This is catalog/valuation evidence, not proof that every current on-chain or quote-admission prerequisite is satisfied: the response builder assigns its active flag, and cached USD liquidity is not a qualified reserve/fee/reference tuple.

All solve requests used max_spread=0.05, max_maker_fills=8, and protection_policy=quote_relative_v1; native-endpoint requests also used pool_only=true.

Direction Human offers in each trial First and repeat outcomes
cLUNC → KENA 0.01, 1, 10 All six requests: 503 missing_observations
KENA → cLUNC 100, 1000, 10000 All six requests: 503 missing_observations
CL8Y → KENA 1 Both requests: 503 missing_observations
Native USTC → KENA 1 Both requests: 503 missing_observations
Native USTC → CL8Y control 1 Both requests: HTTP 200
CL8Y → native USTC control 1 Both requests: 422 unsupported_semantics

Total: 20 quote GETs, 16 KENA missing-observation responses, two HTTP 200 controls, two unsupported controls. HTTP 200 alone is not independent economic/client/signing validation, and the controls do not establish universal readiness. Direct cLUNC → KENA progress returned HTTP 200, stage:idle, done:1, total:1 in both trials while its quote remained unavailable. Search completion is not pricing readiness.

The investigation did not inspect current raw reserve tuples, effective container environment, scheduled per-pair rejection details or the live economic-reference row. Confirm those before declaring a single production root cause or changing admission. These observations do not prove every sampled amount should execute: pin economics and classify real amount/protection limits independently.

Current codebase and likely structural failure

  1. config.rs defines DEFAULT_HUB_USD_TVL_FLOOR = "100" and loads HUB_USD_TVL_FLOOR into HubUsdConfig.tvl_floor.
  2. economic_usd.rs, resolve_economic_marks, derives a token mark from usable factory reserves against an already-priced hub, then discards the candidate when total pair TVL is below cfg.tvl_floor. The scheduled pass therefore cannot publish a token mark from that below-threshold candidate under the default configuration, even when its raw pool math is usable. Another eligible pool/reference could still supply the token's mark; its existence and eligibility must be checked.
  3. This differs from hub_usd.rs, where hub admission checks independently priced leg depth. Do not conflate the two measures or infer trusted backing from self-valued TVL.
  4. db/queries/hub_prices.rs resolves and replaces economic_token_marks during scheduled publication. A faster repeat request cannot create a mark the producer deliberately omits.
  5. local_reference_quote.rs only loads admitted, fresh economic marks with eligible oracle/hub provenance. fair_output needs valid marks for both endpoints, including KENA.
  6. local_quote.rs, evaluate_with_plan, computes checked pool/book net amounts, fees/hooks and positive floors, then requires references.fair_output. diagnostics.rs, reference_rejection, maps an absent reference to missing observations. The nonwaivable fair-deviation guard follows this check.
  7. protocol_tvl.rs, protocol_pair_tvl, can value a one-anchor pool as twice its priced anchor leg without this $100 mark floor. Thus positive displayed pool liquidity and absent executable references can coexist.
  8. The #1473 / #1475 client changes use a shared indeterminate loader and bounded scheduled-generation recovery. They preserve freshness/signing guards but do not alter economic-reference admission. Relevant client files: frontend-dapp/src/hooks/useQuoteErrorRecovery.ts, utils/localQuoteFreshness.ts, utils/routeQuoteErrors.ts, pages/SwapPage.tsx, and components/trade/TradeMarketOrderPanel.tsx.

This confirms a source-level valuation/reference coupling that can permanently exclude a below-$100 pool. It is consistent with KENA's symptoms; the effective live threshold and all other prerequisites still require independent diagnosis. Missing compatible fees/configuration, unsupported tax/hooks, stale anchors or provider admission may be additional blockers.

Why a new implementation is needed

This is an indexed existing-pool report with positive cached valuation; current usable reserves, graph connectivity and admission still require diagnosis. A blanket transient-data outcome across small and larger direct inputs prevents users from distinguishing delayed ingestion from a reference policy that will never admit their market. Repeated loading alone cannot repair that structural condition. USD reporting eligibility and safe execution-reference coverage need explicit contracts instead of an accidental shared cutoff.

Related work: #1473 covers generic outcomes/UX, #1464 provider/admission recovery, and #1459 supported quote coverage. Closed #1360 concerns KENA broadcast gas; this failure occurs before an executable quote exists and is not a gas-floor request. Preserve route-tax work in #1381.

  1. Add bounded independently scheduled diagnostics that identify the actual missing prerequisite for this pair: original reserve/fee/configuration/hook times, supported semantics, reference source/quality and admission reason. Distinguish never-admitted policy from transient publication loss; do not expose actors, raw provider bodies or high-cardinality internals.
  2. Reproduce the coupling with owned fresh positive KENA-like reserves and a trusted anchor at approximately $25 total TVL under the unchanged default $100 configuration. Compare checked pool economics with contract simulation. Verify fee/tax/hook/native support before selecting the repair.
  3. Separate execution-reference coverage from USD reporting/fee-mark admission where justified. Design an independently scheduled, quality/provenance-bound relative token-to-trusted-anchor reference for small supported markets, with reviewed temporal/corroboration/containment requirements and bounded acyclic anchoring. Its risk policy must be demonstrated against thin-pool manipulation; this ticket does not preapprove a weak spot reference.
  4. Keep existing USD/oracle-quality thresholds intact unless a separate evidence-backed policy change is explicitly reviewed. Never set fair output equal to the candidate's net return or current selected-route spot, blindly lower the global floor, add a KENA whitelist, fabricate price/zero impact, or permit reference-free signing.
  5. Publish compatible reference state with its original provenance/time/expiry and policy identity. Invalidate affected results on policy/reference changes; preserve healthy unrelated pool/hybrid views. Feed the unchanged checked economics, fair-deviation guard and exact quoted-net protection floors.
  6. Complete the loading-to-valid-quote flow. Waiting is appropriate for recoverable missing data; an internal permanently rejected policy must not masquerade as completed readiness or eventual progress. Restore supported small-market execution rather than solving this only with new retail error text. Keep one executable receive estimate and compact copy.

Constraints and guardrails

  • Preserve TQ1473, LQ1452, PR1464, LF1453, O1391, NE1398, RT1381, LG1390, PD1394 and DB1396.
  • Quote/best/POST/receive/progress/reference/refresh/preflight/signing preparation trigger zero chain RPC or network validation. Scheduled producers own observations; requests cannot accelerate ingestion.
  • Keep the original four-second fee phase, 20-second observation lifetime, 180-second configuration expiry and existing cache/work/concurrency/response limits. No stale-time renewal, old-book/new-pool splice or retained-price relabeling.
  • Use exact execution identities, actual decimals and checked raw integers. Preserve gross route-local input funding, tax/pair credit, actor/tier/exemption context, positive post-hook/hop/final floors, pause/freeze/blacklist/cooldown, refund ownership and reserve/LP rollback. Preserve nonwaivable ≥99% protection and the exact selected UI percentage.
  • A catalog flag, positive TVL, successful health response or idle search is not execution permission. Price-only output cannot enter signing. Unknown semantics stay closed.
  • Tests use owned disposable databases/chains and separate least-privilege runtime credentials. No production reserve/book/oracle/config/schema mutations or funded broadcasts for diagnosis.
  • Publish only public asset identities, fixed reason classes, aggregate samples, source/artifact identity and UTC scope. No person identifiers, conversations, wallet actors/digests, private endpoints or raw private bodies.

Acceptance criteria

  • AC1 — Proven cause: Pin the effective live/reference policy and compatible original pool/fee/config/anchor state; reproduce and classify both direct directions independently. Document the exact blocker(s), including the total-TVL versus independently priced-depth distinction. A catalog-only explanation is insufficient.
  • AC2 — Safe generic small-market pricing: Fresh, supported, representable small-market fixtures below the reporting floor produce checked amount-specific executable quotes when their reviewed independent reference requirements are satisfied. Demonstrably valid KENA/cLUNC and supported routed/native paths no longer remain blanket missing_observations solely because of pool size. Genuine dust/liquidity/protection/unsupported cases stay precise; no address exception or weakened oracle guard.
  • AC3 — Reference integrity: Prove independence/provenance, bounded anchoring and original freshness; selected-route manipulation, circular/self-valued backing, missing quorum and expired/future data cannot qualify a reference. Preserve existing USD reporting admission and contain any new execution-reference quality class.
  • AC4 — Lifecycle/readiness: Scheduled eligible publication recovers the same active intent without a manual reload, while loss/expiry/policy changes revoke display/signing safely. Progress accurately distinguishes search completion from quote eligibility. No indefinite pseudo-recovery for a known structural exclusion and no request-driven producers or endless deterministic retries.
  • AC5 — Exact execution protection: Quotes and reviewed messages bind exact amount/direction/mode/actor/generation and UI 1%/5%/30% protection. Owned funded direct/multihop/native supported fixtures deliver at least the positive net floor; rejected floors leave reserves/LP state unchanged. Indicative, stale or malformed data never signs.
  • AC6 — Complete path regression: The matrix below passes first/repeat on stable final source with meaningful independently derived integers and rejection reasons; high-liquidity controls and unrelated healthy markets retain behavior. Preserve failed inputs rather than replacing them with smaller successes.
  • AC7 — Deployed acceptance: Separately attest backend and frontend/artifacts; verify both KENA directions and supported retail routes on desktop/phone beyond 20-second observation and 180-second configuration cycles. Loading/HTTP 200 alone is not a useful quote or settlement proof. Report initialized hit/miss counts and p50/p95/p99/max against the existing temporary 750 ms browser criterion; cold acquisition is separate, and the independent socket budget stays 500 ms. Document real unavailable/unsafe paths.
  • AC8 — Documentation: Document the reference-quality/eligibility and economic floor invariants, API/readiness semantics and compact UI behavior; crosslink this issue, implementation PR, relevant skills/ instructions and an agent checklist with explicit skip policy.

Test plan: all affected paths

Dimension Required cases and meaningful assertions
Markets KENA↔cLUNC direct; CL8Y↔KENA via supported intermediates; LUNC/USTC↔KENA wrap-enter/exit paths where supported; other below-floor factory tokens; above-floor controls; unsupported/disconnected/frozen/gem/listing-only negatives. Both directions separately.
Amounts One raw unit; minimum positive/dust boundary ±1 raw; 0.000001, 0.001, 0.01, 0.1, 1, 10, 100, 1000, 10000 where representable; reserve-consumption/tax/impact boundaries ±1 raw; mixed 6/18 decimals and Uint128 limits. Derive expected net values from pinned reserves/fees/hooks.
Admission/reference Total TVL below/at/above $100 and independently priced depth boundaries separately; zero/depleted reserves; missing/expired/future anchor; oracle outage/quorum loss; quality/provenance changes; multiple pools/anchors; trusted-anchor USD rescaling with identical same-anchor reserves; no circular unpriced-token bootstrap. Confirm reporting behavior is not silently promoted by execution eligibility.
API/modes GET solve/best; exact-output receive and round-trip bounds; POST pool/hybrid/manual plans; zero/positive book budget and maker limits; progress/reference/refresh/preflight/reviewed signing. Supported modes retain their own budgets; unsupported modes remain explicit.
State/context Cold/initialized and hit/miss/coalesced; independently fresh/expired pool and hybrid views; new reserves/pending or changed fees; lost/recovered provider capacity; generation/config/reference-policy changes; anonymous and owned fixture-connected sender/trader/tier/exemption contexts; tax/hook/native capability boundaries.
UI/recovery Swap and Trade market ticket, direct/explicit links and native navigation; amount/receive edits, flip, pair switch, retry/refresh/reload, rapid cancel and return to prior amount; missing→eligible→expired transitions. Desktop/phone viewport and available physical wallet browser. Only current validated output may become visible/signable.
Settlement Owned chain direct and composed supported messages, exact authorized gross debit/credit/net delivery, positive rounded-up floors at 1/5/30%, failed-floor rollback, unsupported and price-only non-signability. No production signing needed.

Extend appropriate existing tests: indexer/src/indexer/economic_usd.rs, protocol_tvl.rs, api/local_reference_quote.rs, api/local_quote/diagnostics.rs; indexer/tests/api_hub_prices.rs, indexer_economic_fee_usd.rs, api_oracle.rs, route_local_quotes_1452.rs, scenarios/fee_generation_recovery_1464.rs, tax_admission_recovery_1464.rs, book_snapshot_loop.rs; client recovery/freshness tests, SwapPage.queryParams.test.tsx, TradePage.test.tsx, market submit-snapshot tests and applicable swap/route/native transaction E2E. Keep provenance/source-only and actual settlement assertions separate.

Attack, hack and abuse tests

  1. Manipulate a thin pool immediately before quoting; flash-add/remove liquidity to cross the floor; wash trade, donate/skew reserves, change one side, or control several shallow pools. None may define the candidate's own trusted reference, inflate independent backing or bypass ≥99%/UI protection.
  2. Spoof hub/token symbols, decimals, contract/pair identity, registered capability, oracle source/quorum/age, reference quality/policy, timestamps, generation or namespace. Reject future/stale/incompatible/replayed state and malicious native/CW20 aliases; retain known freeze/blacklist/actor negatives.
  3. Test zero/negative/noncanonical/overflow/overlong amounts, precision collisions, zero denominators, extreme ratios, absent/zero/mismatched floors and unsafe receive inversion. No panic, silent authorized-input change or zero floor.
  4. Exercise dense/cyclic reference graphs, many tiny markets, concurrent/coalesced requests, cancellation and repeated generation churn. Bound queues, graph/mirror/reference/byte work and memory; release permits; provider counters remain zero for all request paths.
  5. Poison warm cached results with policy/anchor/fee/tax/context changes or canceled producers; attempt old-book/new-reserve joins and expiry renewal. Unsupported hooks/taxes/wrappers and extra wallet debit cannot become a gross or wallet-funded fallback.
  6. Inject oversized/unknown/malicious diagnostic bodies and private actor/endpoint fields. Only bounded fixed public classes reach UI/evidence; no markup execution, raw prose echo, sensitive telemetry, fake progress completion or auto-submit.

Agent verification and release criteria

  1. Use an isolated worktree, scoped credentials via openbao-tools bao-exec, exact source/dirty fingerprint and UTC receipts. Complete feasible checks first. Confirm actual assertions and independent expected integers, not only HTTP status or loader text.
  2. Run make verify-issue-1473, verify-issue-1452, verify-issue-1464, verify-issue-1453, verify-issue-1391 and applicable floor/tax/guard/database verifiers (1398, 1381, 1390, 1396; receive/provider support checks where affected). Add a dedicated regression target/checklist for this issue. No shared database/chain resets or migrations from runtime.
  3. Fix executed failures, restart/recreate only owned fixtures as necessary, and repeat first/retest on stable final source. Confirm actual funded net/rollback where fixtures support the semantics. Preserve first failures and explicit unavailable scopes.
  4. Separately attest deployed API revision and frontend build/root artifacts, then repeat bounded read-only quote/UI cases beyond both observation and configuration cycles. Observe loading-to-usable KENA recovery, inspect bounded classified producer/reference logs and show that ordinary priceable inputs execute under selected protection in owned fixtures. A perpetual spinner, catalog liquidity or health response does not satisfy acceptance.
  5. An agent may SKIP an unavailable device, artifact or operational check with exact reason, attempted command, missing prerequisite, revision and UTC scope, and mark the stated tested scope PASS WITH SKIPS only when every executed check in that scope passes. Executed correctness/accounting/latency failures remain FAIL. Skipped criteria stay unchecked; do not close this issue unless all body/comment acceptance criteria pass. Required physical-only work belongs in a concise cl8y-pm inbox card under repository instructions.

This is a bug investigation/report, not evidence that the new reference policy is implemented or that all sampled amounts are safely executable.

Published implementation and evidence (2026-10-12)

Implementation PR #1481 is deployed at 0395459971312c31f87d502ef7822733a7250238; evidence/QA #1482 publishes bounded live outcomes and retained failures. Current results and agent checklist distinguish completed subsets from incomplete whole criteria.

Only documentation AC8 is complete. Private atomic original rows/history, independent thin-token manipulation, full native/hook/device breadth and retained live failures keep the other whole criteria incomplete. This issue remains open.

# Existing KENA pool does not become quote-ready ## Problem and required behavior KENA has an indexed KENA/cLUNC pool with positive cached liquidity, but ordinary direct and routed inputs cannot obtain an executable quote. Repeated quote requests return `503 missing_observations`, including both directions of the direct pool. Replacing that error with a loading bar improves the interface but does not restore pricing: a structurally excluded reference can remain unavailable indefinitely. Small pool size alone must not make a supported, safely priceable market permanently unquotable. Calculate amount-specific net output for representable inputs using a reviewed, manipulation-resistant reference policy. Genuine dust, insufficient liquidity, unsupported semantics, restrictions and protection failures remain distinct blockers. The result displayed in the main receive field must execute under the exact selected UI percentage; do not introduce a second indicative-price panel or weaken signing to make a quote appear available. This bundles small-market reference/admission coverage, accurate readiness classification and the loading-to-usable-quote transition. The solution must work generically for similarly sized supported pools, not through a KENA address/symbol exception. ## Fresh reproduction and evidence scope Read-only investigation on **2026-10-12 00:21:27–00:22:23 UTC** separately pinned backend revision `ea627f7b0e8d5ebc9fde2bb5b243f451cf159f4d` before and after each of two trials. Source reviewed at main `2d1627ffa33eb3e08199acfff574a5b63fcfbd39`; the relevant application trees are unchanged from that deployed revision. The repeat trial waited 21 seconds, beyond the original 20-second observation lifetime. Requests were paced at least 500 ms, had 10-second deadlines and bounded bodies. No actors, wallets, signing, broadcasts, screenshots or production state mutations were used. Public execution identities: - KENA: `terra1ps34wcgyjjp93hf2wvmt3t7v9ky9xm43yhzf6anq8kyp777egsdq0eua67` — 6 decimals. - cLUNC: `terra1437qslye72t7qmmahn4t5chz50r8a62g45phwkquwpyu2l62u6ksqssgdg` — 6 decimals. - KENA/cLUNC pair: `terra1vwsq6jd2kxkt4d5w6435fajla3qxgr2vvhjvvufxvlerp3pfjsesm9gpds`. `GET /api/v1/pairs/{pair}` returned this pair in both trials, fee **180 bps**, `code_id_frozen:false`, and cached liquidity **$25.91498401637648 / $25.92004207903216**. It also reported `is_active:true`. This is catalog/valuation evidence, not proof that every current on-chain or quote-admission prerequisite is satisfied: the response builder assigns its active flag, and cached USD liquidity is not a qualified reserve/fee/reference tuple. All solve requests used `max_spread=0.05`, `max_maker_fills=8`, and `protection_policy=quote_relative_v1`; native-endpoint requests also used `pool_only=true`. | Direction | Human offers in each trial | First and repeat outcomes | | --- | --- | --- | | cLUNC → KENA | 0.01, 1, 10 | All six requests: 503 `missing_observations` | | KENA → cLUNC | 100, 1000, 10000 | All six requests: 503 `missing_observations` | | CL8Y → KENA | 1 | Both requests: 503 `missing_observations` | | Native USTC → KENA | 1 | Both requests: 503 `missing_observations` | | Native USTC → CL8Y control | 1 | Both requests: HTTP 200 | | CL8Y → native USTC control | 1 | Both requests: 422 `unsupported_semantics` | Total: **20 quote GETs, 16 KENA missing-observation responses, two HTTP 200 controls, two unsupported controls**. HTTP 200 alone is not independent economic/client/signing validation, and the controls do not establish universal readiness. Direct cLUNC → KENA progress returned HTTP 200, `stage:idle`, `done:1`, `total:1` in both trials while its quote remained unavailable. Search completion is not pricing readiness. The investigation did not inspect current raw reserve tuples, effective container environment, scheduled per-pair rejection details or the live economic-reference row. Confirm those before declaring a single production root cause or changing admission. These observations do not prove every sampled amount should execute: pin economics and classify real amount/protection limits independently. ## Current codebase and likely structural failure 1. [`config.rs`](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/commit/2d1627ffa33eb3e08199acfff574a5b63fcfbd39/indexer/src/config.rs) defines `DEFAULT_HUB_USD_TVL_FLOOR = "100"` and loads `HUB_USD_TVL_FLOOR` into `HubUsdConfig.tvl_floor`. 2. [`economic_usd.rs`](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/commit/2d1627ffa33eb3e08199acfff574a5b63fcfbd39/indexer/src/indexer/economic_usd.rs), `resolve_economic_marks`, derives a token mark from usable factory reserves against an already-priced hub, then discards the candidate when **total pair TVL** is below `cfg.tvl_floor`. The scheduled pass therefore cannot publish a token mark from that below-threshold candidate under the default configuration, even when its raw pool math is usable. Another eligible pool/reference could still supply the token's mark; its existence and eligibility must be checked. 3. This differs from [`hub_usd.rs`](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/commit/2d1627ffa33eb3e08199acfff574a5b63fcfbd39/indexer/src/indexer/hub_usd.rs), where hub admission checks **independently priced leg depth**. Do not conflate the two measures or infer trusted backing from self-valued TVL. 4. [`db/queries/hub_prices.rs`](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/commit/2d1627ffa33eb3e08199acfff574a5b63fcfbd39/indexer/src/db/queries/hub_prices.rs) resolves and replaces `economic_token_marks` during scheduled publication. A faster repeat request cannot create a mark the producer deliberately omits. 5. [`local_reference_quote.rs`](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/commit/2d1627ffa33eb3e08199acfff574a5b63fcfbd39/indexer/src/api/local_reference_quote.rs) only loads admitted, fresh economic marks with eligible oracle/hub provenance. `fair_output` needs valid marks for both endpoints, including KENA. 6. [`local_quote.rs`](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/commit/2d1627ffa33eb3e08199acfff574a5b63fcfbd39/indexer/src/api/local_quote.rs), `evaluate_with_plan`, computes checked pool/book net amounts, fees/hooks and positive floors, then requires `references.fair_output`. [`diagnostics.rs`](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/commit/2d1627ffa33eb3e08199acfff574a5b63fcfbd39/indexer/src/api/local_quote/diagnostics.rs), `reference_rejection`, maps an absent reference to missing observations. The nonwaivable fair-deviation guard follows this check. 7. [`protocol_tvl.rs`](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/commit/2d1627ffa33eb3e08199acfff574a5b63fcfbd39/indexer/src/indexer/protocol_tvl.rs), `protocol_pair_tvl`, can value a one-anchor pool as twice its priced anchor leg without this $100 mark floor. Thus positive displayed pool liquidity and absent executable references can coexist. 8. The #1473 / [#1475](https://git.cl8y.com/code/cl8y-dex-terraclassic/pulls/1475) client changes use a shared indeterminate loader and bounded scheduled-generation recovery. They preserve freshness/signing guards but do not alter economic-reference admission. Relevant client files: `frontend-dapp/src/hooks/useQuoteErrorRecovery.ts`, `utils/localQuoteFreshness.ts`, `utils/routeQuoteErrors.ts`, `pages/SwapPage.tsx`, and `components/trade/TradeMarketOrderPanel.tsx`. This confirms a source-level valuation/reference coupling that can permanently exclude a below-$100 pool. It is consistent with KENA's symptoms; the effective live threshold and all other prerequisites still require independent diagnosis. Missing compatible fees/configuration, unsupported tax/hooks, stale anchors or provider admission may be additional blockers. ## Why a new implementation is needed This is an indexed existing-pool report with positive cached valuation; current usable reserves, graph connectivity and admission still require diagnosis. A blanket transient-data outcome across small and larger direct inputs prevents users from distinguishing delayed ingestion from a reference policy that will never admit their market. Repeated loading alone cannot repair that structural condition. USD reporting eligibility and safe execution-reference coverage need explicit contracts instead of an accidental shared cutoff. Related work: [#1473](https://git.cl8y.com/code/cl8y-dex-terraclassic/issues/1473) covers generic outcomes/UX, [#1464](https://git.cl8y.com/code/cl8y-dex-terraclassic/issues/1464) provider/admission recovery, and [#1459](https://git.cl8y.com/code/cl8y-dex-terraclassic/issues/1459) supported quote coverage. Closed [#1360](https://git.cl8y.com/code/cl8y-dex-terraclassic/issues/1360) concerns KENA broadcast gas; this failure occurs before an executable quote exists and is not a gas-floor request. Preserve route-tax work in [#1381](https://git.cl8y.com/code/cl8y-dex-terraclassic/issues/1381). ## Recommended direction 1. Add bounded independently scheduled diagnostics that identify the actual missing prerequisite for this pair: original reserve/fee/configuration/hook times, supported semantics, reference source/quality and admission reason. Distinguish never-admitted policy from transient publication loss; do not expose actors, raw provider bodies or high-cardinality internals. 2. Reproduce the coupling with owned fresh positive KENA-like reserves and a trusted anchor at approximately $25 total TVL under the unchanged default $100 configuration. Compare checked pool economics with contract simulation. Verify fee/tax/hook/native support before selecting the repair. 3. Separate execution-reference coverage from USD reporting/fee-mark admission where justified. Design an independently scheduled, quality/provenance-bound relative token-to-trusted-anchor reference for small supported markets, with reviewed temporal/corroboration/containment requirements and bounded acyclic anchoring. Its risk policy must be demonstrated against thin-pool manipulation; this ticket does not preapprove a weak spot reference. 4. Keep existing USD/oracle-quality thresholds intact unless a separate evidence-backed policy change is explicitly reviewed. Never set fair output equal to the candidate's net return or current selected-route spot, blindly lower the global floor, add a KENA whitelist, fabricate price/zero impact, or permit reference-free signing. 5. Publish compatible reference state with its original provenance/time/expiry and policy identity. Invalidate affected results on policy/reference changes; preserve healthy unrelated pool/hybrid views. Feed the unchanged checked economics, fair-deviation guard and exact quoted-net protection floors. 6. Complete the loading-to-valid-quote flow. Waiting is appropriate for recoverable missing data; an internal permanently rejected policy must not masquerade as completed readiness or eventual progress. Restore supported small-market execution rather than solving this only with new retail error text. Keep one executable receive estimate and compact copy. ## Constraints and guardrails - Preserve [TQ1473](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/branch/main/skills/AGENTS_TRADING_QUOTE_OUTCOMES.md), [LQ1452](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/branch/main/skills/AGENTS_LOCAL_SWAP_QUOTES.md), [PR1464](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/branch/main/skills/AGENTS_PROVIDER_RECOVERY.md), [LF1453](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/branch/main/skills/AGENTS_LIQUIDITY_FEED.md), [O1391](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/branch/main/skills/AGENTS_ORACLE_SAFETY.md), NE1398, RT1381, LG1390, PD1394 and DB1396. - Quote/best/POST/receive/progress/reference/refresh/preflight/signing preparation trigger **zero chain RPC or network validation**. Scheduled producers own observations; requests cannot accelerate ingestion. - Keep the original four-second fee phase, 20-second observation lifetime, 180-second configuration expiry and existing cache/work/concurrency/response limits. No stale-time renewal, old-book/new-pool splice or retained-price relabeling. - Use exact execution identities, actual decimals and checked raw integers. Preserve gross route-local input funding, tax/pair credit, actor/tier/exemption context, positive post-hook/hop/final floors, pause/freeze/blacklist/cooldown, refund ownership and reserve/LP rollback. Preserve nonwaivable ≥99% protection and the exact selected UI percentage. - A catalog flag, positive TVL, successful health response or idle search is not execution permission. Price-only output cannot enter signing. Unknown semantics stay closed. - Tests use owned disposable databases/chains and separate least-privilege runtime credentials. No production reserve/book/oracle/config/schema mutations or funded broadcasts for diagnosis. - Publish only public asset identities, fixed reason classes, aggregate samples, source/artifact identity and UTC scope. No person identifiers, conversations, wallet actors/digests, private endpoints or raw private bodies. ## Acceptance criteria - [ ] **AC1 — Proven cause:** Pin the effective live/reference policy and compatible original pool/fee/config/anchor state; reproduce and classify both direct directions independently. Document the exact blocker(s), including the total-TVL versus independently priced-depth distinction. A catalog-only explanation is insufficient. - [ ] **AC2 — Safe generic small-market pricing:** Fresh, supported, representable small-market fixtures below the reporting floor produce checked amount-specific executable quotes when their reviewed independent reference requirements are satisfied. Demonstrably valid KENA/cLUNC and supported routed/native paths no longer remain blanket `missing_observations` solely because of pool size. Genuine dust/liquidity/protection/unsupported cases stay precise; no address exception or weakened oracle guard. - [ ] **AC3 — Reference integrity:** Prove independence/provenance, bounded anchoring and original freshness; selected-route manipulation, circular/self-valued backing, missing quorum and expired/future data cannot qualify a reference. Preserve existing USD reporting admission and contain any new execution-reference quality class. - [ ] **AC4 — Lifecycle/readiness:** Scheduled eligible publication recovers the same active intent without a manual reload, while loss/expiry/policy changes revoke display/signing safely. Progress accurately distinguishes search completion from quote eligibility. No indefinite pseudo-recovery for a known structural exclusion and no request-driven producers or endless deterministic retries. - [ ] **AC5 — Exact execution protection:** Quotes and reviewed messages bind exact amount/direction/mode/actor/generation and UI 1%/5%/30% protection. Owned funded direct/multihop/native supported fixtures deliver at least the positive net floor; rejected floors leave reserves/LP state unchanged. Indicative, stale or malformed data never signs. - [ ] **AC6 — Complete path regression:** The matrix below passes first/repeat on stable final source with meaningful independently derived integers and rejection reasons; high-liquidity controls and unrelated healthy markets retain behavior. Preserve failed inputs rather than replacing them with smaller successes. - [ ] **AC7 — Deployed acceptance:** Separately attest backend and frontend/artifacts; verify both KENA directions and supported retail routes on desktop/phone beyond 20-second observation and 180-second configuration cycles. Loading/HTTP 200 alone is not a useful quote or settlement proof. Report initialized hit/miss counts and p50/p95/p99/max against the existing temporary 750 ms browser criterion; cold acquisition is separate, and the independent socket budget stays 500 ms. Document real unavailable/unsafe paths. - [x] **AC8 — Documentation:** Document the reference-quality/eligibility and economic floor invariants, API/readiness semantics and compact UI behavior; crosslink this issue, implementation PR, relevant `skills/` instructions and an agent checklist with explicit skip policy. ## Test plan: all affected paths | Dimension | Required cases and meaningful assertions | | --- | --- | | Markets | KENA↔cLUNC direct; CL8Y↔KENA via supported intermediates; LUNC/USTC↔KENA wrap-enter/exit paths where supported; other below-floor factory tokens; above-floor controls; unsupported/disconnected/frozen/gem/listing-only negatives. Both directions separately. | | Amounts | One raw unit; minimum positive/dust boundary ±1 raw; 0.000001, 0.001, 0.01, 0.1, 1, 10, 100, 1000, 10000 where representable; reserve-consumption/tax/impact boundaries ±1 raw; mixed 6/18 decimals and Uint128 limits. Derive expected net values from pinned reserves/fees/hooks. | | Admission/reference | Total TVL below/at/above $100 and independently priced depth boundaries separately; zero/depleted reserves; missing/expired/future anchor; oracle outage/quorum loss; quality/provenance changes; multiple pools/anchors; trusted-anchor USD rescaling with identical same-anchor reserves; no circular unpriced-token bootstrap. Confirm reporting behavior is not silently promoted by execution eligibility. | | API/modes | GET solve/best; exact-output receive and round-trip bounds; POST pool/hybrid/manual plans; zero/positive book budget and maker limits; progress/reference/refresh/preflight/reviewed signing. Supported modes retain their own budgets; unsupported modes remain explicit. | | State/context | Cold/initialized and hit/miss/coalesced; independently fresh/expired pool and hybrid views; new reserves/pending or changed fees; lost/recovered provider capacity; generation/config/reference-policy changes; anonymous and owned fixture-connected sender/trader/tier/exemption contexts; tax/hook/native capability boundaries. | | UI/recovery | Swap and Trade market ticket, direct/explicit links and native navigation; amount/receive edits, flip, pair switch, retry/refresh/reload, rapid cancel and return to prior amount; missing→eligible→expired transitions. Desktop/phone viewport and available physical wallet browser. Only current validated output may become visible/signable. | | Settlement | Owned chain direct and composed supported messages, exact authorized gross debit/credit/net delivery, positive rounded-up floors at 1/5/30%, failed-floor rollback, unsupported and price-only non-signability. No production signing needed. | Extend appropriate existing tests: `indexer/src/indexer/economic_usd.rs`, `protocol_tvl.rs`, `api/local_reference_quote.rs`, `api/local_quote/diagnostics.rs`; `indexer/tests/api_hub_prices.rs`, `indexer_economic_fee_usd.rs`, `api_oracle.rs`, `route_local_quotes_1452.rs`, `scenarios/fee_generation_recovery_1464.rs`, `tax_admission_recovery_1464.rs`, `book_snapshot_loop.rs`; client recovery/freshness tests, `SwapPage.queryParams.test.tsx`, `TradePage.test.tsx`, market submit-snapshot tests and applicable swap/route/native transaction E2E. Keep provenance/source-only and actual settlement assertions separate. ## Attack, hack and abuse tests 1. Manipulate a thin pool immediately before quoting; flash-add/remove liquidity to cross the floor; wash trade, donate/skew reserves, change one side, or control several shallow pools. None may define the candidate's own trusted reference, inflate independent backing or bypass ≥99%/UI protection. 2. Spoof hub/token symbols, decimals, contract/pair identity, registered capability, oracle source/quorum/age, reference quality/policy, timestamps, generation or namespace. Reject future/stale/incompatible/replayed state and malicious native/CW20 aliases; retain known freeze/blacklist/actor negatives. 3. Test zero/negative/noncanonical/overflow/overlong amounts, precision collisions, zero denominators, extreme ratios, absent/zero/mismatched floors and unsafe receive inversion. No panic, silent authorized-input change or zero floor. 4. Exercise dense/cyclic reference graphs, many tiny markets, concurrent/coalesced requests, cancellation and repeated generation churn. Bound queues, graph/mirror/reference/byte work and memory; release permits; provider counters remain zero for all request paths. 5. Poison warm cached results with policy/anchor/fee/tax/context changes or canceled producers; attempt old-book/new-reserve joins and expiry renewal. Unsupported hooks/taxes/wrappers and extra wallet debit cannot become a gross or wallet-funded fallback. 6. Inject oversized/unknown/malicious diagnostic bodies and private actor/endpoint fields. Only bounded fixed public classes reach UI/evidence; no markup execution, raw prose echo, sensitive telemetry, fake progress completion or auto-submit. ## Agent verification and release criteria 1. Use an isolated worktree, scoped credentials via openbao-tools `bao-exec`, exact source/dirty fingerprint and UTC receipts. Complete feasible checks first. Confirm actual assertions and independent expected integers, not only HTTP status or loader text. 2. Run `make verify-issue-1473`, `verify-issue-1452`, `verify-issue-1464`, `verify-issue-1453`, `verify-issue-1391` and applicable floor/tax/guard/database verifiers (`1398`, `1381`, `1390`, `1396`; receive/provider support checks where affected). Add a dedicated regression target/checklist for this issue. No shared database/chain resets or migrations from runtime. 3. Fix executed failures, restart/recreate only owned fixtures as necessary, and repeat first/retest on stable final source. Confirm actual funded net/rollback where fixtures support the semantics. Preserve first failures and explicit unavailable scopes. 4. Separately attest deployed API revision and frontend build/root artifacts, then repeat bounded read-only quote/UI cases beyond both observation and configuration cycles. Observe loading-to-usable KENA recovery, inspect bounded classified producer/reference logs and show that ordinary priceable inputs execute under selected protection in owned fixtures. A perpetual spinner, catalog liquidity or health response does not satisfy acceptance. 5. An agent may SKIP an unavailable device, artifact or operational check with exact reason, attempted command, missing prerequisite, revision and UTC scope, and mark the stated tested scope **PASS WITH SKIPS only when every executed check in that scope passes**. Executed correctness/accounting/latency failures remain FAIL. Skipped criteria stay unchecked; do not close this issue unless all body/comment acceptance criteria pass. Required physical-only work belongs in a concise cl8y-pm inbox card under repository instructions. This is a bug investigation/report, not evidence that the new reference policy is implemented or that all sampled amounts are safely executable. ## Published implementation and evidence (2026-10-12) Implementation [PR #1481](https://git.cl8y.com/code/cl8y-dex-terraclassic/pulls/1481) is deployed at `0395459971312c31f87d502ef7822733a7250238`; [evidence/QA #1482](https://git.cl8y.com/code/cl8y-dex-terraclassic/pulls/1482) publishes bounded live outcomes and retained failures. [Current results](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/branch/main/docs/qa/issue-1479/RESULTS.md) and [agent checklist](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/branch/main/docs/qa/issue-1479/README.md) distinguish completed subsets from incomplete whole criteria. Only documentation AC8 is complete. Private atomic original rows/history, independent thin-token manipulation, full native/hook/device breadth and retained live failures keep the other whole criteria incomplete. This issue remains open.
Author
Owner

Implementation #1481 and evidence/QA #1482 are merged. Both production apps are independently attested at 0395459971312c31f87d502ef7822733a7250238; evidence main d65228c2970a1ec7b11d81000d3f83ceb58132c4 has identical application inputs and adds QA/docs only. The authorized economic total-TVL floor is $10; independently priced hub depth stays $100.

All six original KENA↔cLUNC offers now produce validated quotes matching independent reserves/180-bps arithmetic and contract simulation, with positive exact 5% floors. Two bounded browser shards completed all 840 unique desktop/phone first/retest cases: 558 useful quotes, zero failures, p50/p95/p99/max 376.9/414.4/444.9/467.3 ms against 750 ms. Each retained the 30-minute/2,200-read caps and 181-second gap. Source verifiers and actual funded plain-core subsets passed; implementation hosted CI422 genuinely passed all steps.

Retained FAILs: original browser 710/840 at the 30-minute cap plus 1,110.9/1,101.2 ms stalls; full 1,680-row API run had one unproved HTTP200 client-validation failure; separate cold replay 883.045 ms exceeded 500 ms. Warm API 1,116 useful quotes stayed ≤291.94 ms. Original failed body/stalls were not reproduced, so causes are not retrospectively invented. Prometheus/private original atomic SQL, independent thin-token manipulation/history, complete native/hook/book/funded/device breadth remain incomplete.

Results, checklist/skip policy, and SM1479 instructions separate passing subsets, failures and skips. Only documentation AC8 is checked. This issue remains open.

The implementation PR's negated closing phrase was still parsed by Forgejo and automatically changed this issue's state during merge. It was reopened; both PR descriptions now use plain references without automatic closing keywords. That state change did not establish completed acceptance.

Implementation [#1481](https://git.cl8y.com/code/cl8y-dex-terraclassic/pulls/1481) and evidence/QA [#1482](https://git.cl8y.com/code/cl8y-dex-terraclassic/pulls/1482) are merged. Both production apps are independently attested at `0395459971312c31f87d502ef7822733a7250238`; evidence main `d65228c2970a1ec7b11d81000d3f83ceb58132c4` has identical application inputs and adds QA/docs only. The authorized economic total-TVL floor is $10; independently priced hub depth stays $100. All six original KENA↔cLUNC offers now produce validated quotes matching independent reserves/180-bps arithmetic and contract simulation, with positive exact 5% floors. Two bounded browser shards completed all 840 unique desktop/phone first/retest cases: 558 useful quotes, zero failures, p50/p95/p99/max 376.9/414.4/444.9/467.3 ms against 750 ms. Each retained the 30-minute/2,200-read caps and 181-second gap. Source verifiers and actual funded plain-core subsets passed; implementation hosted CI422 genuinely passed all steps. Retained FAILs: original browser 710/840 at the 30-minute cap plus 1,110.9/1,101.2 ms stalls; full 1,680-row API run had one unproved HTTP200 client-validation failure; separate cold replay 883.045 ms exceeded 500 ms. Warm API 1,116 useful quotes stayed ≤291.94 ms. Original failed body/stalls were not reproduced, so causes are not retrospectively invented. Prometheus/private original atomic SQL, independent thin-token manipulation/history, complete native/hook/book/funded/device breadth remain incomplete. [Results](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/branch/main/docs/qa/issue-1479/RESULTS.md), [checklist/skip policy](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/branch/main/docs/qa/issue-1479/README.md), and [SM1479 instructions](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/branch/main/skills/AGENTS_SMALL_MARKET_REFERENCE.md) separate passing subsets, failures and skips. Only documentation AC8 is checked. This issue remains open. The implementation PR's negated closing phrase was still parsed by Forgejo and automatically changed this issue's state during merge. It was reopened; both PR descriptions now use plain references without automatic closing keywords. That state change did not establish completed acceptance.
Author
Owner

Closed at the user's request as part of consolidating issues #1449–#1500.

Small-market reference admission and the KENA quote fix are merged and deployed. No separate implementation task remains here; the shared native recovery problem is tracked by #1504.

Replacement: #1504

Wallet/device chores and verification-only holds are intentionally excluded. Historical failed receipts remain unchanged; this closure does not claim every old acceptance checkbox passed.

Closed at the user's request as part of consolidating issues #1449–#1500. Small-market reference admission and the KENA quote fix are merged and deployed. No separate implementation task remains here; the shared native recovery problem is tracked by #1504. Replacement: https://git.cl8y.com/code/cl8y-dex-terraclassic/issues/1504 Wallet/device chores and verification-only holds are intentionally excluded. Historical failed receipts remain unchanged; this closure does not claim every old acceptance checkbox passed.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
code/cl8y-dex-terraclassic#1479
No description provided.