Skip to content

Add a diagnostics entrypoint summarizing protocol counters for off-chain scraping in diagnostics.rs #1738

Description

@Baskarayelu

📋 Description

diagnostics.rs emits domain-tagged structured signals, but there is no single read entrypoint returning a compact counter summary (invoice count by status, active bids, open disputes, escrows held) that an off-chain scraper can poll in one call. Scrapers currently must aggregate from many separate getters.

Why this matters: observability scrapers want one cheap snapshot, not N round-trips. A single diagnostics summary read gives monitoring a stable, low-cost contract for protocol-health counters.

🎯 Requirements & Context

  • Add get_diagnostics_summary(env) -> DiagnosticsSummary aggregating counts from existing getters (invoice status counts, active bids, open disputes via get_invoices_with_disputes, escrows held).
  • Reuse existing count helpers (e.g. count_active_invoices) rather than re-scanning.
  • Keep the read bounded — do not introduce an unbounded scan; document any cap.
  • Add /// doc comments.

Context & constraints

  • SDK 25.1.1. Pure read; no auth.

🛠️ Suggested Execution

git checkout -b feature/diagnostics-summary
cargo test -p quicklendx-contracts diagnostics_summary -- --nocapture
cargo clippy -p quicklendx-contracts --all-targets -- -D warnings
  • Edge cases: empty protocol (all zeros); counts after a full lifecycle; bounded behavior with many records.

Example commit message

feat(diagnostics): add get_diagnostics_summary counter snapshot

One bounded read returning invoice/bid/dispute/escrow counters for off-chain
scrapers.

✅ Acceptance Criteria & Guidelines

Requirement Target
Single bounded summary read Required
Reuses existing counters (no re-scan) Required
Test coverage ≥ 95%
cargo clippy clean Required
Timeframe 96 hours from assignment

💬 Community & Support

Join Discord: https://discord.gg/VpngvTjWa — comment to claim. 🚀

Metadata

Metadata

Assignees

No one assigned

    Fields

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions