You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Addresses all issues raised in #233:
- Rename "Colocation with an existing canister" to "Colocation via proxy
canister" and expand it with three targeted fixes:
- Clarify that --proxy and --subnet are mutually exclusive
- Add the full ProxyArgs/ProxyResult Candid interface so developers know
exactly what their proxy canister must implement
- Explain the cycles model: --cycles passes a value through ProxyArgs.cycles
and is paid from the proxy canister's own balance, not the caller's wallet
- Fix the "by default" phrasing in troubleshooting: replace with "without
using icp canister migrate-id"
- Add a direct link to the canister migration guide in the troubleshooting
entry and in Next steps
Copy file name to clipboardExpand all lines: docs/guides/canister-management/subnet-selection.md
+40-6Lines changed: 40 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,15 +84,48 @@ The `--subnet` flag only affects canister creation. If a canister already exists
84
84
85
85
> **Tip:** Subnet principal IDs can change over time. Always verify the current ID for a named subnet on the [ICP Dashboard](https://dashboard.internetcomputer.org/subnets) before using it in production scripts.
86
86
87
-
## Colocation with an existing canister
87
+
## Colocation via proxy canister
88
88
89
-
To create a new canister on the same subnet as an existing canister, use the `--proxy` flag with `icp canister create`. This routes the creation call through the existing canister and places the new canister on the same subnet:
89
+
To create a new canister on the same subnet as an existing canister, use the `--proxy` flag with `icp canister create`. This routes the creation call through a proxy canister, and the new canister is placed on that proxy's subnet:
90
90
91
91
```bash
92
-
icp canister create my_new_canister -e ic --proxy <EXISTING_CANISTER_ID>
92
+
icp canister create my_new_canister -e ic --proxy <PROXY_CANISTER_ID>
93
+
94
+
# With a custom cycle allocation for the new canister (proxy pays from its own balance):
95
+
icp canister create my_new_canister -e ic --proxy <PROXY_CANISTER_ID> --cycles 3T
93
96
```
94
97
95
-
This is useful when you already have a deployed canister and want new canisters to live on the same subnet. The proxy canister must implement a `proxy` method that forwards management canister calls.
98
+
`--proxy` and `--subnet` are mutually exclusive: the CLI rejects any call that specifies both.
99
+
100
+
### Proxy interface requirement
101
+
102
+
The target canister must expose a `proxy` method with this exact Candid interface. An arbitrary canister will reject the call:
103
+
104
+
```candid
105
+
type ProxyArgs = record {
106
+
canister_id : principal;
107
+
method : text;
108
+
args : blob;
109
+
cycles : nat;
110
+
};
111
+
112
+
type ProxyResult = variant {
113
+
Ok : record { result : blob };
114
+
Err : variant {
115
+
InsufficientCycles : record { available : nat; required : nat };
116
+
CallFailed : record { reason : text };
117
+
UnauthorizedUser;
118
+
};
119
+
};
120
+
121
+
service : {
122
+
proxy : (ProxyArgs) -> (ProxyResult);
123
+
}
124
+
```
125
+
126
+
### Cycles model
127
+
128
+
The `--cycles` value specifies how many cycles to allocate to the new canister. Those cycles are drawn from the proxy canister's own balance, not from your wallet. Ingress messages on ICP cannot carry cycles; the value is passed as data in `ProxyArgs.cycles`, and the proxy spends from its own cycle balance when forwarding the management canister call. Ensure the proxy canister is adequately funded before use.
96
129
97
130
## Storage capacity considerations
98
131
@@ -110,10 +143,10 @@ Verify the subnet ID is correct. Some subnets (including all system subnets) do
110
143
111
144
### Canister is on the wrong subnet
112
145
113
-
Canisters cannot be moved between subnets while keeping the same canister ID by default. Your options depend on whether you can accept a new ID:
146
+
Canisters cannot be moved between subnets while keeping the same canister ID without using `icp canister migrate-id`. Your options depend on whether you can accept a new ID:
114
147
115
148
-**New canister ID is acceptable**: Transfer state via [canister snapshots](snapshots.md) to a new canister on the correct subnet.
116
-
-**Canister ID must be preserved**: Transfer state via snapshots, copy settings, then use`icp canister migrate-id` to move the ID to the new canister.
149
+
-**Canister ID must be preserved**: Transfer state via snapshots, copy settings, delete the snapshot on the target, then run`icp canister migrate-id` to move the ID to the new canister. See the [canister migration guide](https://cli.internetcomputer.org/0.2/guides/canister-migration) for the complete step-by-step workflow, including the cycle warning, the snapshot deletion requirement before `migrate-id`, NNS controller cleanup, and how to recover from interruptions.
117
150
118
151
Note that any canister ID change means losing access to any threshold signature keys (tECDSA, tSchnorr) and vetKeys derived by the original canister: these are cryptographically bound to the canister ID. Any assets or encrypted data tied to those keys become permanently inaccessible under the new ID.
119
152
@@ -122,6 +155,7 @@ Note that any canister ID change means losing access to any threshold signature
122
155
-[Cycles costs](../../references/cycles-costs.md#replication-factors): Cost tables and the subnet multiplier formula
123
156
-[Subnet types reference](../../references/subnet-types.md): Full reference for all subnet types with node counts and properties
124
157
-[Canister snapshots](snapshots.md): Transfer state between canisters when migrating subnets
158
+
-[Canister migration](https://cli.internetcomputer.org/0.2/guides/canister-migration): Complete workflow for moving a canister to a different subnet, with or without preserving the canister ID
125
159
-[Network overview](../../concepts/network-overview.md): How subnets fit into the ICP architecture
126
160
127
161
<!-- Upstream: informed by dfinity/portal docs/building-apps/developing-canisters/deploy-specific-subnet.mdx; dfinity/icp-cli docs/guides/deploying-to-specific-subnets.md -->
0 commit comments