An attempt to update the canister controllers fails.
I use the standard canister settings update code in motoko.
Part of the code
let new_settings: CanisterSettings = {
controllers = ?List.toArray(list);
compute_allocation = settings.compute_allocation;
memory_allocation = settings.memory_allocation;
freezing_threshold = settings.freezing_threshold;
};
await ic_actor.update_settings({
canister_id = Principal.fromActor(self);
settings = new_settings;
});
In list
add new controller. And the ones that are available are saved.
Standard error:
Error: Failed update call.
Caused by: Failed update call.
The Replica returned an error: code 4, message: āOnly the controllers of the canister xifbj-tqaaa-aaaaa-aaauq-cai can control it.
Canisterās controllers: rwlgt-iiaaa-aaaaa-aaaaa-cai mlx7d-nlzwm-jsiyr-txxc2-mlgsf-hafo6-73wnd-du4xx-f2tsd-mjtum-pae
Senderās ID: xifbj-tqaaa-aaaaa-aaauq-caiā
I can still add another controller via the standart command dfx. This team works great:
dfx canister update-settings authorization-rbac --add-controller
All actions are performed from the command line under the controller of the owner of the canister.
Another question is, where did this canister in the controllers come from rwlgt-iiaaa-aaaaa-aaaaa-cai?
Since they are updated on the canister (it is the only one) xifbj-tqaaa-aaaaa-aaauq-cai
Whatās going wrong? Maybe this is not possible with the current version of dfx?
I will supplement the information for informativeness. The canister controllers are:
(
opt vec {
principal ārwlgt-iiaaa-aaaaa-aaaaa-caiā;
principal āmlx7d-nlzwm-jsiyr-txxc2-mlgsf-hafo6-73wnd-du4xx-f2tsd-mjtum-paeā;
},
)
Calls to the canister are made from under mlx7d-nlzwm-jsiyr-txxc2-mlgsf-hafo6-73wnd-du4xx-f2tsd-mjtum-pae
I also do checks:
public shared({caller}) func whoami_caller() : async Text{*
return Principal.toText(caller);*
};
Result: (āmlx7d-nlzwm-jsiyr-txxc2-mlgsf-hafo6-73wnd-du4xx-f2tsd-mjtum-paeā)
public shared({caller}) func canister_id() : async Principal{*
return Principal.fromActor(self);*
};
Result: (principal āxifbj-tqaaa-aaaaa-aaauq-caiā)