-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor and add method to upgrade governance canisters in specific i…
…ndividual canisters
- Loading branch information
1 parent
04b5327
commit 580daaa
Showing
7 changed files
with
127 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...gement/notify_specific_individual_canister_to_upgrade_creator_dao_governance_canisters.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use candid::Principal; | ||
use ic_cdk::api::management_canister::main::{canister_info, CanisterInfoRequest}; | ||
use ic_cdk_macros::update; | ||
|
||
use crate::{ | ||
guard::is_caller::is_caller_global_admin_or_controller, | ||
utils::registered_subnet_orchestrator::RegisteredSubnetOrchestrator, | ||
}; | ||
|
||
#[update(guard = "is_caller_global_admin_or_controller")] | ||
pub async fn notify_specific_individual_canister_to_upgrade_creator_dao_governance_canisters( | ||
individual_canister_id: Principal, | ||
wasm_module: Vec<u8>, | ||
) -> Result<(), String> { | ||
let (individual_canister_info,) = canister_info(CanisterInfoRequest { | ||
canister_id: individual_canister_id, | ||
num_requested_changes: None, | ||
}) | ||
.await | ||
.map_err(|e| e.1)?; | ||
|
||
let subnet_orchestrator_canister_id = individual_canister_info | ||
.controllers | ||
.get(0) | ||
.copied() | ||
.ok_or("Subnet orchestrator canister id not found")?; | ||
|
||
let registered_subnet_orchestrator = | ||
RegisteredSubnetOrchestrator::new(subnet_orchestrator_canister_id)?; | ||
|
||
registered_subnet_orchestrator | ||
.notify_specific_individual_canister_to_upgrade_creator_dao_governance_canisters( | ||
individual_canister_id, | ||
wasm_module, | ||
) | ||
} |
7 changes: 5 additions & 2 deletions
7
.../src/api/canister_management/upgrade_individual_canisters_in_a_subnet_with_latest_wasm.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
...gement/notify_specific_individual_canister_to_upgrade_creator_dao_governance_canisters.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters