fix(indexer): prevent liquidity snapshot coverage drops and harden provider failover #1453

Closed
opened 2026-10-09 07:09:36 +00:00 by PlasticDigits · 2 comments
Owner

Problem and scope

Make the cached liquidity feed reliable: independent pool-reserve observation, bounded multi-provider background ingestion/failover, and consistent publication to routing and /protocol history.

An anonymized report describes liquidity updating infrequently and implausible changes in the /protocol liquidity graph. Public read-only evidence identifies a temporary supported-pool coverage loss that can look like a withdrawal. This is a producer/cache reliability issue, linked to #1452, which requires all swap quotes in <250 ms using cached data and zero request-triggered RPC/LCD validation.

Do not publish reporter identities, conversations, screenshots, wallets or private transaction history.

Current codebase

Reviewed revision: b26b762c4a870251d780715eac6eea4e2db5c14e.

  • Raw pool reserves are stored in Postgres pair_reserves, one replaceable row per pair with raw amounts, fee bps, block height and snapshot_at. Resting orders are mirrored separately.
  • book_snapshot.rs runs a nonoverlapping ticker, default 10 s cadence, with skipped missed ticks, ≤8 concurrent jobs, 4 s pair deadlines, 2 s height deadline, response bounds and ≤1,000 orders per side. Each pair performs pool, fee and bid/ask queries plus book walking.
  • snapshot_single_pair reads the pool first but commits reserves only after fee and both book walks succeed. A book failure or deadline can therefore discard a successful reserve observation. Prior amounts/time remain stored, but after the 20 s default freshness window consumers omit that pool. Existing preservation is not sufficient to keep pool-only observations current.
  • protocol_tvl.rs values supported catalog pools from reserves and USD marks. Complete supported coverage is fresh; missing supported inputs produce partial subtotals or unavailable totals. USD value may legitimately change when prices/reserves change even without LP deposits/withdrawals.
  • Hub refresh and the volume aggregator trigger materialized liquidity publication. liquidity_snapshots.rs atomically publishes headline, pair stamps, source history and hourly/daily/monthly grains. Source history retains the last actual attempt in four-minute UTC slots; each chart bucket selects its terminal observation, never SUM or average.
  • Chart API responses are cached 60 s and the frontend series polls every 60 s. The overview qualifies current observation age independently and the frontend retains the last qualified amount through temporary outages. This is separate from raw reserve ingestion.
  • LcdClient already supports configured LCD_URLS, failover, endpoint cooldown and chain identity checking. Requests iterate endpoints in configured order; mark_failed applies one configured fixed cooldown. Production configuration requires explicit endpoints but permits a single endpoint. Audit deployed configuration and failover behavior; do not claim failover is wholly absent.
  • Default/example/frontend endpoints include PublicNode. Provider popularity is not a health signal. Live production endpoint configuration was not inspected; direct public smart-query probes in this investigation returned HTTP 403.

Public evidence

Read-only indexer API evidence on 2026-10-09 UTC:

Hour (UTC) Published USD liquidity Priced pools Quality / reason
03 230,956.111155949075835108 11 fresh
04 192,944.880059530918772431 10 partial; stale_reserve: 1
05 233,987.726232662780767113 11 fresh
06, still open 234,969.013644624242885472 11 fresh

The expected supported-pool coverage identity stayed the same. This is evidence of a missing reserve contribution, not proof of an actual ~$38k withdrawal. Exact pool identity and historical chain balances remain to be reconciled. The same public observation showed overview quality stale/null with a 20 s age limit while the latest stored chart observation remained fresh at its original observation time; distinguish current and historical age semantics.

Public endpoints:

  • /api/v1/overview
  • /api/v1/protocol/liquidity/daily?grain=hourly&limit=24
  • /api/v1/protocol/liquidity/daily?grain=daily&limit=30

Why a new implementation is needed

A healthy pool read must not be discarded because an unrelated book query failed. Ingestion must continue through flaky or rate-limited providers instead of repeatedly retrying the first endpoint and allowing useful cached reserves to age out. The chart and solver should consume observations maintained by one reliable background feed; neither may cause chain-query storms to compensate for cache misses.

Increasing TTLs, freezing USD values, hiding missing pools or treating a partial subtotal as proof of a withdrawal would conceal the underlying defect.

Relevant files

  • indexer/src/indexer/book_snapshot.rs, poller.rs: background scheduling, per-pair work and publication.
  • indexer/src/lcd/mod.rs, lcd/chain_identity.rs, config.rs, indexer/.env.example: endpoint selection, failure classification, attestation and operational configuration.
  • indexer/src/db/queries/pair_reserves.rs, resting_orders.rs: independently usable pool observations and consistent hybrid snapshots.
  • indexer/src/indexer/protocol_tvl.rs, db/queries/hub_prices.rs, liquidity_snapshots.rs, protocol_liquidity.rs, pair_liquidity_usd.rs: valuation, generation and history.
  • indexer/src/api/protocol_liquidity.rs, api/overview.rs: materialized reads and API caching.
  • frontend-dapp/src/utils/protocolLiquidityQuality.ts, protocolVolumeGrain.ts, components/protocol/ProtocolGlobalStats.tsx, ProtocolVolumeDailyChart.tsx, and query hooks: retention and chart presentation.
  • indexer/tests/book_snapshot_loop.rs, indexer_protocol_liquidity.rs, indexer_protocol_liquidity_series.rs, indexer_pair_discovery.rs; existing unit/browser tests.
  • Q1380 guidance, PD1394 guidance, and associated QA/docs.
  1. Publish a successful pool-only reserve observation independently of fee/book retrieval, with validated asset identity, raw units, observation time and height. Preserve a separately atomic, compatible reserve/book generation for hybrid quotes. A failed book update must not label an old book fresh or destroy a newly observed pool state. Cache fee/configuration changes through the ingestion pipeline rather than rereading static config unnecessarily.
  2. Use one independently scheduled, rate-budgeted background feed to maintain usable snapshots for the solver and TVL. Coalesce refresh work, skip overlapping cycles, distribute pair scheduling fairly, and measure per-pair observation age and complete supported coverage. Requests, deeper searches and API cache misses must never trigger RPC/LCD refresh or validation.
  3. Harden the existing provider pool: multiple independently operated, chain-verified endpoints; shared per-provider concurrency/rate budgets; health-aware selection; capped backoff with jitter; bounded Retry-After handling; circuit opening/quarantine; a single half-open recovery probe. Prefer healthy endpoints and avoid retrying a known-flaky first endpoint for every pair. Separate upstream 403/429/408/timeouts/5xx from deterministic contract errors and pair-local malformed/oversized responses.
  4. Reject wrong-chain, materially lagging or unsupported-history providers. Preserve original observation height/time, prevent older responses overwriting newer data, and bound failover attempts/total deadlines. Endpoint switching must not poison factory discovery or mix incompatible observations.
  5. Publish TVL/headline/pair stamps/history under the existing atomic generation contract from compatible cached observations and eligible prices. Retain old raw values on failure without rewriting their time; improve refresh/recovery rather than making stale data fresh. Maintain stock semantics and distinguish genuine price changes from missing contributions in internal reconciliation evidence.
  6. Audit the cited UTC coverage-loss window, with bounded per-pool observation and ingestion evidence. Repair only when original evidence supports it; preserve originals and use idempotent scoped repairs. Do not backdate today's reserves/prices or invent a reconstructed complete total.
  7. Keep the existing retail display rules. Reliable producer data is the fix; no explanatory dashboard, quality legend or routing work for users.

Constraints and guardrails

  • Zero quote-triggered RPC/LCD, including initial quote, deeper search, reference pricing, frontend route preflight and confirmation. All network reads discussed here belong only to separately bounded background ingestion. Coordinate cached schema/generation semantics with #1452.
  • Preserve PD1394 client/factory isolation, attestation, bounded admission and typed transient/deterministic errors. A provider failure must not create a negative pair-discovery cache entry.
  • Preserve Q1380 supported identity scope, zero proofs, nullable/unavailable semantics, original as-of, atomic generations, honest baseline eligibility and monthly history before pruning. Unsupported catalog pairs do not count as missing supported pools.
  • Preserve consistent hybrid reserve/book generations; no fresh-reserve/stale-book combination masquerading as valid hybrid data.
  • Anti-cognitive-overload: ordinary USD headline and one normal chart series; existing available numeric/partial/reported observations remain under the current presentation policy. No new quality colors, badges, legends, freshness essays or developer controls. Missing observations remain omitted; no fake zeroes, interpolated history or fabricated flat bars. Genuine lower qualified totals and zero still replace retained headline values.
  • USD liquidity is allowed to move with real prices/swaps/LP activity; do not freeze the chart or promise constant TVL.
  • Runtime uses least-privilege DB access; migrations/repairs are separate jobs and integration tests own disposable databases (#1396). No shared/production mutation for QA.
  • Do not assume DeFiLlama, listing projections or LP-token holdings have the same valuation/coverage rules. No foreign listing edges in factory/economic totals.
  • Keep internal evidence free of secrets, reporter/wallet identifiers and unbounded endpoint diagnostics.

Acceptance criteria

  • A successful pool query followed by timeout/error in fee or book work publishes a current usable pool-only observation, while hybrid eligibility remains honest and independently versioned.
  • Healthy background providers keep unchanged supported pools represented through repeated cycles; an outage affecting one provider fails over within the bounded freshness budget without dropping successful observations.
  • Repeated 403/429/408/5xx/timeouts open or prolong bounded cooldown/circuit state; known-unhealthy endpoints are not hammered. Respect bounded Retry-After; allow one half-open probe; recover automatically on verified success.
  • Multiple provider configuration and actual active endpoint health are verified through a redacted operational receipt. Wrong-chain/lagging providers are rejected. Source support alone is not proof of live failover.
  • Solver and protocol consume eligible cached observations without network queries, including under provider outage; no user-request-induced polling, retry bursts or duplicated writers.
  • Fixed supported pool data/prices yield stable complete totals and correct UTC stock history. Genuine reserve/price changes update within the documented ingestion+publication+serving budget; failed reads never become zero liquidity or renew old timestamps.
  • Newer published observations cannot be overwritten by delayed older endpoint responses. Atomic headline/pair/history generation and compatible hybrid state tests pass.
  • The cited partial-hour contribution is reconciled with available evidence; any supported repair is bounded/idempotent and preserves the original. Unknown history stays unknown.
  • Add a focused make verify-issue-<this issue>, meaningful failure/recovery and rate-budget tests, docs/config examples, and updated agent guidance. Retail behavior stays simple.

Test plan: all functional paths

Scenario Required result
Pool succeeds; fee/bid/ask walk fails separately Fresh pool-only cache available; failed component retains original time; hybrid does not mix generations.
Normal unchanged pools over many cycles, 6/18 decimals Stable reserve identity/valuation and complete supported coverage; no synthetic disappearance.
Real provide, withdraw, swap, drain to zero, price-only move Correct current totals and UTC terminal stock; no last-good server smoothing; genuine decreases reach the UI.
Primary timeout/403/429/408/5xx; healthy secondary/third Bounded successful failover; circuit and rate counters match; no repeated first-provider hammering.
All endpoints unavailable; later recovery Stored observations preserved honestly; bounded scheduled retry; no quote-triggered lookup or false-zero publication.
Wrong chain, lagging height, out-of-order replies and unsupported historical reads Rejected/quarantined safely; older results cannot overwrite newer observations.
One missing supported pool vs unsupported catalog tokens Correct internal quality and baseline eligibility; no manufactured full-coverage claim.
Hourly/daily/monthly boundaries; source pruning; cache expiry Last actual attempt retained; no SUM/average/backdated replacement; 60 s cache cannot obscure qualification rules.
Overview/pair/series caches, multiple writers and replicas Compatible generations; recovery visible within stated budget; no request-path reserve scans or network fetches.
Desktop/phone, refresh, outage, reload Retained plain headline, existing numeric chart observations, actual dates and simple tooltips; no extra diagnostics.

Test plan: attack, hack and abuse

  • Endpoint flooding, malicious slow servers, perpetual 429 and oversized Retry-After: bounded global/provider concurrency, retries, memory and half-open probes; no thundering herd.
  • Contract-local oversized/malformed orderbook responses: pair-local rejection cannot quarantine every healthy provider or suppress successful pool reads; retain response/order bounds.
  • Spoofed symbols/assets, invalid raw reserves/decimals, overflow, fake block headers and manipulated USD marks: contract/chain/height validation and checked arithmetic; no false total/zero/freshness.
  • Provider-switch/cache poisoning and factory cross-contamination: client/chain/factory namespaces remain isolated; transient rejection never becomes permanent negative discovery.
  • Delayed old snapshots, competing publication/repair workers and cancellation: generation/locking rules prevent mixed or regressed state; no half-committed hybrid snapshot.
  • Shared DB/credentials, public endpoint URLs containing secrets and hostile errors: disposable QA scope, least privilege, sanitized logs/receipts and text-only UI rendering.
  • Fake repair/flat-history shortcuts: original evidence retained, no current-price backfill and no invented missing totals.

Verification criteria

Record source/deployed revision, UTC times, deterministic fixture inputs, per-pair generation/height/age, provider attempt/circuit/rate counters, cache behavior and expected totals. Demonstrate healthy failover and recovery with mocked providers first; production checks are read-only and redact configuration secrets. Measure ingestion/publication/serving latency separately from the <250 ms quote target in #1452.

Completed before filing:

  • make verify-issue-1380: first run failed because the dedicated QA database credential was absent. After provisioning a new disposable loopback-only Postgres instance and dedicated QA role, the full retest finished 13 PASS / 0 FAIL / 2 SKIP. The skips are the unsupplied funded LocalTerra outage/LP-control fixture and deployed-revision/history acceptance; no production signing/mutation was attempted.
  • make verify-issue-1394: first run had two database-dependent failures for the same missing QA credential; full isolated retest finished 23 PASS / 0 FAIL / 0 SKIP.
  • Explicit isolated integration runs: protocol liquidity 33 passed, liquidity series 9 passed, overview 2 passed, snapshot loop 7 passed, pair discovery 10 passed.
  • make verify-issue-1398: 7 PASS / 0 FAIL / 0 SKIP.
  • Public overview/hourly/daily/pair reads completed. No existing shared database, chain stack or production data was modified. The disposable database container was removed after testing.

These passing baseline tests do not cover all newly requested decoupling, failover and latency behavior; add the scenarios above rather than treating existing tests as acceptance. Direct public LCD probes were unavailable (HTTP 403); exact historical chain reserves and actual production endpoint configuration remain unverified. Neither limitation blocks implementation or issue creation. Do not claim source tests establish production health.

## Problem and scope Make the cached liquidity feed reliable: independent pool-reserve observation, bounded multi-provider background ingestion/failover, and consistent publication to routing and /protocol history. An anonymized report describes liquidity updating infrequently and implausible changes in the /protocol liquidity graph. Public read-only evidence identifies a temporary supported-pool coverage loss that can look like a withdrawal. This is a producer/cache reliability issue, linked to [#1452](https://git.cl8y.com/code/cl8y-dex-terraclassic/issues/1452), which requires all swap quotes in <250 ms using cached data and **zero request-triggered RPC/LCD validation**. Do not publish reporter identities, conversations, screenshots, wallets or private transaction history. ## Current codebase Reviewed revision: `b26b762c4a870251d780715eac6eea4e2db5c14e`. - Raw pool reserves are stored in Postgres `pair_reserves`, one replaceable row per pair with raw amounts, fee bps, block height and `snapshot_at`. Resting orders are mirrored separately. - `book_snapshot.rs` runs a nonoverlapping ticker, default **10 s** cadence, with skipped missed ticks, ≤8 concurrent jobs, 4 s pair deadlines, 2 s height deadline, response bounds and ≤1,000 orders per side. Each pair performs pool, fee and bid/ask queries plus book walking. - `snapshot_single_pair` reads the pool first but commits reserves **only after** fee and both book walks succeed. A book failure or deadline can therefore discard a successful reserve observation. Prior amounts/time remain stored, but after the **20 s** default freshness window consumers omit that pool. Existing preservation is not sufficient to keep pool-only observations current. - `protocol_tvl.rs` values supported catalog pools from reserves and USD marks. Complete supported coverage is fresh; missing supported inputs produce partial subtotals or unavailable totals. USD value may legitimately change when prices/reserves change even without LP deposits/withdrawals. - Hub refresh and the volume aggregator trigger materialized liquidity publication. `liquidity_snapshots.rs` atomically publishes headline, pair stamps, source history and hourly/daily/monthly grains. Source history retains the last actual attempt in four-minute UTC slots; each chart bucket selects its terminal observation, never SUM or average. - Chart API responses are cached **60 s** and the frontend series polls every **60 s**. The overview qualifies current observation age independently and the frontend retains the last qualified amount through temporary outages. This is separate from raw reserve ingestion. - `LcdClient` already supports configured `LCD_URLS`, failover, endpoint cooldown and chain identity checking. Requests iterate endpoints in configured order; `mark_failed` applies one configured fixed cooldown. Production configuration requires explicit endpoints but permits a single endpoint. Audit deployed configuration and failover behavior; do not claim failover is wholly absent. - Default/example/frontend endpoints include PublicNode. Provider popularity is not a health signal. Live production endpoint configuration was not inspected; direct public smart-query probes in this investigation returned HTTP 403. ## Public evidence Read-only indexer API evidence on **2026-10-09 UTC**: | Hour (UTC) | Published USD liquidity | Priced pools | Quality / reason | | --- | ---: | ---: | --- | | 03 | 230,956.111155949075835108 | 11 | fresh | | 04 | 192,944.880059530918772431 | 10 | partial; `stale_reserve: 1` | | 05 | 233,987.726232662780767113 | 11 | fresh | | 06, still open | 234,969.013644624242885472 | 11 | fresh | The expected supported-pool coverage identity stayed the same. This is evidence of a missing reserve contribution, **not** proof of an actual ~$38k withdrawal. Exact pool identity and historical chain balances remain to be reconciled. The same public observation showed overview quality stale/null with a 20 s age limit while the latest stored chart observation remained fresh at its original observation time; distinguish current and historical age semantics. Public endpoints: - `/api/v1/overview` - `/api/v1/protocol/liquidity/daily?grain=hourly&limit=24` - `/api/v1/protocol/liquidity/daily?grain=daily&limit=30` ## Why a new implementation is needed A healthy pool read must not be discarded because an unrelated book query failed. Ingestion must continue through flaky or rate-limited providers instead of repeatedly retrying the first endpoint and allowing useful cached reserves to age out. The chart and solver should consume observations maintained by one reliable background feed; neither may cause chain-query storms to compensate for cache misses. Increasing TTLs, freezing USD values, hiding missing pools or treating a partial subtotal as proof of a withdrawal would conceal the underlying defect. ## Relevant files - `indexer/src/indexer/book_snapshot.rs`, `poller.rs`: background scheduling, per-pair work and publication. - `indexer/src/lcd/mod.rs`, `lcd/chain_identity.rs`, `config.rs`, `indexer/.env.example`: endpoint selection, failure classification, attestation and operational configuration. - `indexer/src/db/queries/pair_reserves.rs`, `resting_orders.rs`: independently usable pool observations and consistent hybrid snapshots. - `indexer/src/indexer/protocol_tvl.rs`, `db/queries/hub_prices.rs`, `liquidity_snapshots.rs`, `protocol_liquidity.rs`, `pair_liquidity_usd.rs`: valuation, generation and history. - `indexer/src/api/protocol_liquidity.rs`, `api/overview.rs`: materialized reads and API caching. - `frontend-dapp/src/utils/protocolLiquidityQuality.ts`, `protocolVolumeGrain.ts`, `components/protocol/ProtocolGlobalStats.tsx`, `ProtocolVolumeDailyChart.tsx`, and query hooks: retention and chart presentation. - `indexer/tests/book_snapshot_loop.rs`, `indexer_protocol_liquidity.rs`, `indexer_protocol_liquidity_series.rs`, `indexer_pair_discovery.rs`; existing unit/browser tests. - [Q1380 guidance](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/branch/main/skills/AGENTS_PROTOCOL_LIQUIDITY_QUALITY.md), [PD1394 guidance](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/branch/main/skills/AGENTS_PAIR_DISCOVERY_CACHE.md), and associated QA/docs. ## Recommended direction 1. Publish a successful **pool-only reserve observation independently** of fee/book retrieval, with validated asset identity, raw units, observation time and height. Preserve a separately atomic, compatible reserve/book generation for hybrid quotes. A failed book update must not label an old book fresh or destroy a newly observed pool state. Cache fee/configuration changes through the ingestion pipeline rather than rereading static config unnecessarily. 2. Use one independently scheduled, rate-budgeted background feed to maintain usable snapshots for the solver and TVL. Coalesce refresh work, skip overlapping cycles, distribute pair scheduling fairly, and measure per-pair observation age and complete supported coverage. Requests, deeper searches and API cache misses must never trigger RPC/LCD refresh or validation. 3. Harden the existing provider pool: multiple independently operated, chain-verified endpoints; shared per-provider concurrency/rate budgets; health-aware selection; capped backoff with jitter; bounded Retry-After handling; circuit opening/quarantine; a single half-open recovery probe. Prefer healthy endpoints and avoid retrying a known-flaky first endpoint for every pair. Separate upstream 403/429/408/timeouts/5xx from deterministic contract errors and pair-local malformed/oversized responses. 4. Reject wrong-chain, materially lagging or unsupported-history providers. Preserve original observation height/time, prevent older responses overwriting newer data, and bound failover attempts/total deadlines. Endpoint switching must not poison factory discovery or mix incompatible observations. 5. Publish TVL/headline/pair stamps/history under the existing atomic generation contract from compatible cached observations and eligible prices. Retain old raw values on failure without rewriting their time; improve refresh/recovery rather than making stale data fresh. Maintain stock semantics and distinguish genuine price changes from missing contributions in internal reconciliation evidence. 6. Audit the cited UTC coverage-loss window, with bounded per-pool observation and ingestion evidence. Repair only when original evidence supports it; preserve originals and use idempotent scoped repairs. Do not backdate today's reserves/prices or invent a reconstructed complete total. 7. Keep the existing retail display rules. Reliable producer data is the fix; no explanatory dashboard, quality legend or routing work for users. ## Constraints and guardrails - **Zero quote-triggered RPC/LCD**, including initial quote, deeper search, reference pricing, frontend route preflight and confirmation. All network reads discussed here belong only to separately bounded background ingestion. Coordinate cached schema/generation semantics with #1452. - Preserve PD1394 client/factory isolation, attestation, bounded admission and typed transient/deterministic errors. A provider failure must not create a negative pair-discovery cache entry. - Preserve Q1380 supported identity scope, zero proofs, nullable/unavailable semantics, original as-of, atomic generations, honest baseline eligibility and monthly history before pruning. Unsupported catalog pairs do not count as missing supported pools. - Preserve consistent hybrid reserve/book generations; no fresh-reserve/stale-book combination masquerading as valid hybrid data. - **Anti-cognitive-overload:** ordinary USD headline and one normal chart series; existing available numeric/partial/reported observations remain under the current presentation policy. No new quality colors, badges, legends, freshness essays or developer controls. Missing observations remain omitted; no fake zeroes, interpolated history or fabricated flat bars. Genuine lower qualified totals and zero still replace retained headline values. - USD liquidity is allowed to move with real prices/swaps/LP activity; do not freeze the chart or promise constant TVL. - Runtime uses least-privilege DB access; migrations/repairs are separate jobs and integration tests own disposable databases (#1396). No shared/production mutation for QA. - Do not assume DeFiLlama, listing projections or LP-token holdings have the same valuation/coverage rules. No foreign listing edges in factory/economic totals. - Keep internal evidence free of secrets, reporter/wallet identifiers and unbounded endpoint diagnostics. ## Acceptance criteria - [ ] A successful pool query followed by timeout/error in fee or book work publishes a current usable pool-only observation, while hybrid eligibility remains honest and independently versioned. - [ ] Healthy background providers keep unchanged supported pools represented through repeated cycles; an outage affecting one provider fails over within the bounded freshness budget without dropping successful observations. - [ ] Repeated 403/429/408/5xx/timeouts open or prolong bounded cooldown/circuit state; known-unhealthy endpoints are not hammered. Respect bounded Retry-After; allow one half-open probe; recover automatically on verified success. - [ ] Multiple provider configuration and actual active endpoint health are verified through a redacted operational receipt. Wrong-chain/lagging providers are rejected. Source support alone is not proof of live failover. - [ ] Solver and protocol consume eligible cached observations without network queries, including under provider outage; no user-request-induced polling, retry bursts or duplicated writers. - [ ] Fixed supported pool data/prices yield stable complete totals and correct UTC stock history. Genuine reserve/price changes update within the documented ingestion+publication+serving budget; failed reads never become zero liquidity or renew old timestamps. - [ ] Newer published observations cannot be overwritten by delayed older endpoint responses. Atomic headline/pair/history generation and compatible hybrid state tests pass. - [ ] The cited partial-hour contribution is reconciled with available evidence; any supported repair is bounded/idempotent and preserves the original. Unknown history stays unknown. - [ ] Add a focused `make verify-issue-<this issue>`, meaningful failure/recovery and rate-budget tests, docs/config examples, and updated agent guidance. Retail behavior stays simple. ## Test plan: all functional paths | Scenario | Required result | | --- | --- | | Pool succeeds; fee/bid/ask walk fails separately | Fresh pool-only cache available; failed component retains original time; hybrid does not mix generations. | | Normal unchanged pools over many cycles, 6/18 decimals | Stable reserve identity/valuation and complete supported coverage; no synthetic disappearance. | | Real provide, withdraw, swap, drain to zero, price-only move | Correct current totals and UTC terminal stock; no last-good server smoothing; genuine decreases reach the UI. | | Primary timeout/403/429/408/5xx; healthy secondary/third | Bounded successful failover; circuit and rate counters match; no repeated first-provider hammering. | | All endpoints unavailable; later recovery | Stored observations preserved honestly; bounded scheduled retry; no quote-triggered lookup or false-zero publication. | | Wrong chain, lagging height, out-of-order replies and unsupported historical reads | Rejected/quarantined safely; older results cannot overwrite newer observations. | | One missing supported pool vs unsupported catalog tokens | Correct internal quality and baseline eligibility; no manufactured full-coverage claim. | | Hourly/daily/monthly boundaries; source pruning; cache expiry | Last actual attempt retained; no SUM/average/backdated replacement; 60 s cache cannot obscure qualification rules. | | Overview/pair/series caches, multiple writers and replicas | Compatible generations; recovery visible within stated budget; no request-path reserve scans or network fetches. | | Desktop/phone, refresh, outage, reload | Retained plain headline, existing numeric chart observations, actual dates and simple tooltips; no extra diagnostics. | ## Test plan: attack, hack and abuse - Endpoint flooding, malicious slow servers, perpetual 429 and oversized Retry-After: bounded global/provider concurrency, retries, memory and half-open probes; no thundering herd. - Contract-local oversized/malformed orderbook responses: pair-local rejection cannot quarantine every healthy provider or suppress successful pool reads; retain response/order bounds. - Spoofed symbols/assets, invalid raw reserves/decimals, overflow, fake block headers and manipulated USD marks: contract/chain/height validation and checked arithmetic; no false total/zero/freshness. - Provider-switch/cache poisoning and factory cross-contamination: client/chain/factory namespaces remain isolated; transient rejection never becomes permanent negative discovery. - Delayed old snapshots, competing publication/repair workers and cancellation: generation/locking rules prevent mixed or regressed state; no half-committed hybrid snapshot. - Shared DB/credentials, public endpoint URLs containing secrets and hostile errors: disposable QA scope, least privilege, sanitized logs/receipts and text-only UI rendering. - Fake repair/flat-history shortcuts: original evidence retained, no current-price backfill and no invented missing totals. ## Verification criteria Record source/deployed revision, UTC times, deterministic fixture inputs, per-pair generation/height/age, provider attempt/circuit/rate counters, cache behavior and expected totals. Demonstrate healthy failover and recovery with mocked providers first; production checks are read-only and redact configuration secrets. Measure ingestion/publication/serving latency separately from the <250 ms quote target in #1452. Completed before filing: - `make verify-issue-1380`: first run failed because the dedicated QA database credential was absent. After provisioning a **new disposable loopback-only Postgres instance** and dedicated QA role, the full retest finished **13 PASS / 0 FAIL / 2 SKIP**. The skips are the unsupplied funded LocalTerra outage/LP-control fixture and deployed-revision/history acceptance; no production signing/mutation was attempted. - `make verify-issue-1394`: first run had two database-dependent failures for the same missing QA credential; full isolated retest finished **23 PASS / 0 FAIL / 0 SKIP**. - Explicit isolated integration runs: protocol liquidity **33 passed**, liquidity series **9 passed**, overview **2 passed**, snapshot loop **7 passed**, pair discovery **10 passed**. - `make verify-issue-1398`: **7 PASS / 0 FAIL / 0 SKIP**. - Public overview/hourly/daily/pair reads completed. No existing shared database, chain stack or production data was modified. The disposable database container was removed after testing. These passing baseline tests do not cover all newly requested decoupling, failover and latency behavior; add the scenarios above rather than treating existing tests as acceptance. Direct public LCD probes were unavailable (HTTP 403); exact historical chain reserves and actual production endpoint configuration remain unverified. Neither limitation blocks implementation or issue creation. Do not claim source tests establish production health.
Author
Owner

PR #1454 is being consolidated with #1455 at the user's explicit request. CI is intentionally skipped. The combined-source sanity review found a semantic integration problem: #1452's new local mirror reader selected independent pool observations for book pricing. It now chooses the separately committed compatible hybrid generation without renewing its timestamp, falling back to current pool-only data when the hybrid is missing/stale. Both provider resilience and quote-ingestion budgets/tests are retained through the LCD merge conflict.

The normal fj pr merge 1454 attempt returned HTTP 405 despite a mergeable source branch. The CLI has no force-merge option; the requested admin override will use the authenticated Forgejo API after feasible local checks finish, without weakening branch protection or forging CI success. Full focused verifiers are running in an isolated worktree and dedicated disposable Postgres instance. Deployment of migration 20261009145300, measured live recovery/latency and original-history reconstruction remain separate post-merge work; final results and tracking link will follow.

PR #1454 is being consolidated with #1455 at the user's explicit request. CI is intentionally skipped. The combined-source sanity review found a semantic integration problem: #1452's new local mirror reader selected independent pool observations for book pricing. It now chooses the separately committed compatible hybrid generation without renewing its timestamp, falling back to current pool-only data when the hybrid is missing/stale. Both provider resilience and quote-ingestion budgets/tests are retained through the LCD merge conflict. The normal `fj pr merge 1454` attempt returned HTTP 405 despite a mergeable source branch. The CLI has no force-merge option; the requested admin override will use the authenticated Forgejo API after feasible local checks finish, without weakening branch protection or forging CI success. Full focused verifiers are running in an isolated worktree and dedicated disposable Postgres instance. Deployment of migration `20261009145300`, measured live recovery/latency and original-history reconstruction remain separate post-merge work; final results and tracking link will follow.
Author
Owner

Closing the merged liquidity-feed implementation after #1454 and #1455 were merged at the user's explicit request. Consolidated code revision: 4e84ee5e3b947714f33cbe5fe05a1e0fe734443e. Conflict resolution preserves independent pool/hybrid provenance, provider circuits and quote-ingestion pacing; the additional local mirror-generation regression passes twice.

Post-merge migration/deployment, actual external quote latency, live provider failover/recovery and supported pool coverage, connected-wallet acceptance and evidence-supported historical reconciliation are now tracked in #1456. Existing DeFiLlama deployment/reconciliation remains #1449. This closure does not assert deployed acceptance or reconstruct the unknown historical contribution.

Combined-source checks are explicitly mixed: verify-issue-1453 is 10 PASS / 2 FAIL / 2 SKIP because the old request-time hybrid solver fixture suite has 8 failures per pass under the new uninitialized-local-cache fail-closed contract. Provider/feed/valuation/discovery library groups, the 73 dedicated liquidity/feed DB tests per pass, 97 frontend tests per pass and four browser checks pass. Those quote-fixture compatibility failures and unfinished quote implementation remain #1452. All executed failures, the browser timing outlier/retest and database-environment limits are preserved in the consolidation receipt.

CI and unavailable review/verification holds were overridden per the explicit merge instruction without fabricating successful statuses or weakening branch protection. Operational follow-up lives in #1456; this implementation issue is not left open solely for verification.

Closing the merged liquidity-feed implementation after #1454 and #1455 were merged at the user's explicit request. Consolidated code revision: `4e84ee5e3b947714f33cbe5fe05a1e0fe734443e`. Conflict resolution preserves independent pool/hybrid provenance, provider circuits and quote-ingestion pacing; the additional local mirror-generation regression passes twice. Post-merge migration/deployment, actual external quote latency, live provider failover/recovery and supported pool coverage, connected-wallet acceptance and evidence-supported historical reconciliation are now tracked in #1456. Existing DeFiLlama deployment/reconciliation remains #1449. This closure does not assert deployed acceptance or reconstruct the unknown historical contribution. Combined-source checks are explicitly mixed: `verify-issue-1453` is 10 PASS / 2 FAIL / 2 SKIP because the old request-time hybrid solver fixture suite has 8 failures per pass under the new uninitialized-local-cache fail-closed contract. Provider/feed/valuation/discovery library groups, the 73 dedicated liquidity/feed DB tests per pass, 97 frontend tests per pass and four browser checks pass. Those quote-fixture compatibility failures and unfinished quote implementation remain #1452. All executed failures, the browser timing outlier/retest and database-environment limits are preserved in [the consolidation receipt](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/branch/main/docs/qa/merge-2026-10-09/README.md). CI and unavailable review/verification holds were overridden per the explicit merge instruction without fabricating successful statuses or weakening branch protection. Operational follow-up lives in #1456; this implementation issue is not left open solely for verification.
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#1453
No description provided.