diff --git a/rs/rust_canisters/canister_test/src/canister.rs b/rs/rust_canisters/canister_test/src/canister.rs index 035fa531ee2..36f772676e6 100644 --- a/rs/rust_canisters/canister_test/src/canister.rs +++ b/rs/rust_canisters/canister_test/src/canister.rs @@ -5,7 +5,7 @@ use ic_canister_client::{Agent, Sender}; use ic_config::Config; use ic_management_canister_types::CanisterStatusType::Stopped; pub use ic_management_canister_types::{ - self as ic00, CanisterIdRecord, CanisterInstallMode, CanisterStatusResult, InstallCodeArgs, + self as ic00, CanisterIdRecord, CanisterInstallMode, InstallCodeArgs, ProvisionalCreateCanisterWithCyclesArgs, IC_00, }; use ic_registry_transport::pb::v1::RegistryMutation; @@ -808,7 +808,7 @@ impl<'a> Canister<'a> { .await; stop_res?; loop { - let status_res: Result = self + let status_res: Result = self .runtime .get_management_canister_with_effective_canister_id(self.canister_id().into()) .update_("canister_status", candid, (self.as_record(),)) diff --git a/rs/rust_canisters/tests/test/canister_management.rs b/rs/rust_canisters/tests/test/canister_management.rs index f3c206c88e5..e40df5ec821 100644 --- a/rs/rust_canisters/tests/test/canister_management.rs +++ b/rs/rust_canisters/tests/test/canister_management.rs @@ -2,7 +2,7 @@ use assert_matches::assert_matches; use candid::{Decode, Encode}; use canister_test::{local_test_e, Canister, Runtime, Wasm}; use ic_error_types::ErrorCode; -use ic_management_canister_types::{self as ic00, CanisterIdRecord, CanisterStatusResult, IC_00}; +use ic_management_canister_types::{self as ic00, CanisterIdRecord, CanisterStatusResultV2, IC_00}; use ic_test_utilities::universal_canister::UNIVERSAL_CANISTER_WASM; use ic_test_utilities::universal_canister::{ wasm as universal_canister_argument_builder, CallArgs, @@ -32,7 +32,7 @@ fn test_set_controller() { // aaaaa-aa" // // The anonymous user is not allowed to do a "canister_status" - let res: Result = runtime + let res: Result = runtime .get_management_canister_with_effective_canister_id( universal_canister.canister_id().into(), ) @@ -59,7 +59,7 @@ fn test_set_controller() { .update_("update", bytes, arg) .await .unwrap(); - let status = Decode!(&status_bytes, CanisterStatusResult).unwrap(); + let status = Decode!(&status_bytes, CanisterStatusResultV2).unwrap(); assert_eq!(status.controller(), universal_canister.canister_id().get()); Ok(()) diff --git a/rs/tests/driver/src/util.rs b/rs/tests/driver/src/util.rs index 363f86d1687..3416e5a61cf 100644 --- a/rs/tests/driver/src/util.rs +++ b/rs/tests/driver/src/util.rs @@ -29,7 +29,7 @@ use ic_agent::{ use ic_canister_client::{Agent as DeprecatedAgent, Sender}; use ic_config::ConfigOptional; use ic_limits::MAX_INGRESS_TTL; -use ic_management_canister_types::{CanisterStatusResult, EmptyBlob, Payload}; +use ic_management_canister_types::{CanisterStatusResultV2, EmptyBlob, Payload}; use ic_message::ForwardParams; use ic_nervous_system_proto::pb::v1::GlobalTimeOfDay; use ic_nns_constants::{GOVERNANCE_CANISTER_ID, ROOT_CANISTER_ID}; @@ -1241,7 +1241,7 @@ pub async fn get_balance_via_canister( ) .await .map(|res| { - Decode!(res.as_slice(), CanisterStatusResult) + Decode!(res.as_slice(), CanisterStatusResultV2) .unwrap() .cycles() .into() diff --git a/rs/types/management_canister_types/src/lib.rs b/rs/types/management_canister_types/src/lib.rs index e55a3d88925..f1532094fe6 100644 --- a/rs/types/management_canister_types/src/lib.rs +++ b/rs/types/management_canister_types/src/lib.rs @@ -956,62 +956,6 @@ impl DefiniteCanisterSettingsArgs { impl Payload<'_> for DefiniteCanisterSettingsArgs {} -/// The deprecated version of CanisterStatusResult that is being -/// used by NNS canisters. -#[derive(Eq, PartialEq, Debug, CandidType, Deserialize)] -pub struct CanisterStatusResult { - status: CanisterStatusType, - module_hash: Option>, - controller: candid::Principal, - memory_size: candid::Nat, - cycles: candid::Nat, - // this is for compat with Spec 0.12/0.13 - balance: Vec<(Vec, candid::Nat)>, -} - -impl CanisterStatusResult { - pub fn new( - status: CanisterStatusType, - module_hash: Option>, - controller: PrincipalId, - memory_size: NumBytes, - cycles: u128, - ) -> Self { - Self { - status, - module_hash, - controller: candid::Principal::from_text(controller.to_string()).unwrap(), - memory_size: candid::Nat::from(memory_size.get()), - cycles: candid::Nat::from(cycles), - // the following is spec 0.12/0.13 compat; - // "\x00" denotes cycles - balance: vec![(vec![0], candid::Nat::from(cycles))], - } - } - - pub fn status(&self) -> CanisterStatusType { - self.status.clone() - } - - pub fn module_hash(&self) -> Option> { - self.module_hash.clone() - } - - pub fn controller(&self) -> PrincipalId { - PrincipalId::try_from(self.controller.as_slice()).unwrap() - } - - pub fn memory_size(&self) -> NumBytes { - NumBytes::from(self.memory_size.0.to_u64().unwrap()) - } - - pub fn cycles(&self) -> u128 { - self.cycles.0.to_u128().unwrap() - } -} - -impl Payload<'_> for CanisterStatusResult {} - #[derive(Eq, PartialEq, Debug, CandidType, Deserialize)] pub struct QueryStats { num_calls_total: candid::Nat,