Skip to content

feat(engine-controller): Let the engine controller create canisters on cloud engines - #11924

Merged
pietrodimarco-dfinity merged 3 commits into
masterfrom
pdm/engine-controller-create-canister
Oct 23, 2026
Merged

pietrodimarco-dfinity merged 3 commits into
masterfrom
pdm/engine-controller-create-canister

Conversation

@pietrodimarco-dfinity

@pietrodimarco-dfinity pietrodimarco-dfinity commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Adds a create_canister method to the engine controller. It creates an empty canister on a cloud engine subnet, controlled only by the controllers the caller passes in.

Why. The authorized caller (the engine canister that creates and bills cloud engines) is not on the NNS subnet. Only a canister on the NNS subnet may create a canister on another subnet. Off the NNS, create_canister on aaaaa-aa is routed to the caller's own subnet, and addressing another subnet's id directly is refused. So today the authorized caller cannot put a canister (for example the engine's operator canister) on an engine it created. An off-chain subnet admin has to create it by ingress instead. The engine controller is on the NNS, so it can do this for its caller.

create_canister { subnet_id; controllers } returns { canister_id }:

  • Only the authorized caller may call it, like every other method here.
  • controllers must hold 1 to 10 principals, and they become the canister's only controllers. The engine controller is never a controller unless it is listed, so it holds nothing on the engine afterwards. The controllers install and configure the canister with ordinary management canister calls, which are routed by canister id and already work across subnets.
  • The target must be a CloudEngine subnet in the registry. Any other subnet is refused before any call is made.
  • The call is addressed to the subnet id, is bounded-wait and carries no cycles, as every call into a cloud engine must. Engines are on the free cost schedule, so creation costs nothing. If a bounded-wait call times out (SysUnknown), the canister may still have been created, controlled by controllers.

The new method is additive and the interface stays backwards compatible. The changelog entry is in unreleased_changelog.md.

Tests. Five new PocketIC tests boot an NNS subnet and a real cloud engine subnet with the registry ICP feature:

  • the canister lands on the engine with exactly the requested controllers
  • a non-engine subnet (the NNS) is refused
  • an empty controller list is refused
  • more than 10 controllers are refused
  • an unauthorized caller is refused

🤖 Generated with Claude Code

…n cloud engines

Adds `create_canister { subnet_id; controllers }`, which creates an empty
canister on a cloud engine subnet, controlled by `controllers` only.

Only a canister on the NNS subnet may create a canister on another subnet,
so the authorized caller, which is not on the NNS, cannot put a canister on
an engine it created. The engine controller creates it instead, addressing
the engine's subnet directly. The target must be a `CloudEngine` subnet in
the registry; the call is bounded-wait and carries no cycles, as every call
into a cloud engine must.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the feat label Oct 22, 2026
@pietrodimarco-dfinity
pietrodimarco-dfinity requested a balanced review from Copilot October 22, 2026 16:37
@pietrodimarco-dfinity
pietrodimarco-dfinity marked this pull request as ready for review October 22, 2026 16:39
@pietrodimarco-dfinity
pietrodimarco-dfinity requested a review from a team as a code owner October 22, 2026 16:39
@github-actions github-actions Bot added the @dre label Oct 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The privileged cross-subnet creation path warrants human confirmation, and its integration tests were not executed.

No open issues 🎉

What changed in this PR

Adds an authorized create_canister endpoint to the NNS-hosted engine controller, allowing its caller to create empty canisters on cloud engine subnets.

Changes:

  • Validates authorization, controller count, and registry subnet type before making a bounded-wait, zero-cycle creation call.
  • Adds public Rust and Candid types, dependency wiring, and a changelog entry.
  • Adds four PocketIC tests covering successful creation and rejection of invalid or unauthorized requests.
File Description
rs/​engine_controller/​unreleased_changelog.md Documents the new creation endpoint.
rs/​engine_controller/​tests/​tests.rs Adds cloud engine setup and four integration tests.
rs/​engine_controller/​src/​lib.rs Defines creation request and response types.
rs/​engine_controller/​engine_controller.did Exposes the additive Candid endpoint.
rs/​engine_controller/​Cargo.toml Adds runtime dependencies for creation and registry access.
rs/​engine_controller/​canister/​canister.rs Implements validation and cross-subnet canister creation.
rs/​engine_controller/​BUILD.bazel Wires dependencies into Bazel targets.
Cargo.lock Records the added NNS common dependency.

Review effort: Balanced

@pietrodimarco-dfinity

Copy link
Copy Markdown
Contributor Author

The four new create_canister PocketIC tests pass locally against PocketIC server 16.1.0 (cargo test -p ic-engine-controller --test tests create_canister). Clippy (-D warnings) and the unit tests, including the .did interface check, pass as well. CI runs the full suite through Bazel.

Comment thread rs/engine_controller/tests/tests.rs Resolved
pietrodimarco-dfinity and others added 2 commits October 23, 2026 08:42
Trims the method's doc comment and the changelog entry, and adds a test
that more than 10 controllers are refused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@pietrodimarco-dfinity
pietrodimarco-dfinity added this pull request to the merge queue Oct 23, 2026
Merged via the queue into master with commit 2832a80 Oct 23, 2026
38 checks passed
@pietrodimarco-dfinity
pietrodimarco-dfinity deleted the pdm/engine-controller-create-canister branch October 23, 2026 09:45
eichhorl added a commit that referenced this pull request Oct 23, 2026
Resolve the Cargo.lock conflict with #11924, which added ic-nns-common
next to the engine controller's ic-management-canister-types entry.
Cargo.lock is master's with the bump re-applied by cargo, which adds only
ic-management-canister-types 0.11.0 and switches the same 30 references.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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