Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions rs/registry/canister/canister/canister.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ use dfn_core::{
use ic_base_types::{NodeId, PrincipalId};
use ic_certified_map::{AsHashTree, HashTree};
use ic_nervous_system_string::clamp_debug_len;
use ic_nns_constants::{
GOVERNANCE_CANISTER_ID, MIGRATION_CANISTER_ID, ROOT_CANISTER_ID, SUBNET_RENTAL_CANISTER_ID,
};
use ic_nns_constants::{GOVERNANCE_CANISTER_ID, MIGRATION_CANISTER_ID, ROOT_CANISTER_ID};
use ic_protobuf::registry::{
dc::v1::{AddOrRemoveDataCentersProposalPayload, DataCenterRecord},
node_operator::v1::NodeOperatorRecord,
Expand Down Expand Up @@ -141,16 +139,6 @@ fn check_caller_is_canister_migration_orchestrator_and_log(method_name: &str) {
);
}

fn check_caller_is_subnet_rental_canister_and_log(method_name: &str) {
let caller = dfn_core::api::caller();
println!("{LOG_PREFIX}call: {method_name} from: {caller}");
assert_eq!(
caller,
SUBNET_RENTAL_CANISTER_ID.into(),
"{LOG_PREFIX}Principal: {caller} is not authorized to call this method: {method_name}"
);
}

/// Initializes the registry.
///
/// The argument is expected to be a candid-encoded
Expand Down Expand Up @@ -1296,13 +1284,13 @@ fn set_subnet_operational_level_(payload: SetSubnetOperationalLevelPayload) {

#[unsafe(export_name = "canister_update update_subnet_admins")]
fn update_subnet_admins() {
check_caller_is_subnet_rental_canister_and_log("update_subnet_admins");
over(candid_one, update_subnet_admins_);
}

#[candid_method(update, rename = "update_subnet_admins")]
fn update_subnet_admins_(payload: UpdateSubnetAdminsPayload) {
registry_mut().do_update_subnet_admins(payload);
let caller = dfn_core::api::caller();
registry_mut().do_update_subnet_admins(caller, payload);
recertify_registry();
}

Expand Down
Loading
Loading