Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
5c02350
Add 'dfx canister rename' subcommand stub.
vincent-dfinity Oct 28, 2025
8f689ed
Update to the revision that pocket-ic added support for migration can…
vincent-dfinity Oct 28, 2025
e8986b1
Implemented 'dfx canister rename'.
vincent-dfinity Oct 28, 2025
e8a66af
Check snapshot and add --yes flag.
vincent-dfinity Oct 28, 2025
4cd85de
Add spinner to update the renaming status.
vincent-dfinity Oct 28, 2025
5c1ead5
Remove the NNS canister from the controllers.
vincent-dfinity Oct 28, 2025
2d9134e
Ensure the canisters are stopped instead of stopping them.
vincent-dfinity Oct 28, 2025
201fed7
Map ValidationError.
vincent-dfinity Oct 28, 2025
ba230a4
Fixed the method name.
vincent-dfinity Oct 28, 2025
d0fa4d1
Fixed the wrong canister...
vincent-dfinity Oct 28, 2025
a8386ed
Updated to 'dfx canister migrate-id'
vincent-dfinity Oct 28, 2025
ad76446
Addressed review comments.
vincent-dfinity Oct 28, 2025
8859433
Set the cycles minimum value to 10T and maximum value to 15T
vincent-dfinity Oct 28, 2025
6aacb44
Add a new e2e test
vincent-dfinity Oct 28, 2025
190c132
No need to remove the migration canister as it will remove on its own
vincent-dfinity Oct 28, 2025
69f229f
Merge branch 'master' into vincent/SDK-2044
vincent-dfinity Oct 29, 2025
4a031c1
Implemented 'dfx canister migration-status'
vincent-dfinity Oct 29, 2025
b4d58b7
Addressed review comments.
vincent-dfinity Oct 29, 2025
5846899
update replica to elected version
viviveevee Nov 17, 2025
49cc88d
docs
mraszyk Nov 26, 2025
e347696
Merge branch 'master' into vincent/SDK-2044
mraszyk Nov 26, 2025
6b514c7
changelog
mraszyk Nov 26, 2025
19a250a
types
mraszyk Nov 26, 2025
c09b506
bump agent-rs and ic-management-canister-types
mraszyk Dec 1, 2025
6e6ff3d
Merge branch 'master' into vincent/SDK-2044
mraszyk Dec 1, 2025
b0342f2
Merge branch 'master' into vincent/SDK-2044
mraszyk Dec 1, 2025
ebfe083
fix lock file
mraszyk Dec 1, 2025
f0587fa
Merge branch 'master' into vincent/SDK-2044
mraszyk Dec 1, 2025
4059be3
agent-rs
mraszyk Dec 1, 2025
f257cab
retry failed migration status calls
mraszyk Dec 2, 2025
a0d33f4
lint
mraszyk Dec 2, 2025
12026c7
check that the two canisters are ready for migration
mraszyk Dec 2, 2025
cfe7a6a
fix
mraszyk Dec 2, 2025
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

# UNRELEASED

### feat: support for canister ID migration

Canister ID migration can be performed using `dfx canister migrate-id`
and its status can be checked out using `dfx canister migration-status`.

# 0.30.1

### feat: support dogecoin for the local dev environment
Expand Down
35 changes: 15 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ future_not_send = "warn"
candid = "0.10.18"
candid_parser = "0.2.2"
dfx-core = { path = "src/dfx-core", version = "0.2.0" }
ic-agent = "0.44.2"
ic-agent = { git = "https://github.com/dfinity/agent-rs", rev = "57befac12a96a90868744f48660f31aff3835739" }
ic-asset = { path = "src/canisters/frontend/ic-asset", version = "0.25.0" }
ic-cdk = "0.19.0-beta.2"
ic-identity-hsm = "0.44.2"
ic-utils = "0.44.2"
ic-management-canister-types = "0.4.1"
ic-identity-hsm = { git = "https://github.com/dfinity/agent-rs", rev = "57befac12a96a90868744f48660f31aff3835739" }
ic-utils = { git = "https://github.com/dfinity/agent-rs", rev = "57befac12a96a90868744f48660f31aff3835739" }
ic-management-canister-types = "0.5.0"

aes-gcm = { version = "0.10.3", features = ["std"] }
anyhow = "1.0.56"
Expand Down
84 changes: 84 additions & 0 deletions docs/cli-reference/dfx-canister.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ For reference information and examples that illustrate using `dfx canister` comm
| [`install`](#dfx-canister-install) | Installs compiled code in a canister. |
| [`logs`](#dfx-canister-logs) | Returns the logs from a canister. |
| [`metadata`](#dfx-canister-metadata) | Displays metadata of a canister. |
| [`migrate-id`](#dfx-canister-migrate-id) | Performs canister ID migration. |
| [`migration-status`](#dfx-canister-migration-status) | Displays the current status for a canister ID migration. |
| [`request-status`](#dfx-canister-request-status) | Requests the status of a call to a canister. |
| [`send`](#dfx-canister-send) | Send a previously-signed message. |
| [`set-id`](#dfx-canister-id) | Sets the identifier of a canister. |
Expand Down Expand Up @@ -718,6 +720,88 @@ service : {
}
```

## dfx canister migrate-id

Use the `dfx canister migrate-id` command to perform canister ID migration
of a canister on one subnet (called the "migrated" canister)
to another subnet replacing the canister ID of a canister on that other subnet.

### Basic usage

``` bash
dfx canister migrate-id <canister> --replace <replace>
```

### Arguments

You can use the following arguments with the `dfx canister migrate-id` command.

| Argument | Description |
|-----------------|----------------------------------------------------------------------------------------------------------|
| `canister` | Specifies the name or id of the canister whose canister ID you want to migrate. |
| `replace` | Specifies the name or id of the canister whose canister ID will be replaced by the migrated canister ID. |

### Examples

To migrate the canister ID of the canister called `migrated` and
replace the canister ID of the canister called `replaced`,
you can run the following command:

```bash
$ dfx canister migrate-id migrated --replace replaced
```

The command displays output similar to the following:

```
WARNING!
Canister 'migrated' will be removed from its own subnet. Continue?
Do you want to proceed? yes/No
yes
Migration succeeded at 2025-11-26 08:57:41 UTC
```

## dfx canister migration-status

Use the `dfx canister migration-status` command to display the current status
for a canister ID migration (triggered by a separate command [`migrate-id`](#dfx-canister-migrate-id))
of a canister on one subnet (called the "migrated" canister)
to another subnet replacing the canister ID of a canister on that other subnet.

### Basic usage

``` bash
dfx canister migration-status <canister> --replace <replace>
```

### Arguments

You can use the following arguments with the `dfx canister migration-status` command.

| Argument | Description |
|-----------------|----------------------------------------------------------------------------------------------------------|
| `canister` | Specifies the name or id of the canister whose canister ID you want to migrate. |
| `replace` | Specifies the name or id of the canister whose canister ID will be replaced by the migrated canister ID. |

### Examples

To display the current status for a canister ID migration
of the canister called `migrated` and
replacing the canister ID of the canister called `replaced`,
you can run the following command:

```bash
$ dfx canister migration-status migrated --replace replaced
```

The command displays output similar to the following:

```
| Canister | Canister To Be Replaced | Migration Status |
| --------------------------- | --------------------------- | -------------------------- |
| uqqxf-5h777-77774-qaaaa-cai | ahree-maaaa-aaaar-q777q-cai | In progress: SourceDeleted |
```

## dfx canister request-status

Use the `dfx canister request-status` command to request the status of a call to a canister. This command
Expand Down
41 changes: 41 additions & 0 deletions e2e/tests-dfx/canister_migration.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env bats

load ../utils/_

setup() {
standard_setup
dfx_new hello
}

teardown() {
dfx_stop
standard_teardown
}

@test "canister migrate canister id" {
dfx_start --system-canisters
install_asset counter

# Update dfx.json: rename hello_backend -> source, and add target canister
jq '.canisters.source = .canisters.hello_backend | del(.canisters.hello_backend)' dfx.json | sponge dfx.json
jq '.canisters.target = { "main": "counter.mo", "type": "motoko" }' dfx.json | sponge dfx.json

# Deploy the source to the application subnet.
dfx deploy source

# Create the target canister on the fiduciary subnet.
dfx canister create target --subnet-type fiduciary

dfx canister stop source
dfx canister stop target

# Make sure the source has enough cycles to do the migration.
dfx ledger fabricate-cycles --canister source --cycles 10000000000000

# The migration will take a few minutes to complete.
assert_command dfx canister migrate-id source --replace target --yes
assert_contains "Migration succeeded"

assert_command dfx canister status source
assert_command_fail dfx canister status target
}
2 changes: 1 addition & 1 deletion src/dfx/src/actors/pocketic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ async fn initialize_pocketic(
ii: Some(IcpFeaturesConfig::default()),
nns_ui: Some(IcpFeaturesConfig::default()),
bitcoin: icp_features.bitcoin,
canister_migration: None,
canister_migration: Some(IcpFeaturesConfig::default()),
dogecoin: icp_features.dogecoin,
}
} else {
Expand Down
Loading