Skip to content

deprecate(cmc): mark historic-rate endpoints as superseded by Governance#9878

Draft
jasonz-dfinity wants to merge 1 commit intojason/NNS1-4319-remove-old-maturity-pollingfrom
jason/NNS1-4319-level-maturity-modulation
Draft

deprecate(cmc): mark historic-rate endpoints as superseded by Governance#9878
jasonz-dfinity wants to merge 1 commit intojason/NNS1-4319-remove-old-maturity-pollingfrom
jason/NNS1-4319-level-maturity-modulation

Conversation

@jasonz-dfinity
Copy link
Copy Markdown
Contributor

@jasonz-dfinity jasonz-dfinity commented Apr 14, 2026

Why

Governance now computes the 30-day ICP/XDR average and maturity modulation locally (previous PRs). CMC is no longer the authoritative source for either value, so its rate-querying infrastructure is deprecated rather than removed to give downstream callers time to migrate.

https://dfinity.atlassian.net/browse/NNS1-4319

What

The following CMC items are marked deprecated (no code deleted; kept for upgrade safety and backward compatibility):

  • Query endpoints: get_average_icp_xdr_conversion_rate, neuron_maturity_modulation
  • Internal helpers: update_recent_icp_xdr_rates, compute_average_icp_xdr_rate_at_time, compute_maturity_modulation, compute_capped_maturity_modulation
  • State fields: average_icp_xdr_conversion_rate, recent_icp_xdr_rates, maturity_modulation_permyriad

Deprecated items are moved to the end of main.rs so active code appears first.

PR Chain

Testing

Existing CMC tests cover the deprecated code paths, which remain functional.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Deprecates legacy CMC “historic-rate” state fields and query endpoints that are now superseded by NNS Governance’s locally computed ICP/XDR averages and maturity modulation, while retaining functionality for upgrade safety and backwards compatibility.

Changes:

  • Added deprecation documentation to persisted StateV2 fields that Governance no longer reads.
  • Marked the historic-rate query endpoints as #[deprecated] and clarified they’re kept for backwards compatibility.
  • Replaced helper-function doc comments with deprecation guidance pointing callers to Governance implementations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread rs/nns/cmc/src/main.rs
/// the average rate over `NUM_ICP_XDR_RATES_FOR_AVERAGE` days.
/// The first received rate for each day is stored, ideally with a timestamp
/// exactly at the start of the day.
/// Deprecated: Superseded by `UpdateIcpXdrRatesTask` in NNS Governance, which maintains
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The doc comment references UpdateIcpXdrRatesTask in NNS Governance, but that type doesn’t appear to exist. In Governance, the scheduled timer task is UpdateIcpXdrRateRelatedData (see rs/nns/governance/src/timer_tasks/mod.rs:15,44). Please update the reference so the deprecation guidance points to the correct replacement.

Suggested change
/// Deprecated: Superseded by `UpdateIcpXdrRatesTask` in NNS Governance, which maintains
/// Deprecated: Superseded by `UpdateIcpXdrRateRelatedData` in NNS Governance, which maintains

Copilot uses AI. Check for mistakes.
Comment thread rs/nns/cmc/src/main.rs
Comment on lines +955 to +957
/// Deprecated: NNS Governance uses `compute_average_icp_xdr_rate` from the shared
/// `ic_nervous_system_clients` library instead. CMC retains this for its own deprecated
/// `update_recent_icp_xdr_rates` path.
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment says Governance uses compute_average_icp_xdr_rate from the ic_nervous_system_clients library, but the only compute_average_icp_xdr_rate found is in Governance (rs/nns/governance/src/timer_tasks/update_icp_xdr_rate_related_data.rs:61). Please correct the reference (crate/module) so readers can find the actual implementation.

Suggested change
/// Deprecated: NNS Governance uses `compute_average_icp_xdr_rate` from the shared
/// `ic_nervous_system_clients` library instead. CMC retains this for its own deprecated
/// `update_recent_icp_xdr_rates` path.
/// Deprecated: NNS Governance now uses its own `compute_average_icp_xdr_rate`
/// implementation in Governance's ICP/XDR rate update task. CMC retains this for its
/// own deprecated `update_recent_icp_xdr_rates` path.

Copilot uses AI. Check for mistakes.
Comment thread rs/nns/cmc/src/main.rs
/// The function computes the maturity modulation for the current time/day, based on the given
/// start-of-day conversion rates.
/// Deprecated: NNS Governance computes maturity modulation locally via `compute_maturity_modulation_permyriad`
/// in `update_icp_xdr_rates.rs`. CMC retains this for its own deprecated state.
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The deprecation comment points to update_icp_xdr_rates.rs, but Governance’s implementation lives in rs/nns/governance/src/timer_tasks/update_icp_xdr_rate_related_data.rs (and tests in ..._tests.rs). Please update the filename/module reference to avoid a dead pointer.

Suggested change
/// in `update_icp_xdr_rates.rs`. CMC retains this for its own deprecated state.
/// in `update_icp_xdr_rate_related_data.rs`. CMC retains this for its own deprecated state.

Copilot uses AI. Check for mistakes.
@jasonz-dfinity jasonz-dfinity force-pushed the jason/NNS1-4319-remove-old-maturity-polling branch from 0a6e0cb to b7797f9 Compare April 15, 2026 19:27
@jasonz-dfinity jasonz-dfinity force-pushed the jason/NNS1-4319-level-maturity-modulation branch 2 times, most recently from 165bcb5 to dd17c5d Compare April 15, 2026 21:29
@jasonz-dfinity jasonz-dfinity force-pushed the jason/NNS1-4319-remove-old-maturity-polling branch from b7797f9 to 4fbe4bf Compare April 15, 2026 21:29
@jasonz-dfinity jasonz-dfinity force-pushed the jason/NNS1-4319-level-maturity-modulation branch from dd17c5d to 9d8b478 Compare April 15, 2026 22:29
@jasonz-dfinity jasonz-dfinity force-pushed the jason/NNS1-4319-remove-old-maturity-polling branch from 4fbe4bf to c1759e0 Compare April 15, 2026 22:29
@jasonz-dfinity jasonz-dfinity force-pushed the jason/NNS1-4319-level-maturity-modulation branch from 9d8b478 to e26cc2a Compare April 16, 2026 05:21
@jasonz-dfinity jasonz-dfinity force-pushed the jason/NNS1-4319-remove-old-maturity-polling branch from c1759e0 to 21d9a14 Compare April 16, 2026 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants