Indexer: narrow fee-discount registry health API (#373) #891
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!891
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-373-fee-discount-registry-health"
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
Implements GitLab #373 — a dedicated
GET /api/v1/health/fee-discountendpoint for ops/integrators to detect fee-discount registry LCD outages without extending genericGET /healthor exposing per-trader registry errors.configviaLcdClientevery 60s whenFEE_DISCOUNT_ADDRESSis setconfigured,fee_discount_registry_ok(nullwhen unconfigured),consecutive_lcd_failurestracing::error(≥2 consecutive); recovery atinfodocs/indexer-invariants.mdandskills/AGENTS_INDEXER_API_LCD_SECURITY.mdAcceptance checklist
GET /api/v1/health/fee-discountreturnsconfigured,fee_discount_registry_ok,consecutive_lcd_failurescd indexer && cargo test --test api_fee_discount_health configured_successful_probe_reports_ok -- --test-threads=1configured=false,fee_discount_registry_ok=nullcd indexer && cargo test --test api_fee_discount_health unconfigured_fee_discount_health_returns_null_ok -- --test-threads=1cd indexer && cargo test --test api_fee_discount_health lcd_failure_increments_counter_without_leaking_upstream_text -- --test-threads=1tracing::error(≥2)cd indexer && cargo test fee_discount_registry_health::tests::repeated_lcd_failure_increments_counter --lib+ code reviewfee_discount_registry_health.rsGET /healthunchangedcd indexer && cargo test --test api_fee_discount_health generic_health_unchanged -- --test-threads=1cd indexer && cargo test --test security -- --test-threads=1cd indexer && cargo test fee_discount_registry_health --libswap_uses_full_fee_when_discount_registry_query_failsunchangedThird-party verification
With indexer running and
FEE_DISCOUNT_ADDRESSset, block registry LCD access and confirmfee_discount_registry_ok: falsewith nohttp://,cosmwasm, orAll LCD endpoints failedin the JSON body.changed the description
changed the description
Security review — MR !891
Commit reviewed:
a165749c4c8c61438cfac75edf40ef9369706c05Scope:
GET /api/v1/health/fee-discount, background fee-discount registry LCD probe (fee_discount_registry_health.rs), router wiring, docs/tests for H6b sanitization.Method: Diff review; traced request path (no attacker-controlled input to LCD/DB); verified response is a fixed struct clone (
configured,fee_discount_registry_ok,consecutive_lcd_failuresonly); confirmed upstreamLcdErrortext stays intracinglogs, not HTTP body; compared middleware (global rate limit, no per-request LCD); checked prior MR notes (no prior security threads).Outcome:
FINDINGS: 0medium+Security review: no medium+ findings on this diff.
FEE_DISCOUNT_ADDRESSand fixed{"config":{}}query on a 60s background loop — not request-amplifiable./health(globaltower_governoronly).Inline threads: none (no findings to anchor).
added 89 commits
main85b2af8e- Merge origin/main into issue-373-fee-discount-registry-healthCompare with previous version
Resolved merge conflicts with
mainafter integrating #365's poller-backed cancellable probe loop.Conflict resolution:
fee_discount_registry_health.rs: merged main'srun_fee_discount_registry_probe_loop(cancellation-aware, spawned from poller) with #373'sfrom_config/configuredconstructors, null-until-first-probe initial state, and tracing-only upstream error detailmain.rs: dropped duplicate probe spawn (#373); probe runs via poller like maindocs/indexer-invariants.md: kept main's #363 rate-limit row + #373 observability exceptionapi_fee_discount_healthsuiteSanity:
cargo test fee_discount_registry_health --libandcargo test --test api_fee_discount_health -- --test-threads=1pass.changed the description
Security review — MR !891
Commit reviewed:
85b2af8e5ffadddf89594895b1a40ed893904fccScope: Post-merge re-review of
GET /api/v1/health/fee-discount,fee_discount_registry_health.rs(cancellable 60s background probe via poller), handler wiring, docs/tests (H6b). Prior review ona165749cpredates theorigin/mainmerge.Method: Diff and full-path trace on current SHA; attacker-controlled input → sink analysis; verified HTTP body is fixed
FeeDiscountRegistryHealthSnapshotonly (configured,fee_discount_registry_ok,consecutive_lcd_failures); confirmedLcdError/ LCD URL text stays intracinglogs only (record_probe_failure), not JSON; LCD probe uses operatorFEE_DISCOUNT_ADDRESS+ fixed{"config":{}}on background loop (not request-amplifiable); query params ignored (endpoint_has_no_trader_query_params); globaltower_governoronapi_router(same posture as/health).Outcome:
FINDINGS: 0medium+Security review: no medium+ findings on this diff.
Inline threads: none (no findings to anchor).
mentioned in commit
cccd4cf23e