Setting Up Single Canister Settings

I’m not sure if this topic has been discussed before, but I’m curious about the IC specification regarding canister settings. Is there a specific reason why the IC specification only allows settings to be updated in bulk?

This approach feels a bit prone to errors, at least I’m always double checking when I use those, and I believe it would be interesting and efficient if individual settings could be updated separately. Particularly as we are adding more and more options. Moreover, adding and removing single controller would be particularly nice.

But I might be missing something. Can anyone provide insights or rationale behind this design choice? Could it be related to security or consistency? If there is no particular reason and it hasn’t been discussed before, may I suggest considering this approach?

export interface canister_settings {
  freezing_threshold: [] | [bigint];
  controllers: [] | [Array<Principal>];
  reserved_cycles_limit: [] | [bigint];
  log_visibility: [] | [log_visibility];
  wasm_memory_limit: [] | [bigint];
  memory_allocation: [] | [bigint];
  compute_allocation: [] | [bigint];
}

export interface update_settings_args {
	canister_id: Principal;
	settings: canister_settings;
	sender_canister_version: [] | [bigint];
}

export interface _SERVICE {
   update_settings: ActorMethod<[update_settings_args], undefined>;
}

That’s why the fields are all optional. If you only want to change one setting, just pass None for all the other fields.

2 Likes

For adding or removing a single controller, I do see how that could be helpful.

Darn, I did not know, tt’s not a pattern I am familiar with. I should have read the documentation again.

Not including a setting in the settings record means not changing that field.

Thanks for the answer!

tenor

1 Like

That would be nice. Regardless of the CLI, platform or even NNS dapp, devs often add or remove one single controller at a time.