fix(indexer): pin registry USDT for Charts Price (USD) #1273
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!1273
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue/1258"
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
USDT_CW20_ADDRESSoverlay on LocalTerra). TickerUSDT, Peg1/hub UST1, VFDUSD/FDUSD, CEX*USDT, andHubQuoteUsd.economicstay unpriced.price_usd/volume_usdfor USDT-quoted swaps (human 6/18). NULL-only SQL + startup backfill rebuild candles; non-NULL history and UST1/cUSTC are untouched.*_usdis still empty. invertUsd / #543 / #680 unchanged.Fixes #1258
Test plan
make verify-issue-1258(invariants/skills greps, indexerpair_price_usdlib tests, frontendpairPriceUsd+chartsPairStats)cargo test --lib pair_price_usd/candle_mark/hub_usd/economic_usd/startupsymbol=USDTwith a different contract stays—; UST1-quoted charts still use hub marksdrain skip: no occupying job for rebase/fix-pr/CI-wait; remaining continue
/agent review
cl8y-agent-control: queued
bug_reviewjoba0a75250-d86c-40f0-b2ee-8ade2c107464(not executed; no Hetzner VM)./agent review
cl8y-agent-control: queued
bug_reviewjobae20d4df-a1de-43a5-9e6d-0984ac292afc(not executed; no Hetzner VM).RECOMMEND: ACCEPT
Independent review of PR #1273 (
issue/1258→main) for #1258. Head:d682d58e26f8276e8520c9b8a064650ed2e860ef. Frozen SHA was unset; this is not a merge grant.Verdict
The production Charts bug is addressed: P522-Q now identity-gates the columbus-5 registry USDT CW20 to advisory $1, live ingest stamps
price_usd/volume_usd, and NULL-only SQL + startup candle rebuild can populate 24h OHLC / GET/candles. Spoofsymbol=USDT, Peg1/hub UST1, VFDUSD/FDUSD, andHubQuoteUsd.economicstay out of this path. No wasm, no new routes, no settlement change.Ship after CI green + Coolify indexer migrate/restart smoke on
terra17l7eqc5j8vkm09up55etfggpr6y92ka6p03yc765mt3nerqcnhdsl6l7jq(PR test-plan boxes still unchecked).#1258 acceptance / verify
*_usdafter ingest/backfillprice_usd_for_human_quote_per_base_pinned(indexer/src/indexer/parser.rs:503-512). Backfillprice_usd = se.pricewhenasset_1is the pin (indexer/src/db/queries/usdt_quote_usd.rs:26-36; migrationindexer/migrations/20260916120000_usdt_quote_usd_null_backfill.sql:8-17)./candlesfactory USDprice_usdonly (indexer/src/db/queries/candles.rs:130-157). SQL migrate does not rebuild candles (commented at migration5-6); rust hook does (usdt_quote_usd.rs:73-91). T6 fixture missing.?price=frontend-dapp/src/utils/__tests__/pairPriceUsd.test.ts:283-300). No USDT page/e2e. Charts Last omitsquoteContract(ChartsPage.tsx:286-299) — fail-closed; OHLC uses indexer*_usd.quote_usd_kind("USDT")has no arm (pair_price_usd.rs:90-104). Tests1003-1050.Tusdt_six_eighteen_human_times_one_is_price_usd(1063-1078); volume 18-dec (1081-1097);formatPairStatsUsdOhlc('0.00004123')(chartsPairStats.test.ts:120-124).Peg1→hub.ust1(pair_price_usd.rs:141-143); Usdt ≠ Peg1 (986-999).HUB_TICKERSstill 4 (hub_usd.rs:25).verify-issue-522verify-issue-1258does not chain 522/543/556.—formatter unchanged. No Playwright.IS NULL) but not fixture-tested.make verify-issue-1258Out of scope correctly left out: #1221 bridge/CMM, #1257 Swap scale, #1220 IBC USDC, CoinGecko USDT oracle, fifth hub cell, CG/CMC
last_priceUSD, wasm.Security audit
No medium+ external exploit path. Advisory display catalog, not custody/settlement.
symbol=USDT/ nativeuusdt/ empty contract (H1)is_pinned_usdt_cw20requiresis_cw20+ casefold contract (pair_price_usd.rs:115-131, 285-287). Repro:quote_usd_kind_for_identity("USDT", None, true, Some("terra1spoof…"), …)→None(1003-1014).hub_prices.ust1or CEX FDUSD (H5)Usdt => Some(1)(149); Peg1 still hub (141-143). NoOracleTicker::Vfdusdin this module.price_usd IS NULL/volume_usd IS NULL(usdt_quote_usd.rs:32,60,66; migration13,40). UST1/cUSTC not in the pin JOIN.$1bind (usdt_quote_usd.rs:38,68). Migration pin is a literal bech32.*_usdonly (ChartsPage.tsx:333-344). Client Last withoutquoteContractdoes not apply$1(pairPriceUsd.ts:18-35). Do not later wirequoteContracton post-#522 humanprice— fallback still treatspriceas raw (pairPriceUsd.ts:73-107); that would 6/18-double-scale.USDT_CW20_ADDRESScollision with UST1/cUSTCis_pinned_usdt_cw20wins first (285-287). Wrong env would $1 that contract. Same trust as otherHUB_*pins; no unprivileged path.Bugbot “high”: every-boot candle rebuild (
usdt_quote_usd.rs:73-91). Downgrade to Low ops, do not gate onprice_filled > 0. SQL migrate fillsswap_events.price_usdand explicitly leaves candles to the rust hook. After migrate, the rustUPDATEis a no-op (rows_affected == 0) but candles are still empty — skipping rebuild would leave GET/candles/ #113 empty on first Coolify start. Unconditional rebuild from epoch 0 is the simple correct AC2 glue. Later: skip when USD candles already exist.Gap analysis
Features: Catalog + ingest + NULL-only backfill + idle marks (
candle_mark.rs:56-61) match the ticket./poolVol / protocol TVL on columbus-5 will start showing USDT USD becausecatalog_usd_per_human_identity(..., None)still hitsDEFAULT_USDT_CW20_ADDRESS(protocol_tvl.rs:56-67,protocol_fees.rs:431-440). That is catalog expansion, not a hub fifth cell.PR body overclaim (Low docs): “dApp fallback so Charts Price (USD) and 24h OHLC can render when indexer
*_usdis still empty” is false for production pages. 24h OHLC never callsclassifyQuoteSymbol. Last/Trade/Limits omitquoteContract(ChartsPage.tsx:288-299,TradePage.tsx~399,LimitOrdersPage.tsx~190). Leaving callers unwired is the correct fail-closed choice (see H4). Prefer indexer field after restart.LocalTerra overlay (Low vs constraint): Indexer reads
USDT_CW20_ADDRESS(config.rs:424). Deploy/setup does not write it; default is columbus-5 bech32 (config.rs:25-27). SQL migrate is hardcoded to mainnet (migration:17). TVL/fees passconfigured_usdt_address: None, so LocalTerra overlay ingest ≠ TVL. Constraint called for deploy/env overlay; columbus-5 AC does not depend on it.Dead arm (Low):
traderPositionDisplay.ts:354-355case 'usdt': return 1is unreachable —classifyQuoteSymbol(pos.asset_1_symbol, pos.asset_1_denom)has no contract (289-290).IndexerPositionhas no CW20 field (types/index.ts:790-805). P&L for USDT-quoted positions stays—. Out of Charts AC; delete the arm or pass identity in a follow-up.DRY / readability:
_pinnedwrappers duplicate unpinned helpers. Frontend pin is hardcoded columbus-5 (tokenRegistry.ts:6); indexer pin is env. Acceptable for A1.Gas / wasm: N/A.
Testing gaps: T6 backfill+rebuild sqlx fixture;
candle_markhas no USDT pin vs spoof assert (candle_mark.rs:206-233);verify-issue-1258does not runswap_price_human_usdor 522/543/556; no e2e.docs/testing.mdnot updated.UI/UX: After indexer restart, Charts should show dollars; tape Price stays human. Users may also expect portfolio USD for USDT quotes (dead arm above) and LocalTerra Charts without env overlay.
Tests this review ran
pairPriceUsd.test.ts+chartsPairStats.test.tsUSDT/OHLC filter: 14 passed, 19 skipped.make verify-issue-1258greps: PASS. Cargo step failed here (cargomissing then OpenSSL headers / read-only apt). CI must runcd indexer && cargo test --lib pair_price_usd.Follow-ups (non-blocking)
/chartscLUNC/USDT candles and 24h USD OHLC; spoof ticker still—; UST1 charts still hub.price_filled.USDT_CW20_ADDRESSfrom LocalTerra deploy; thread overlay into TVL/fees.quoteContractfallback without treating post-#522priceas already human.