Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ic-cdk = { path = "ic-cdk", version = "0.19.0" }
ic-cdk-bindgen = { path = "ic-cdk-bindgen", version = "0.2.0-alpha.2" }
ic-cdk-timers = { path = "ic-cdk-timers", version = "1.0.0" }
ic-cdk-executor = { path = "ic-cdk-executor", version = "2.0.0" }
ic-management-canister-types = { path = "ic-management-canister-types", version = "0.5.0" }
ic-management-canister-types = { path = "ic-management-canister-types", version = "0.6.0" }

candid = "0.10.18" # sync with the doc comment in ic-cdk/README.md
candid_parser = "0.2.1"
Expand Down
2 changes: 2 additions & 0 deletions e2e-tests/src/bin/management_canister.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ async fn snapshots() {
let arg = TakeCanisterSnapshotArgs {
canister_id,
replace_snapshot: None,
uninstall_code: None,
sender_canister_version: None,
};
let snapshot1 = take_canister_snapshot(&arg).await.unwrap();

Expand Down
8 changes: 8 additions & 0 deletions ic-management-canister-types/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [unreleased]

## [0.6.0] - 2026-01-09

### Changed

- Added `uninstall_code` and `sender_canister_version` fields to `TakeCanisterSnapshotArgs`.
- Added `rename_canister` variant to `ChangeDetails`.
- Added the types `RenameCanisterRecord` and `RenameToRecord`.

## [0.5.0] - 2025-11-13

### Changed
Expand Down
2 changes: 1 addition & 1 deletion ic-management-canister-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ic-management-canister-types"
version = "0.5.0"
version = "0.6.0"
authors.workspace = true
edition.workspace = true
repository.workspace = true
Expand Down
60 changes: 60 additions & 0 deletions ic-management-canister-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,59 @@ pub struct LoadSnapshotRecord {
pub source: SnapshotSource,
}

/// # Rename To Record
///
/// Details about the new canister ID in a rename operation.
///
/// Contains the canister ID, version, and total number of changes of the new canister ID.
/// After renaming, the total number of canister changes reported by the IC method `canister_info`
/// is overridden to this value.
///
/// See [`RenameCanisterRecord::rename_to`].
#[derive(
CandidType, Serialize, Deserialize, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone,
)]
pub struct RenameToRecord {
/// The new canister ID.
pub canister_id: Principal,
/// The version of the new canister.
pub version: u64,
/// The total number of changes in the new canister's history.
/// This value overrides the total reported by `canister_info` after renaming.
pub total_num_changes: u64,
}

/// # Rename Canister Record
///
/// Details about a canister rename operation.
///
/// Canister renaming is described by the canister ID and the total number of canister changes
/// before renaming as well as the canister ID, version, and total number of changes of the new
/// canister ID. Because only a dedicated NNS canister can perform canister renaming, the actual
/// principal who requested canister renaming is recorded in the [`requested_by`](Self::requested_by) field.
///
/// After renaming, the total number of canister changes reported by the IC method `canister_info`
/// is overridden to the total number of canister changes of the new canister ID. Canister changes
/// referring to the canister ID before renaming are preserved.
///
/// See [`ChangeDetails::RenameCanister`].
#[derive(
CandidType, Serialize, Deserialize, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone,
)]
pub struct RenameCanisterRecord {
/// The canister ID before renaming.
pub canister_id: Principal,
/// The total number of changes in the canister's history before renaming.
pub total_num_changes: u64,
/// Details about the new canister ID after renaming.
pub rename_to: RenameToRecord,
/// The principal that requested the rename operation.
///
/// Because only a dedicated NNS canister can perform canister renaming,
/// this field records the actual principal who requested it.
pub requested_by: Principal,
}

/// # Controllers Change Record
///
/// Details about updating canister controllers.
Expand Down Expand Up @@ -711,6 +764,9 @@ pub enum ChangeDetails {
/// The change was updating canister controllers.
#[serde(rename = "controllers_change")]
ControllersChange(ControllersChangeRecord),
/// The change was renaming a canister.
#[serde(rename = "rename_canister")]
RenameCanister(RenameCanisterRecord),
}

/// # Change
Expand Down Expand Up @@ -1332,6 +1388,10 @@ pub struct TakeCanisterSnapshotArgs {
///
/// The snapshot identified by the specified ID will be deleted once a new snapshot has been successfully created.
pub replace_snapshot: Option<SnapshotId>,
/// If true, uninstall the canister code after taking the snapshot.
pub uninstall_code: Option<bool>,
/// Must match the canister's [`canister_version`](https://internetcomputer.org/docs/current/references/ic-interface-spec/#system-api-canister-version) value when specified.
pub sender_canister_version: Option<u64>,
}

/// # Take Canister Snapshot Result.
Expand Down
12 changes: 12 additions & 0 deletions ic-management-canister-types/tests/ic.did
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ type change_details = variant {
controllers_change : record {
controllers : vec principal;
};
rename_canister : record {
canister_id : principal;
total_num_changes : nat64;
rename_to : record {
canister_id : principal;
version : nat64;
total_num_changes : nat64;
};
requested_by : principal;
};
};

type change = record {
Expand Down Expand Up @@ -456,6 +466,8 @@ type snapshot = record {
type take_canister_snapshot_args = record {
canister_id : canister_id;
replace_snapshot : opt snapshot_id;
uninstall_code : opt bool;
sender_canister_version : opt nat64;
};

type take_canister_snapshot_result = snapshot;
Expand Down
Loading