Skip to content

refactor: read HTTP/ECDSA outcall cycles from the per-use-case map - #11202

Draft
mraszyk wants to merge 1 commit into
masterfrom
mraszyk/read-outcalls-cycles-from-use-cases
Draft

refactor: read HTTP/ECDSA outcall cycles from the per-use-case map#11202
mraszyk wants to merge 1 commit into
masterfrom
mraszyk/read-outcalls-cycles-from-use-cases

Conversation

@mraszyk

@mraszyk mraszyk commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

The cycles consumed by HTTP and ECDSA outcalls are tracked both in the legacy scalar fields consumed_cycles_http_outcalls / consumed_cycles_ecdsa_outcalls of SubnetMetrics and in the consumed_cycles_by_use_case map, which a migration introduced in #10844 keeps in lockstep with those fields.

This switches all readers over to the map:

  • get_consumed_cycles_http_outcalls / get_consumed_cycles_ecdsa_outcalls now read the HTTPOutcalls / ECDSAOutcalls entries of consumed_cycles_by_use_case, via a new helper that also backs the existing Schnorr / VetKd / dropped messages getters.
  • consumed_cycles_total and consumed_cycles_total_v28 add those entries instead of the scalar fields.

The scalar fields are still observed and serialized, so that downgrading to an earlier replica version keeps observing the correct totals; only their reads are gone.

The cycles consumed by HTTP and ECDSA outcalls are tracked both in the
legacy scalar fields consumed_cycles_http_outcalls /
consumed_cycles_ecdsa_outcalls of SubnetMetrics and in the
consumed_cycles_by_use_case map, which a migration introduced in #10844
keeps in lockstep with those fields.

This switches all readers over to the map:

- get_consumed_cycles_http_outcalls / get_consumed_cycles_ecdsa_outcalls
  now read the HTTPOutcalls / ECDSAOutcalls entries of
  consumed_cycles_by_use_case, via a new helper that also backs the
  existing Schnorr / VetKd / dropped messages getters.
- consumed_cycles_total and consumed_cycles_total_v28 add those entries
  instead of the scalar fields.

The scalar fields are still observed and serialized, so that downgrading
to an earlier replica version keeps observing the correct totals; only
their reads are gone.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@mraszyk
mraszyk marked this pull request as ready for review August 18, 2026 16:16
@mraszyk
mraszyk requested a review from a team as a code owner August 18, 2026 16:16
@zeropath-ai

zeropath-ai Bot commented Aug 18, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to 7d085c9.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► rs/replicated_state/src/metadata_state.rs
    Add getters for get_consumed_cycles_http_outcalls and get_consumed_cycles_ecdsa_outcalls
► rs/replicated_state/src/metadata_state.rs
    Add get_consumed_cycles_subnet_use_case and migrate_outcalls_cycles_to_use_cases documentation updates
Enhancement ► rs/replicated_state/src/metadata_state/tests.rs
    Update tests to reflect migrated use_case entries and updated totals
Enhancement ► rs/replicated_state/src/metrics.rs
    Update to use get_consumed_cycles_ecdsa_outcalls and get_consumed_cycles_http_outcalls via subnet metrics getters

@mraszyk
mraszyk marked this pull request as draft August 19, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant