fix(testnets): give the cloud_engine controller usable init args - #10957
fix(testnets): give the cloud_engine controller usable init args#10957pietrodimarco-dfinity wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
This pull request changes code owned by the Governance team. Therefore, make sure that
you have considered the following (for Governance-owned code):
-
Update
unreleased_changelog.md(if there are behavior changes, even if they are
non-breaking). -
Are there BREAKING changes?
-
Is a data migration needed?
-
Security review?
How to Satisfy This Automatic Review
-
Go to the bottom of the pull request page.
-
Look for where it says this bot is requesting changes.
-
Click the three dots to the right.
-
Select "Dismiss review".
-
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
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>
be65131 to
99567c6
Compare
| /// 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, |
There was a problem hiding this comment.
Not sure what the "whale" canister is. Sounds like an informal name only known to a small clique.
| // 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. |
There was a problem hiding this comment.
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.
The engine controller is installed alongside the NNS, and
cloud_engineleft its init argsNone— so both of the canister's own defaults applied, and both are mainnet-shaped:DEFAULT_AUTHORIZED_CALLERbct5z-vccu4-…-fqe(mainnet backend principal)DEFAULT_INITIAL_DKG_SUBNET_IDfuqsr-in2lc-…-nae(a mainnet subnet)Net effect: engine creation cannot work on any
cloud_enginetestnet. Confirmed against the live testnet, wheregetEngineController()resolves and the controller is installed, but its authorized caller is the mainnet principal rather than the consumer's engine canister.Changes
nns_dapp: addnns_dapp_customizations_with_engine_controller(authorized_caller, initial_dkg_subnet_id).cloud_engine: pass the engine canister (5s2ji-faaaa-aaaaa-qaaaq-cai, thewhalereservation) as the authorized caller, and this testnet's own NNS subnet — read from the topology, not hardcoded — as the DKG source.5s2jiis 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_dapprather than in the testnet becausenns_dappalready depends onic-nns-test-utils, whereEngineControllerInitArgsis declared. Adding that dependency tors/tests/testnetswould have meant touching bothCargo.tomlandBUILD.bazel— the mismatch that made #10928 red earlier today.Verification
cargo check --locked -p testnets -p nns_dapp --all-targetspasses, andrustfmt --edition 2024is clean. Not yet exercised end to end: it takes effect on the next testnet build, and the proof will be an engine creation getting pastchangeSubnetMembership.🤖 Generated with Claude Code