Skip to content

feat(release-runscript): set engine-controller authorized_caller on upgrade#10728

Draft
pietrodimarco-dfinity wants to merge 1 commit into
masterfrom
claude/engine-controller-upgrade-bfdb43
Draft

feat(release-runscript): set engine-controller authorized_caller on upgrade#10728
pietrodimarco-dfinity wants to merge 1 commit into
masterfrom
claude/engine-controller-upgrade-bfdb43

Conversation

@pietrodimarco-dfinity

Copy link
Copy Markdown
Contributor

What

The release-runscript release tool hardcoded () as the engine-controller upgrade argument in the Create Proposal Texts step. () cannot set the canister's authorized_caller, so it was impossible to change the authorized caller through the normal release flow.

This changes the engine-controller branch to prompt for the authorized caller principal and build the upgrade arg:

(opt record {
    authorized_caller = opt principal "<CALLER>";
    initial_dkg_subnet_id = null
})

Why

The engine-controller's post_upgrade re-applies its init args on every upgrade (apply_init_args in rs/engine_controller/canister/canister.rs). If authorized_caller is null, the canister falls back to its built-in DEFAULT_AUTHORIZED_CALLER. So to set (or retain) a specific authorized caller, the value must be supplied on each release — which the tool previously couldn't do.

The candid string is passed as CANDID_ARGS to prepare-nns-upgrade-proposal-text.sh, which encodes it via didc encode | xxd -r -p to compute the proposal's arg_hash and the verification section.

Notes for reviewers

  • An empty answer at the prompt now emits authorized_caller = null (→ canister default). Previously an empty answer would have produced an invalid opt principal "" that fails didc encode.
  • initial_dkg_subnet_id is left null (canister falls back to DEFAULT_INITIAL_DKG_SUBNET_ID). It is not currently promptable — say the word if you'd like it exposed too.
  • The arg shape matches service : (opt EngineControllerInitArgs) in rs/engine_controller/engine_controller.did.

Testing status

rustfmt applied. Local cargo clippy over the full dep tree hit only a pre-existing collapsible_if lint in the unrelated ic-artifact-pool crate (local clippy 1.93.0 is newer than the repo's pinned toolchain); nothing from this change. The bazel build/test on the pinned toolchain was still running when the PR was requested — CI will confirm.

🤖 Generated with Claude Code

…pgrade

The release-runscript hardcoded `()` as the engine-controller upgrade
argument, which cannot set the canister's authorized caller. Change the
Create Proposal Texts step to prompt for the authorized caller principal
and build the upgrade arg:

    (opt record {
        authorized_caller = opt principal "<CALLER>";
        initial_dkg_subnet_id = null
    })

This candid string is passed as CANDID_ARGS to
prepare-nns-upgrade-proposal-text.sh, which encodes it with
`didc encode | xxd -r -p` to compute the proposal's arg_hash and
verification section.

An empty answer emits `authorized_caller = null`, making the canister
fall back to its built-in default caller (rather than the previous
behavior of producing an invalid `opt principal ""`). The canister
re-applies args on every post_upgrade, so the caller must be supplied
each release to retain it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

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.

Pull request overview

Updates the release-runscript NNS release tool so engine-controller upgrades can set (or retain) authorized_caller by prompting for a principal and constructing a non-empty Candid upgrade argument, instead of hardcoding ().

Changes:

  • Prompt for an engine-controller authorized_caller principal during proposal-text generation.
  • Build a structured (opt record { ... }) Candid upgrade arg (with initial_dkg_subnet_id = null) for engine-controller upgrades.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +337 to +344
let new_caller = input(
"Authorized caller principal for engine-controller? (leave empty for canister default)",
)?;
let authorized_caller = if new_caller.is_empty() {
"null".to_string()
} else {
format!("opt principal \"{new_caller}\"")
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants