Skip to content

chore(defi): remove deprecated ic-cdk imports in ic-cketh-minter#10290

Merged
gregorydemay merged 4 commits into
masterfrom
gdemay/DEFI-2304-cketh-minter
May 28, 2026
Merged

chore(defi): remove deprecated ic-cdk imports in ic-cketh-minter#10290
gregorydemay merged 4 commits into
masterfrom
gdemay/DEFI-2304-cketh-minter

Conversation

@gregorydemay
Copy link
Copy Markdown
Contributor

@gregorydemay gregorydemay commented May 22, 2026

Summary

Continues DEFI-2304 — removing the #![allow(deprecated)] attributes that were introduced in #6264 when ic-cdk was upgraded to 0.18, by migrating the affected files off the deprecated ic_cdk surface.

This PR handles ic-cketh-minter:

  • ic_cdk::api::management_canister::{main, ecdsa, http_request}ic_cdk::management_canister::* + EcdsaPublicKeyArgs / EcdsaPublicKeyResult / SignWithEcdsaArgs / CanisterStatusArgs / CanisterStatusResult from ic_management_canister_types.
  • ic_cdk::api::call::RejectionCodeic_cdk::call::CallFailed and ic_cdk::management_canister::SignCallError; the existing Reason::from_reject mapping is rewritten as from_call_failed / from_sign_call_error while preserving the same Reason variants.
  • ic_cdk::caller() / ic_cdk::id()ic_cdk::api::msg_caller() / ic_cdk::api::canister_self().
  • ic_cdk::api::canister_balance128()ic_cdk::api::canister_cycle_balance().
  • ic_cdk::api::stable::stable_size()ic_cdk::stable::stable_size().
  • get_canister_status now returns the modern CanisterStatusResult; cketh_minter.did is updated to mirror the new fields (the same shape already adopted by ckBTC minter in chore(XC): remove deprecation from ic-cdk in ic-ckbtc-minter #6761).

The changes in the ckETH minter API are due to changes in the return type of get_canister_status, which is a debug endpoint where backwards-compatibility is not guaranteed.

Follows the pattern set by #6755 (ic-btc-checker) and #6761 (ic-ckbtc-minter). No behavior change.

Migrate the ckETH minter off the deprecated `ic_cdk::api::management_canister::*`,
`ic_cdk::api::call::RejectionCode`, `ic_cdk::caller`, `ic_cdk::id`,
`ic_cdk::api::canister_balance128` and `ic_cdk::api::stable::stable_size` surfaces
introduced in #6264, and drop the file-level `#![allow(deprecated)]` attributes.
The internal `RejectionCode`-based `Reason::from_reject` helper is rewritten on
top of the new `ic_cdk::call::CallFailed` / `SignCallError` enums while keeping
the same `Reason` variants. `get_canister_status` now returns the modern
`CanisterStatusResult`; `cketh_minter.did` is updated to mirror the new fields
(matching the shape already adopted by the ckBTC minter).

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 continues the DEFI-2304 migration by removing usage of deprecated ic-cdk APIs in the ic-cketh-minter canister (and related test utilities), switching to the newer ic_cdk::management_canister::* surface and updated management-canister types.

Changes:

  • Migrates management canister calls/types (HTTP outcalls, ECDSA, canister status) to ic_cdk::management_canister::* and modern argument/result structs.
  • Replaces deprecated caller/self/balance/stable-memory APIs with their current equivalents.
  • Updates get_canister_status return type and adjusts cketh_minter.did to reflect the newer status response shape.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
rs/ethereum/cketh/test_utils/src/mock.rs Updates HTTP outcall response/transform types to the modern management-canister types.
rs/ethereum/cketh/minter/src/state/tests.rs Updates ECDSA public key response type used in state-equivalence tests.
rs/ethereum/cketh/minter/src/state.rs Migrates ECDSA public key fetch to modern args/result types and updated call signature.
rs/ethereum/cketh/minter/src/management.rs Refactors rejection handling to CallFailed/SignCallError and updates sign_with_ecdsa call types.
rs/ethereum/cketh/minter/src/main.rs Replaces deprecated ic-cdk APIs and modernizes get_canister_status implementation.
rs/ethereum/cketh/minter/cketh_minter.did Updates the Candid interface for the new get_canister_status response fields.

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

Comment thread rs/ethereum/cketh/minter/src/management.rs Outdated
Comment thread rs/ethereum/cketh/minter/cketh_minter.did
@gregorydemay gregorydemay changed the title chore: DEFI-2304 remove deprecated ic-cdk imports in ic-cketh-minter chore(defi): remove deprecated ic-cdk imports in ic-cketh-minter May 27, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@mbjorkqvist mbjorkqvist left a comment

Choose a reason for hiding this comment

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

Thanks @gregorydemay! Just a few minor comments.

Comment thread rs/ethereum/cketh/minter/src/main.rs
Comment thread rs/ethereum/cketh/minter/cketh_minter.did
Comment thread rs/ethereum/cketh/minter/src/management/mod.rs
gregorydemay and others added 2 commits May 28, 2026 05:28
Mirrors the closing sentence of #6761 in the source: backwards-compatibility
of `get_canister_status` is not guaranteed, which is why migrating to the
modern `CanisterStatusResult` shape is acceptable.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Per review on #10290: `Reason::OutOfCycles` was effectively dead code before
this PR (no path produced it). The ic-cdk 0.19 `Call` builder now performs a
pre-flight check that compares `canister_liquid_cycle_balance` against
`Call::get_cost` and returns `CallFailed::InsufficientLiquidCycleBalance`
*before* `ic0.call_perform`; mapping it to `Reason::OutOfCycles` is intentional
new behavior that yields a more accurate error message than the previous
`InternalError` fallback.

Add a unit test for that mapping and three companion tests that lock in the
existing reject-code / call-perform-failed / unrecognized-code paths.

`src/management.rs` becomes `src/management/mod.rs` and the new tests live in
`src/management/tests.rs`, per the project convention of keeping unit tests in
a sibling file.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@gregorydemay gregorydemay requested a review from mbjorkqvist May 28, 2026 07:48
@gregorydemay gregorydemay added this pull request to the merge queue May 28, 2026
Merged via the queue into master with commit 13a59c1 May 28, 2026
39 checks passed
@gregorydemay gregorydemay deleted the gdemay/DEFI-2304-cketh-minter branch May 28, 2026 09:01
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.

3 participants