Skip to content

feat(root): New method: create_canister_and_install_code#9610

Merged
daniel-wong-dfinity-org merged 4 commits intomasterfrom
create_canister_and_install_code-root-daniel-wong
Apr 7, 2026
Merged

feat(root): New method: create_canister_and_install_code#9610
daniel-wong-dfinity-org merged 4 commits intomasterfrom
create_canister_and_install_code-root-daniel-wong

Conversation

@daniel-wong-dfinity-org
Copy link
Copy Markdown
Contributor

@daniel-wong-dfinity-org daniel-wong-dfinity-org commented Mar 26, 2026

Only callable by governance.

As usual, this does the "real work" of a new upcoming proposal type that creates a new canister in a non-NNS subnet (and install code into the new canister).

Prior Work

This new proposal type overlaps a bit with the existing NnsCanisterInstall proposal type. This differs in a couple of key ways:

  1. The created canister can live in other subnets.
  2. The created canister is NOT designated as an NNS canister (in Registry).

Behavior Details

This uses bounded wait so that NNS (Root and Governance canisters) does not get stuck as a result of an unresponsive subnet (either because it is malicious, or otherwise messed up).

The canister is created using cycles from the Root canister's balance. This is like how when SNS-WASM creates canisters, cycles are taken from its own balance. Keeping Root topped up is beyond the scope of this feature.

Testing

No tests yet. Those will be in a future PR. This is ok, because only Governance is allowed to call this new method, and no code path in Governance calls it yet.

References

Closes NNS1-4342.

Next PR 👉

@github-actions github-actions bot added the feat label Mar 26, 2026
@daniel-wong-dfinity-org daniel-wong-dfinity-org changed the title feat(root): Added create_canister_and_install_code method to NNS Root. feat(root): New method: create_canister_and_install_code Mar 26, 2026
Comment thread rs/nns/handlers/root/impl/src/canister_management.rs Outdated
Comment thread rs/nns/handlers/root/impl/canister/root.did
@daniel-wong-dfinity-org daniel-wong-dfinity-org marked this pull request as ready for review March 27, 2026 10:08
@daniel-wong-dfinity-org daniel-wong-dfinity-org requested a review from a team as a code owner March 27, 2026 10:08
github-actions[bot]

This comment was marked as resolved.

@daniel-wong-dfinity-org daniel-wong-dfinity-org dismissed github-actions[bot]’s stale review April 7, 2026 14:46
  1. Done.
  2. Non-breaking; new API.
  3. Root has no persistent data.
  4. Requesting...
@daniel-wong-dfinity-org daniel-wong-dfinity-org force-pushed the create_canister_and_install_code-root-daniel-wong branch from 9ab868c to c70888a Compare April 7, 2026 14:58
@daniel-wong-dfinity-org daniel-wong-dfinity-org added this pull request to the merge queue Apr 7, 2026
Merged via the queue into master with commit 5395df1 Apr 7, 2026
37 checks passed
@daniel-wong-dfinity-org daniel-wong-dfinity-org deleted the create_canister_and_install_code-root-daniel-wong branch April 7, 2026 15:50
github-merge-queue bot pushed a commit that referenced this pull request Apr 9, 2026
…9611)

This is behind a flag, which per usual, is off in production.

This includes changes to .did, .proto, as well as actual executable
implementation, including validation.

# Prior Work

This new proposal type overlaps a bit with the existing
NnsCanisterInstall proposal type. This differs in a couple of key ways:

1. The created canister can live in other subnets.
2. The created canister is NOT designated as an NNS canister (in
Registry).

# Implementation

This is a direct proposal action. This is because we implement
validation (which would require Decode if this were instead done as an
`NnsFunction`).

This follows the usual pattern of adding a new `.rs` file to the
`proposals` dir, dedicated to the new proposal type. Within that file we
have various `impl` blocks for the new proposal type, including `impl`s
for various traits.

Calls a new method of the Root canister, aptly named
`create_canister_and_install_code`. See "References". As usual, Root
does the real work.

Un-nested `CanisterSettings` from within `UpdateCanisterSettings` so
that it can be shared with `CreateCanisterAndInstallCode`.

A large chunk of the changes here are mechanical type conversions.

# Testing

Not yet tested, but since this is behind a flag, it should be fine for
this code to be deployed (and in the master branch).

# References

[👈 Previous PR][prev]

[prev]: #9610

---------

Co-authored-by: IDX GitHub Automation <infra+github-automation@dfinity.org>
daniel-wong-dfinity-org added a commit that referenced this pull request Apr 15, 2026
…9611)

This is behind a flag, which per usual, is off in production.

This includes changes to .did, .proto, as well as actual executable
implementation, including validation.

# Prior Work

This new proposal type overlaps a bit with the existing
NnsCanisterInstall proposal type. This differs in a couple of key ways:

1. The created canister can live in other subnets.
2. The created canister is NOT designated as an NNS canister (in
Registry).

# Implementation

This is a direct proposal action. This is because we implement
validation (which would require Decode if this were instead done as an
`NnsFunction`).

This follows the usual pattern of adding a new `.rs` file to the
`proposals` dir, dedicated to the new proposal type. Within that file we
have various `impl` blocks for the new proposal type, including `impl`s
for various traits.

Calls a new method of the Root canister, aptly named
`create_canister_and_install_code`. See "References". As usual, Root
does the real work.

Un-nested `CanisterSettings` from within `UpdateCanisterSettings` so
that it can be shared with `CreateCanisterAndInstallCode`.

A large chunk of the changes here are mechanical type conversions.

# Testing

Not yet tested, but since this is behind a flag, it should be fine for
this code to be deployed (and in the master branch).

# References

[👈 Previous PR][prev]

[prev]: #9610

---------

Co-authored-by: IDX GitHub Automation <infra+github-automation@dfinity.org>
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.

2 participants