Skip to content

Add admin runtime introspection entrypoint exposing protocol health summary #1201

@Baskarayelu

Description

@Baskarayelu

Description

Operations today must call a dozen getters (get_total_invoice_count, get_treasury, get_fee_bps, is_paused, get_pending_emergency_withdraw, ...) to assemble a health view. Add get_protocol_health(env) -> ProtocolHealth returning a single struct with version, init flag, paused flag, emergency status, treasury, fee bps, counts, and currency count. This becomes the canonical heartbeat for off-chain dashboards.

Requirements and context

  • Secure: read-only, no auth required.
  • Tested: every field populated correctly across protocol states.
  • Documented: docs/protocol-health.md.
  • Reference: src/lib.rs, src/admin.rs, src/pause.rs, src/emergency.rs.

Suggested execution

git checkout -b feature/protocol-health-endpoint

  • Add src/health.rs defining ProtocolHealth.
  • Wire get_protocol_health in src/lib.rs.
  • Tests: src/test_protocol_health.rs.
  • Docs: docs/protocol-health.md.
  • Rust doc /// NatSpec-style comments on each field.
  • Validate that no PII or per-user fields leak.

Test and commit

Run cargo test test_protocol_health. Cover edge cases: uninitialized, paused, mid-emergency-withdraw. Include note that this endpoint is purely advisory.

Example commit message

feat(admin): add get_protocol_health runtime introspection endpoint

Guidelines

  • Minimum 95% test coverage
  • Clear documentation in docs/protocol-health.md
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions