chore: DEFI-2304 remove deprecated ic-cdk imports in ic-icrc1-ledger#10321
Draft
gregorydemay wants to merge 2 commits into
Draft
chore: DEFI-2304 remove deprecated ic-cdk imports in ic-icrc1-ledger#10321gregorydemay wants to merge 2 commits into
gregorydemay wants to merge 2 commits into
Conversation
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>
Contributor
There was a problem hiding this comment.
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-cdkequivalents. - Updates the
StableReaderimport to the modernic_cdk::stablepath. - 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends DEFI-2304 — removing the file-level
#![allow(deprecated)]attribute introduced in #6264.This PR handles
ic-icrc1-ledger:ic_cdk::api::caller→ic_cdk::api::msg_caller.ic_cdk::api::set_certified_data(&root)→ic_cdk::api::certified_data_set(root)(the modern signature takesT: AsRef<[u8]>directly).ic_cdk::api::canister_balance128→ic_cdk::api::canister_cycle_balance.ic_cdk::api::stable::StableReader→ic_cdk::stable::StableReader.ic_cdk::api::stable::stable_size→ic_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.