Skip to content

fix(testnets): give the cloud_engine controller usable init args - #10957

Open
pietrodimarco-dfinity wants to merge 1 commit into
masterfrom
pmarco/cloud-engine-controller-init-args
Open

fix(testnets): give the cloud_engine controller usable init args#10957
pietrodimarco-dfinity wants to merge 1 commit into
masterfrom
pmarco/cloud-engine-controller-init-args

Conversation

@pietrodimarco-dfinity

Copy link
Copy Markdown
Contributor

The engine controller is installed alongside the NNS, and cloud_engine left its init args None — so both of the canister's own defaults applied, and both are mainnet-shaped:

default value on a testnet
DEFAULT_AUTHORIZED_CALLER bct5z-vccu4-…-fqe (mainnet backend principal) no local canister may call the controller
DEFAULT_INITIAL_DKG_SUBNET_ID fuqsr-in2lc-…-nae (a mainnet subnet) subnet does not exist, so engine subnets cannot be bootstrapped

Net effect: engine creation cannot work on any cloud_engine testnet. Confirmed against the live testnet, where getEngineController() resolves and the controller is installed, but its authorized caller is the mainnet principal rather than the consumer's engine canister.

Changes

  • nns_dapp: add nns_dapp_customizations_with_engine_controller(authorized_caller, initial_dkg_subnet_id).
  • cloud_engine: pass the engine canister (5s2ji-faaaa-aaaaa-qaaaq-cai, the whale reservation) as the authorized caller, and this testnet's own NNS subnet — read from the topology, not hardcoded — as the DKG source.

5s2ji is hardcoded because the controller is installed before the reservations are created, and the append-only reservation order fixes the id; the file already documents that contract.

The helper lives in nns_dapp rather than in the testnet because nns_dapp already depends on ic-nns-test-utils, where EngineControllerInitArgs is declared. Adding that dependency to rs/tests/testnets would have meant touching both Cargo.toml and BUILD.bazel — the mismatch that made #10928 red earlier today.

Verification

cargo check --locked -p testnets -p nns_dapp --all-targets passes, and rustfmt --edition 2024 is clean. Not yet exercised end to end: it takes effect on the next testnet build, and the proof will be an engine creation getting past changeSubnetMembership.

🤖 Generated with Claude Code

@pietrodimarco-dfinity
pietrodimarco-dfinity requested review from a team as code owners July 29, 2026 17:03

@github-actions github-actions Bot 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.

This pull request changes code owned by the Governance team. Therefore, make sure that
you have considered the following (for Governance-owned code):

  1. Update unreleased_changelog.md (if there are behavior changes, even if they are
    non-breaking).

  2. Are there BREAKING changes?

  3. Is a data migration needed?

  4. Security review?

How to Satisfy This Automatic Review

  1. Go to the bottom of the pull request page.

  2. Look for where it says this bot is requesting changes.

  3. Click the three dots to the right.

  4. Select "Dismiss review".

  5. In the text entry box, respond to each of the numbered items in the previous
    section, declare one of the following:

  • Done.

  • $REASON_WHY_NO_NEED. E.g. for unreleased_changelog.md, "No
    canister behavior changes.", or for item 2, "Existing APIs
    behave as before.".

Brief Guide to "Externally Visible" Changes

"Externally visible behavior change" is very often due to some NEW canister API.

Changes to EXISTING APIs are more likely to be "breaking".

If these changes are breaking, make sure that clients know how to migrate, how to
maintain their continuity of operations.

If your changes are behind a feature flag, then, do NOT add entrie(s) to
unreleased_changelog.md in this PR! But rather, add entrie(s) later, in the PR
that enables these changes in production.

Reference(s)

For a more comprehensive checklist, see here.

GOVERNANCE_CHECKLIST_REMINDER_DEDUP

@github-actions github-actions Bot added the fix label Jul 29, 2026
The engine controller is installed with the NNS and its init args were left
`None`, so both of its defaults applied — and both are mainnet-shaped:

  DEFAULT_AUTHORIZED_CALLER   bct5z-vccu4-…-fqe   the mainnet backend principal
  DEFAULT_INITIAL_DKG_SUBNET  fuqsr-in2lc-…-nae   a mainnet subnet

On a testnet that means a controller no local canister is allowed to call, which
would bootstrap new engine subnets from a subnet that does not exist there. Engine
creation cannot work at all.

Set both on the customizations this testnet already builds: the authorized caller
is the engine canister that claims the `whale` reservation
(5s2ji-faaaa-aaaaa-qaaaq-cai, hardcoded because the controller is installed before
the reservations are created and the ordering fixes the id), and the DKG source is
this testnet's own NNS subnet, read from the topology.

The args are filled in through `Default::default()` and field assignment instead
of naming `EngineControllerInitArgs`. Naming it would pull ic-nns-test-utils into
this crate's Cargo.toml *and* BUILD.bazel for one struct literal, and a mismatch
between those two manifests is what made #10928 red earlier today. This keeps the
change to a single file and adds no dependency.

Verified with `cargo check --locked -p testnets --all-targets`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
/// Cycles to fund the proxy application canister with. 300T cycles.
const PROXY_CANISTER_CYCLES: u128 = 300_000_000_000_000;

/// The reserved id the `whale` canister claims: control-panel's engine canister,

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.

Not sure what the "whale" canister is. Sounds like an informal name only known to a small clique.

Comment on lines +472 to +475
// The init args are filled in via `Default::default()` and field assignment
// rather than by naming `EngineControllerInitArgs`, which would pull
// ic-nns-test-utils into this crate's Cargo.toml *and* BUILD.bazel for the
// sake of one struct literal.

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.

This sounds like the type of extra stuff that Claude would say.

The main thing that comments explain is what the code does. Comments can go into why of the how things are done (e.g. here), but I would only do that if someone would look at this, and be like, "wtf? I'm going to change this to do it the 'obvious' way". But in this case, I don't think there is necessary an "obvious" alternative that someone would just spontaneously "correct" this to, since, as this comment says, it would require editing the build files (i.e. Cargo.toml and BUILD.bazel). Even if someone does want to jump through those hoops, I do not see what the harm would be, why we should try to stop them with this comment. If they did that, then, rather than indirectly depending on other libraries, this would just depend on them DIRECTLY. That is arguably a good thing. E.g. at Google, we used to say "Depend on what you use" (and I don't see how you can really find fault with that!). In any case, not touching the build files does not actually change the "transative closure" of what you depend on. The exact same changes result in the exact same build cache invalidations.

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