Skip to content

chore: DEFI-2304 remove deprecated ic-cdk imports in ic-icrc1-ledger#10321

Draft
gregorydemay wants to merge 2 commits into
masterfrom
gdemay/DEFI-2304-icrc1-ledger
Draft

chore: DEFI-2304 remove deprecated ic-cdk imports in ic-icrc1-ledger#10321
gregorydemay wants to merge 2 commits into
masterfrom
gdemay/DEFI-2304-icrc1-ledger

Conversation

@gregorydemay
Copy link
Copy Markdown
Contributor

@gregorydemay gregorydemay commented May 27, 2026

Summary

Extends DEFI-2304 — removing the file-level #![allow(deprecated)] attribute introduced in #6264.

This PR handles ic-icrc1-ledger:

  • ic_cdk::api::calleric_cdk::api::msg_caller.
  • ic_cdk::api::set_certified_data(&root)ic_cdk::api::certified_data_set(root) (the modern signature takes T: AsRef<[u8]> directly).
  • ic_cdk::api::canister_balance128ic_cdk::api::canister_cycle_balance.
  • ic_cdk::api::stable::StableReaderic_cdk::stable::StableReader.
  • ic_cdk::api::stable::stable_sizeic_cdk::stable::stable_size.

No behavior change.

Follows the pattern set by #6755 (ic-btc-checker), #6761 (ic-ckbtc-minter), #10289, #10290, #10291, #10317, #10318, #10319 and #10320.

Migrate the ICRC-1 ledger canister off `ic_cdk::api::caller`,
`ic_cdk::api::set_certified_data`, `ic_cdk::api::canister_balance128`,
`ic_cdk::api::stable::{StableReader, stable_size}` (all deprecated in #6264),
and drop the file-level `#![allow(deprecated)]`. The `set_certified_data(&root)`
sites become `certified_data_set(root)` (the modern signature takes
`T: AsRef<[u8]>` directly).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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

This PR removes deprecated ic-cdk API usage from the ICRC-1 ledger canister and drops the file-level deprecated allowance, aligning it with the ongoing DEFI-2304 migration.

Changes:

  • Replaces deprecated caller, certified data, cycle balance, and stable memory APIs with current ic-cdk equivalents.
  • Updates the StableReader import to the modern ic_cdk::stable path.
  • Keeps behavior unchanged while eliminating the deprecated API allowance.

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

@@ -171,7 +170,7 @@ fn post_upgrade(args: Option<LedgerArgument>) {
// This cannot be called in `post_upgrade_internal`, since that is benchmarked using
// canbench, and canbench calls functions as non-replicated queries, and `set_certified_data`
Per Copilot review on #10321: the explanatory comment above the
`certified_data_set` call still named the deprecated `set_certified_data`
function it replaced; update the reference so the rationale stays in sync
with the code.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants