fix(charts): blank price chart for ALPHA pairs #1315
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#1315
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?
Summary
On
/charts, factory pairs that include ALPHA (terra1x6e64es6yhauhvs3prvpdg2gkqdtfru840wgnhs935x8axr7zxkqzysuxz, 6 decimals, token registry) show the empty price pane (“No chart data for this interval yet”) even when the pair has trades.Candle ingest only writes OHLC when
price_usdis a positive factory USD mark of 1asset_0. That mark ishuman_quote_per_base * usd_per_human_quote, and the quote isasset_1.quote_usd_kindprices UST1, USTC/cUSTC, LUNC/cLUNC, USTR, and the pinned USDT CW20. ALPHA and CL8Y are not catalog quotes, so a pair whoseasset_1is ALPHA (or CL8Y, on CL8Y/ALPHA) stores no candles. The dApp then drops the empty USD series and mountsPriceChartEmptyState.Do not peg ALPHA (or CL8Y) to $1. Do not reopen closed #1258 (USDT identity pin), #543 (human numbers must not land in USD columns), #522 (USTC/LUNC/UST1/USTR catalog), #113 (empty-state copy; that state already ships), or #568 (hub rewrite of existing USD history). #1250 is the ALPHA code-id migrate, not this chart.
Current codebase
Indexer:
indexer/src/indexer/pair_price_usd.rs—quote_usd_kindreturnsNoneforALPHAandCL8Y.price_usd_for_human_quote_per_base_pinnedtherefore returnsNonewhenasset_1is ALPHA.indexer/src/indexer/parser.rs— swapprice_usdis computed only from the quote asset (asset_1).indexer/src/indexer/candle_builder.rs—update_candles_for_swapreturns before any write whenprice_usdis missing or non-positive, so*_humanOHLC is not stored either.indexer/src/indexer/swap_orientation.rs—asset_0is base,asset_1is quote; human price is quote-per-base. Factory order follows chainasset_infos, not “stable is quote”.Frontend:
frontend-dapp/src/components/charts/priceChartCandles.ts— bars without finite positive USD are dropped (indexerCandlesToFactoryPoints). No human-on-USD-axis fallback.frontend-dapp/src/components/charts/PriceChart.tsx—chartPoints.length === 0mountsPriceChartEmptyState.frontend-dapp/src/utils/tokenRegistry.ts— ALPHA symbol, 6 decimals, contract above.Known factory markets from #558: UST1/ALPHA (catalog leg exists) and CL8Y/ALPHA (neither leg is a USD catalog quote). Terraport ALPHA/LUNC and ALPHA/USTC addresses in
communityTaxMigratePairs.tsare other-venue inventory, not this factory chart.Given / When / Then
Given a factory pair that includes ALPHA and has at least one indexed swap with a positive human quote-per-base price,
When that pair is opened on
/chartsat the default interval,Then the price pane shows candlesticks, not
PriceChartEmptyState.Given the other leg is a catalog USD quote (UST1, USTC/cUSTC/
uusd, LUNC/cLUNC/uluna, USTR, or the pinned USDT CW20),When candles are built,
Then
price_usdis USD of 1 human ALPHA, derived from that catalog leg, whicheverasset_infosslot the catalog asset occupies.Given both legs are outside the catalog (CL8Y/ALPHA),
When candles are built,
Then human quote-per-base OHLC is stored and the chart draws that series, labeled as quote-per-base rather than USD. Human values are not copied into USD columns.
Given the pair has no swaps, or every price is non-positive,
When
/chartsloads,Then the existing empty state remains.
Expected vs actual
Expected: an ALPHA factory pair with trades shows a price series on
/charts. USD when a catalog leg can mark it; human quote-per-base when neither leg is in the catalog.Actual: ingest skips the candle when
asset_1has no USD handle, the candles API returns no usable USD rows, and the pane is the dashed empty state.Acceptance criteria
price_usdof 1 human ALPHA after a swap, independent of which slot ALPHA occupies./chartsrenders those bars instead of the empty state.quote_usd_kind("ALPHA")arm.Test plan
pair_price_usd/candle_builder: ALPHA asasset_1with UST1 asasset_0writes USD candles; ALPHA asasset_0with UST1 asasset_1still does; CL8Y/ALPHA writes human OHLC and does not write USD; symbolALPHAon another contract does not price.priceChartCandles(orPriceChart) fixture with human-only rows for an unpriced quote renders points; all-invalid USD without a human series still shows the empty state.Attack / abuse tests
ALPHA(wrong CW20) must not receive the registry token’s mark or a catalog bypass.setData.NaN,Infinity, empty OHLC strings, and non-numeric fields stay dropped.Verification
human_alpha_price * ust1_usd(not a peg)./chartsis notPriceChartEmptyStateand the axis is not labeled as USD.First-pass model recommendation
Recommendation: grok-high
Rationale: The blank pane comes from the indexer USD-candle skip (
candle_builder.rs,pair_price_usd.rs,parser.rs) plus the frontend drop of non-USD bars (priceChartCandles.ts,PriceChart.tsx). Fixing it changes how OHLC is stored for unpriced quotes and has to keep human values out of USD columns. That is more than one subsystem, more than three production files, and a pricing-invariant change, so a first pass needs the stronger model. Verify with the indexer orientation tests and the chart fixture tests above.cl8y-agent-control: queued
design_authorjob5edf0349-fd52-4437-ae40-04a413d6ea20(not executed; no Hetzner VM).cl8y-agent-control: needs_human inbox card POST failed. Job stays parked.