deprecate(cmc): mark historic-rate endpoints as superseded by Governance#9878
Conversation
There was a problem hiding this comment.
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
StateV2fields 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.
| /// 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 |
There was a problem hiding this comment.
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.
| /// Deprecated: Superseded by `UpdateIcpXdrRatesTask` in NNS Governance, which maintains | |
| /// Deprecated: Superseded by `UpdateIcpXdrRateRelatedData` in NNS Governance, which maintains |
| /// 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. |
There was a problem hiding this comment.
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.
| /// 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. |
| /// 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. |
There was a problem hiding this comment.
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.
| /// 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. |
0a6e0cb to
b7797f9
Compare
165bcb5 to
dd17c5d
Compare
b7797f9 to
4fbe4bf
Compare
dd17c5d to
9d8b478
Compare
4fbe4bf to
c1759e0
Compare
9d8b478 to
e26cc2a
Compare
c1759e0 to
21d9a14
Compare
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):
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.