From d70a19e199b38c0b035427342ea71f3ce011bd23 Mon Sep 17 00:00:00 2001 From: Dragoljub Duric Date: Wed, 27 Nov 2024 16:31:12 +0000 Subject: [PATCH 01/21] . --- rs/nns/governance/api/src/ic_nns_governance.pb.v1.rs | 1 + .../proto/ic_nns_governance/pb/v1/governance.proto | 1 + rs/nns/governance/src/gen/ic_nns_governance.pb.v1.rs | 2 ++ rs/nns/governance/src/pb/conversions.rs | 2 ++ .../governance/src/proposals/update_canister_settings.rs | 4 ++++ rs/registry/admin/src/main.rs | 7 ++++++- 6 files changed, 16 insertions(+), 1 deletion(-) diff --git a/rs/nns/governance/api/src/ic_nns_governance.pb.v1.rs b/rs/nns/governance/api/src/ic_nns_governance.pb.v1.rs index bb16559a80a..8fbfdf4c05a 100644 --- a/rs/nns/governance/api/src/ic_nns_governance.pb.v1.rs +++ b/rs/nns/governance/api/src/ic_nns_governance.pb.v1.rs @@ -2570,6 +2570,7 @@ pub mod update_canister_settings { pub log_visibility: Option, #[prost(uint64, optional, tag = "6")] pub wasm_memory_limit: Option, + /// XXX HOW TO RUN PROTOBUF GENERATOR TO UPDATE THIS STRUCT? } /// Log visibility of a canister. #[derive( diff --git a/rs/nns/governance/proto/ic_nns_governance/pb/v1/governance.proto b/rs/nns/governance/proto/ic_nns_governance/pb/v1/governance.proto index 1e52b445a7f..7d7b5863731 100644 --- a/rs/nns/governance/proto/ic_nns_governance/pb/v1/governance.proto +++ b/rs/nns/governance/proto/ic_nns_governance/pb/v1/governance.proto @@ -2164,6 +2164,7 @@ message UpdateCanisterSettings { optional uint64 freezing_threshold = 4; optional LogVisibility log_visibility = 5; optional uint64 wasm_memory_limit = 6; + optional uint64 wasm_memory_threshold = 7; } // The settings to update. Required. diff --git a/rs/nns/governance/src/gen/ic_nns_governance.pb.v1.rs b/rs/nns/governance/src/gen/ic_nns_governance.pb.v1.rs index 2f4d4c246c0..3d8b419b47a 100644 --- a/rs/nns/governance/src/gen/ic_nns_governance.pb.v1.rs +++ b/rs/nns/governance/src/gen/ic_nns_governance.pb.v1.rs @@ -3138,6 +3138,8 @@ pub mod update_canister_settings { pub log_visibility: ::core::option::Option, #[prost(uint64, optional, tag = "6")] pub wasm_memory_limit: ::core::option::Option, + #[prost(uint64, optional, tag = "7")] + pub wasm_memory_threshold: ::core::option::Option, } /// Log visibility of a canister. #[derive( diff --git a/rs/nns/governance/src/pb/conversions.rs b/rs/nns/governance/src/pb/conversions.rs index 89f51dba469..eec969f3274 100644 --- a/rs/nns/governance/src/pb/conversions.rs +++ b/rs/nns/governance/src/pb/conversions.rs @@ -2988,6 +2988,7 @@ impl From freezing_threshold: item.freezing_threshold, log_visibility: item.log_visibility, wasm_memory_limit: item.wasm_memory_limit, + wasm_memory_threshold: item.wasm_memory_threshold, } } } @@ -3003,6 +3004,7 @@ impl From freezing_threshold: item.freezing_threshold, log_visibility: item.log_visibility, wasm_memory_limit: item.wasm_memory_limit, + wasm_memory_threshold: item.wasm_memory_threshold, } } } diff --git a/rs/nns/governance/src/proposals/update_canister_settings.rs b/rs/nns/governance/src/proposals/update_canister_settings.rs index da4e33b95e1..da362d2d754 100644 --- a/rs/nns/governance/src/proposals/update_canister_settings.rs +++ b/rs/nns/governance/src/proposals/update_canister_settings.rs @@ -61,6 +61,7 @@ impl UpdateCanisterSettings { && settings.freezing_threshold.is_none() && settings.log_visibility.is_none() && settings.wasm_memory_limit.is_none() + && settings.wasm_memory_threshold.is_none() { return Err(invalid_proposal_error( "At least one setting must be provided", @@ -75,6 +76,7 @@ impl UpdateCanisterSettings { let memory_allocation = settings.memory_allocation.map(Nat::from); let freezing_threshold = settings.freezing_threshold.map(Nat::from); let wasm_memory_limit = settings.wasm_memory_limit.map(Nat::from); + let _wasm_memory_threshold = settings.wasm_memory_threshold.map(Nat::from); let log_visibility = match settings.log_visibility { Some(log_visibility) => Some(Self::valid_log_visibility(log_visibility)?), None => None, @@ -223,6 +225,7 @@ mod tests { }), memory_allocation: Some(1 << 32), wasm_memory_limit: Some(1 << 31), + wasm_memory_threshold: Some(1 << 31), compute_allocation: Some(10), freezing_threshold: Some(100), log_visibility: Some(LogVisibility::Public as i32), @@ -273,6 +276,7 @@ mod tests { }), memory_allocation: Some(1 << 32), wasm_memory_limit: Some(1 << 31), + wasm_memory_threshold: Some(1 << 31), compute_allocation: Some(10), freezing_threshold: Some(100), log_visibility: Some(LogVisibility::Public as i32), diff --git a/rs/registry/admin/src/main.rs b/rs/registry/admin/src/main.rs index b7f5df3e0c9..b8e44b41be6 100644 --- a/rs/registry/admin/src/main.rs +++ b/rs/registry/admin/src/main.rs @@ -1198,11 +1198,14 @@ struct ProposeToUpdateCanisterSettingsCmd { /// If set, it will update the canister's freezing threshold to this value. freezing_threshold: Option, #[clap(long)] - /// If set, it will update the canister's log wasm memory limit to this value. + /// If set, it will update the canister's wasm memory limit to this value. wasm_memory_limit: Option, #[clap(long)] /// If set, it will update the canister's log visibility to this value. log_visibility: Option, + #[clap(long)] + /// If set, it will update the canister's wasm memory threshold to this value. + wasm_memory_threshold: Option, } impl ProposalTitle for ProposeToUpdateCanisterSettingsCmd { @@ -1232,6 +1235,7 @@ impl ProposalAction for ProposeToUpdateCanisterSettingsCmd { let memory_allocation = self.memory_allocation; let freezing_threshold = self.freezing_threshold; let wasm_memory_limit = self.wasm_memory_limit; + let wasm_memory_threshold = self.wasm_memory_threshold; let log_visibility = match self.log_visibility { Some(LogVisibility::Controllers) => Some(GovernanceLogVisibility::Controllers as i32), Some(LogVisibility::Public) => Some(GovernanceLogVisibility::Public as i32), @@ -1247,6 +1251,7 @@ impl ProposalAction for ProposeToUpdateCanisterSettingsCmd { freezing_threshold, wasm_memory_limit, log_visibility, + wasm_memory_threshold, }), }; From ff18fc4d52373d9468400fc9ab7eb4a38ea94069 Mon Sep 17 00:00:00 2001 From: Dragoljub Duric Date: Mon, 2 Dec 2024 09:54:05 +0000 Subject: [PATCH 02/21] . --- rs/nns/governance/api/src/ic_nns_governance.pb.v1.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rs/nns/governance/api/src/ic_nns_governance.pb.v1.rs b/rs/nns/governance/api/src/ic_nns_governance.pb.v1.rs index 8fbfdf4c05a..a56b70d71a7 100644 --- a/rs/nns/governance/api/src/ic_nns_governance.pb.v1.rs +++ b/rs/nns/governance/api/src/ic_nns_governance.pb.v1.rs @@ -2570,7 +2570,8 @@ pub mod update_canister_settings { pub log_visibility: Option, #[prost(uint64, optional, tag = "6")] pub wasm_memory_limit: Option, - /// XXX HOW TO RUN PROTOBUF GENERATOR TO UPDATE THIS STRUCT? + #[prost(uint64, optional, tag = "7")] + pub wasm_memory_threshold: ::core::option::Option, } /// Log visibility of a canister. #[derive( From 55afecf71125906a829c646850e7457bd4833dbb Mon Sep 17 00:00:00 2001 From: Dragoljub Duric Date: Mon, 2 Dec 2024 10:50:33 +0000 Subject: [PATCH 03/21] . --- rs/nervous_system/clients/src/canister_status.rs | 8 ++++++++ .../clients/src/management_canister_client/tests.rs | 1 + rs/nns/handlers/root/interface/src/client.rs | 1 + .../integration_tests/src/update_canister_settings.rs | 10 ++++++++++ 4 files changed, 20 insertions(+) diff --git a/rs/nervous_system/clients/src/canister_status.rs b/rs/nervous_system/clients/src/canister_status.rs index 816875edb8f..e7b689a0112 100644 --- a/rs/nervous_system/clients/src/canister_status.rs +++ b/rs/nervous_system/clients/src/canister_status.rs @@ -66,6 +66,7 @@ pub struct DefiniteCanisterSettings { pub reserved_cycles_limit: Option, pub wasm_memory_limit: Option, pub log_visibility: Option, + pub wasm_memory_threshold: Option, } /// Partial copy-paste of ic-types::ic_00::CanisterStatusResult. @@ -111,6 +112,7 @@ pub struct DefiniteCanisterSettingsFromManagementCanister { pub reserved_cycles_limit: candid::Nat, pub wasm_memory_limit: candid::Nat, pub log_visibility: LogVisibility, + pub wasm_memory_threshold: candid::Nat, } impl From for CanisterStatusResult { @@ -152,6 +154,7 @@ impl From for DefiniteCanisterSe reserved_cycles_limit, wasm_memory_limit, log_visibility, + wasm_memory_threshold, } = value; let compute_allocation = Some(compute_allocation); @@ -160,6 +163,7 @@ impl From for DefiniteCanisterSe let reserved_cycles_limit = Some(reserved_cycles_limit); let wasm_memory_limit = Some(wasm_memory_limit); let log_visibility = Some(log_visibility); + let wasm_memory_threshold = Some(wasm_memory_threshold); DefiniteCanisterSettings { controllers, @@ -169,6 +173,7 @@ impl From for DefiniteCanisterSe reserved_cycles_limit, wasm_memory_limit, log_visibility, + wasm_memory_threshold, } } } @@ -193,6 +198,7 @@ impl CanisterStatusResultFromManagementCanister { reserved_cycles_limit: candid::Nat::from(47_u32), wasm_memory_limit: candid::Nat::from(48_u32), log_visibility: LogVisibility::Controllers, + wasm_memory_threshold: candid::Nat::from(49_u32), }, cycles: candid::Nat::from(47_u32), idle_cycles_burned_per_day: candid::Nat::from(48_u32), @@ -417,6 +423,7 @@ mod tests { reserved_cycles_limit: candid::Nat::from(96_u32), wasm_memory_limit: candid::Nat::from(95_u32), log_visibility: LogVisibility::Controllers, + wasm_memory_threshold: candid::Nat::from(94_u32), }, cycles: candid::Nat::from(999_u32), idle_cycles_burned_per_day: candid::Nat::from(998_u32), @@ -435,6 +442,7 @@ mod tests { reserved_cycles_limit: Some(candid::Nat::from(96_u32)), wasm_memory_limit: Some(candid::Nat::from(95_u32)), log_visibility: Some(LogVisibility::Controllers), + wasm_memory_threshold: Some(candid::Nat::from(94_u32)), }, cycles: candid::Nat::from(999_u32), idle_cycles_burned_per_day: Some(candid::Nat::from(998_u32)), diff --git a/rs/nervous_system/clients/src/management_canister_client/tests.rs b/rs/nervous_system/clients/src/management_canister_client/tests.rs index 7dd0c0a3042..fe6cd4ca7c1 100644 --- a/rs/nervous_system/clients/src/management_canister_client/tests.rs +++ b/rs/nervous_system/clients/src/management_canister_client/tests.rs @@ -115,6 +115,7 @@ async fn test_limit_outstanding_calls() { reserved_cycles_limit: zero.clone(), wasm_memory_limit: zero.clone(), log_visibility: LogVisibility::Controllers, + wasm_memory_threshold: zero.clone(), }, status: CanisterStatusType::Running, reserved_cycles: zero.clone(), diff --git a/rs/nns/handlers/root/interface/src/client.rs b/rs/nns/handlers/root/interface/src/client.rs index f848ddcfabc..a6aff012261 100644 --- a/rs/nns/handlers/root/interface/src/client.rs +++ b/rs/nns/handlers/root/interface/src/client.rs @@ -220,6 +220,7 @@ impl SpyNnsRootCanisterClientReply { reserved_cycles_limit: Some(candid::Nat::from(10_u32)), wasm_memory_limit: Some(candid::Nat::from(11_u32)), log_visibility: Some(LogVisibility::Controllers), + wasm_memory_threshold: Some(candid::Nat::from(12_u32)), }, cycles: candid::Nat::from(42_u32), idle_cycles_burned_per_day: Some(candid::Nat::from(43_u32)), diff --git a/rs/nns/integration_tests/src/update_canister_settings.rs b/rs/nns/integration_tests/src/update_canister_settings.rs index d6197e954d2..2d6e7781613 100644 --- a/rs/nns/integration_tests/src/update_canister_settings.rs +++ b/rs/nns/integration_tests/src/update_canister_settings.rs @@ -37,6 +37,7 @@ fn test_update_canister_settings_proposal( let target_compute_allocation = 10u64; let target_freezing_threshold = 100_000u64; let target_wasm_memory_limit = 1u64 << 32; + let target_wasm_memory_threshold = 1u64 << 34; let target_log_visibility = Some(LogVisibility::Public); let canister_settings = || -> DefiniteCanisterSettings { get_canister_status( @@ -66,6 +67,10 @@ fn test_update_canister_settings_proposal( original_settings.wasm_memory_limit, Some(Nat::from(target_wasm_memory_limit)) ); + assert_ne!( + original_settings.wasm_memory_threshold, + Some(Nat::from(target_wasm_memory_threshold)) + ); assert_ne!(original_settings.log_visibility, target_log_visibility); // Step 3: Make a proposal to update settings of the registry canister and make sure the @@ -88,6 +93,7 @@ fn test_update_canister_settings_proposal( freezing_threshold: Some(target_freezing_threshold), wasm_memory_limit: Some(target_wasm_memory_limit), log_visibility: Some(GovernanceLogVisibility::Public as i32), + wasm_memory_threshold: Some(target_wasm_memory_threshold), }), }, )), @@ -119,6 +125,10 @@ fn test_update_canister_settings_proposal( updated_settings.wasm_memory_limit, Some(Nat::from(target_wasm_memory_limit)) ); + assert_eq!( + original_settings.wasm_memory_threshold, + Some(Nat::from(target_wasm_memory_threshold)) + ); assert_eq!(updated_settings.log_visibility, target_log_visibility); } From 940efe0eb5a5803f7e3199ef19d14bd1cf04ac75 Mon Sep 17 00:00:00 2001 From: Dragoljub Duric Date: Mon, 2 Dec 2024 14:40:32 +0000 Subject: [PATCH 04/21] Add wasm threshold to Root canister and rest of the places. --- rs/nervous_system/clients/src/canister_status.rs | 8 ++++++++ rs/nervous_system/clients/src/update_settings.rs | 1 + .../governance/src/proposals/update_canister_settings.rs | 5 ++++- rs/sns/governance/api/src/ic_sns_governance.pb.v1.rs | 2 ++ rs/sns/governance/canister/governance.did | 2 ++ rs/sns/governance/canister/governance_test.did | 2 ++ .../proto/ic_sns_governance/pb/v1/governance.proto | 1 + rs/sns/governance/src/gen/ic_sns_governance.pb.v1.rs | 2 ++ rs/sns/governance/src/pb/conversions.rs | 2 ++ rs/sns/governance/src/proposal.rs | 3 +++ rs/sns/governance/src/sns_root_types.rs | 2 ++ rs/sns/governance/src/types.rs | 2 ++ .../src/manage_dapp_canister_settings.rs | 5 +++++ rs/sns/root/canister/root.did | 3 +++ rs/sns/root/proto/ic_sns_root/pb/v1/root.proto | 1 + rs/sns/root/src/gen/ic_sns_root.pb.v1.rs | 2 ++ rs/sns/root/src/lib.rs | 4 ++++ rs/sns/swap/canister/swap.did | 1 + rs/sns/swap/canister/tests.rs | 2 ++ rs/types/management_canister_types/src/lib.rs | 4 ++++ 20 files changed, 53 insertions(+), 1 deletion(-) diff --git a/rs/nervous_system/clients/src/canister_status.rs b/rs/nervous_system/clients/src/canister_status.rs index e7b689a0112..e3416abf202 100644 --- a/rs/nervous_system/clients/src/canister_status.rs +++ b/rs/nervous_system/clients/src/canister_status.rs @@ -243,6 +243,7 @@ impl CanisterStatusResultV2 { freezing_threshold: u64, idle_cycles_burned_per_day: u128, wasm_memory_limit: u64, + wasm_memory_threshold: u64, ) -> Self { Self { status, @@ -257,6 +258,7 @@ impl CanisterStatusResultV2 { memory_allocation, freezing_threshold, Some(wasm_memory_limit), + wasm_memory_threshold, ), idle_cycles_burned_per_day: candid::Nat::from(idle_cycles_burned_per_day), } @@ -303,6 +305,7 @@ impl CanisterStatusResultV2 { 45, // freezing_threshold 46, // idle_cycles_burned_per_day 47, // wasm_memory_limit + 48, // wasm_memory_threshold ) } @@ -324,6 +327,7 @@ pub struct DefiniteCanisterSettingsArgs { pub memory_allocation: candid::Nat, pub freezing_threshold: candid::Nat, pub wasm_memory_limit: Option, + pub wasm_memory_threshold: candid::Nat, } impl From @@ -336,6 +340,7 @@ impl From memory_allocation: settings.memory_allocation(), freezing_threshold: settings.freezing_threshold(), wasm_memory_limit: Some(settings.wasm_memory_limit()), + wasm_memory_threshold: settings.wasm_memory_threshold(), } } } @@ -347,6 +352,7 @@ impl DefiniteCanisterSettingsArgs { memory_allocation: Option, freezing_threshold: u64, wasm_memory_limit: Option, + wasm_memory_threshold: u64, ) -> Self { let memory_allocation = match memory_allocation { None => candid::Nat::from(0_u32), @@ -358,6 +364,7 @@ impl DefiniteCanisterSettingsArgs { memory_allocation, freezing_threshold: candid::Nat::from(freezing_threshold), wasm_memory_limit: wasm_memory_limit.map(candid::Nat::from), + wasm_memory_threshold: candid::Nat::from(wasm_memory_threshold), } } @@ -389,6 +396,7 @@ impl From for CanisterStatusResultV2 memory_allocation: value.settings.memory_allocation, freezing_threshold: value.settings.freezing_threshold, wasm_memory_limit: Some(value.settings.wasm_memory_limit), + wasm_memory_threshold: value.settings.wasm_memory_threshold, }, memory_size: value.memory_size, cycles: value.cycles, diff --git a/rs/nervous_system/clients/src/update_settings.rs b/rs/nervous_system/clients/src/update_settings.rs index 14fa3efdf0d..56acee4adbf 100644 --- a/rs/nervous_system/clients/src/update_settings.rs +++ b/rs/nervous_system/clients/src/update_settings.rs @@ -33,6 +33,7 @@ pub struct CanisterSettings { pub reserved_cycles_limit: Option, pub log_visibility: Option, pub wasm_memory_limit: Option, + pub wasm_memory_threshold: Option, } /// A wrapper call to the management canister `update_settings` API. diff --git a/rs/nns/governance/src/proposals/update_canister_settings.rs b/rs/nns/governance/src/proposals/update_canister_settings.rs index da362d2d754..60b49dcdcf9 100644 --- a/rs/nns/governance/src/proposals/update_canister_settings.rs +++ b/rs/nns/governance/src/proposals/update_canister_settings.rs @@ -76,7 +76,7 @@ impl UpdateCanisterSettings { let memory_allocation = settings.memory_allocation.map(Nat::from); let freezing_threshold = settings.freezing_threshold.map(Nat::from); let wasm_memory_limit = settings.wasm_memory_limit.map(Nat::from); - let _wasm_memory_threshold = settings.wasm_memory_threshold.map(Nat::from); + let wasm_memory_threshold = settings.wasm_memory_threshold.map(Nat::from); let log_visibility = match settings.log_visibility { Some(log_visibility) => Some(Self::valid_log_visibility(log_visibility)?), None => None, @@ -91,6 +91,7 @@ impl UpdateCanisterSettings { wasm_memory_limit, log_visibility, reserved_cycles_limit, + wasm_memory_threshold, }) } @@ -260,6 +261,7 @@ mod tests { freezing_threshold: Some(Nat::from(100u64)), log_visibility: Some(RootLogVisibility::Public), reserved_cycles_limit: None, + wasm_memory_threshold: Some(Nat::from(1000u64)), } } ); @@ -309,6 +311,7 @@ mod tests { freezing_threshold: Some(Nat::from(100u64)), log_visibility: Some(RootLogVisibility::Public), reserved_cycles_limit: None, + wasm_memory_threshold: Some(Nat::from(1000u64)), } ); } diff --git a/rs/sns/governance/api/src/ic_sns_governance.pb.v1.rs b/rs/sns/governance/api/src/ic_sns_governance.pb.v1.rs index e159bfe22a5..646d86ab790 100644 --- a/rs/sns/governance/api/src/ic_sns_governance.pb.v1.rs +++ b/rs/sns/governance/api/src/ic_sns_governance.pb.v1.rs @@ -612,6 +612,8 @@ pub struct ManageDappCanisterSettings { pub log_visibility: ::core::option::Option, #[prost(uint64, optional, tag = "7")] pub wasm_memory_limit: ::core::option::Option, + #[prost(uint64, optional, tag = "8")] + pub wasm_memory_threshold: ::core::option::Option, } /// Unlike `Governance.Version`, this message has optional fields and is the recommended one /// to use in APIs that can evolve. For example, the SNS Governance could eventually support diff --git a/rs/sns/governance/canister/governance.did b/rs/sns/governance/canister/governance.did index 4c4852253df..bdf40e41559 100644 --- a/rs/sns/governance/canister/governance.did +++ b/rs/sns/governance/canister/governance.did @@ -157,6 +157,7 @@ type DefiniteCanisterSettingsArgs = record { wasm_memory_limit : opt nat; memory_allocation : nat; compute_allocation : nat; + wasm_memory_threshold : nat; }; type DeregisterDappCanisters = record { @@ -375,6 +376,7 @@ type ManageDappCanisterSettings = record { wasm_memory_limit : opt nat64; memory_allocation : opt nat64; compute_allocation : opt nat64; + wasm_memory_threshold : opt nat64; }; type SnsVersion = record { diff --git a/rs/sns/governance/canister/governance_test.did b/rs/sns/governance/canister/governance_test.did index 7af49fcbe8e..bbb8f083764 100644 --- a/rs/sns/governance/canister/governance_test.did +++ b/rs/sns/governance/canister/governance_test.did @@ -166,6 +166,7 @@ type DefiniteCanisterSettingsArgs = record { wasm_memory_limit : opt nat; memory_allocation : nat; compute_allocation : nat; + wasm_memory_threshold : nat; }; type DeregisterDappCanisters = record { @@ -384,6 +385,7 @@ type ManageDappCanisterSettings = record { wasm_memory_limit : opt nat64; memory_allocation : opt nat64; compute_allocation : opt nat64; + wasm_memory_threshold : opt nat64; }; type SnsVersion = record { diff --git a/rs/sns/governance/proto/ic_sns_governance/pb/v1/governance.proto b/rs/sns/governance/proto/ic_sns_governance/pb/v1/governance.proto index 88d245e4568..228f1b7b50b 100644 --- a/rs/sns/governance/proto/ic_sns_governance/pb/v1/governance.proto +++ b/rs/sns/governance/proto/ic_sns_governance/pb/v1/governance.proto @@ -437,6 +437,7 @@ message ManageDappCanisterSettings { optional LogVisibility log_visibility = 6; optional uint64 wasm_memory_limit = 7; + optional uint64 wasm_memory_threshold = 8; } // Unlike `Governance.Version`, this message has optional fields and is the recommended one diff --git a/rs/sns/governance/src/gen/ic_sns_governance.pb.v1.rs b/rs/sns/governance/src/gen/ic_sns_governance.pb.v1.rs index 167cd7054b7..a77e65b97eb 100644 --- a/rs/sns/governance/src/gen/ic_sns_governance.pb.v1.rs +++ b/rs/sns/governance/src/gen/ic_sns_governance.pb.v1.rs @@ -612,6 +612,8 @@ pub struct ManageDappCanisterSettings { pub log_visibility: ::core::option::Option, #[prost(uint64, optional, tag = "7")] pub wasm_memory_limit: ::core::option::Option, + #[prost(uint64, optional, tag = "8")] + pub wasm_memory_threshold: ::core::option::Option, } /// Unlike `Governance.Version`, this message has optional fields and is the recommended one /// to use in APIs that can evolve. For example, the SNS Governance could eventually support diff --git a/rs/sns/governance/src/pb/conversions.rs b/rs/sns/governance/src/pb/conversions.rs index ad121ed0de9..9ff6e0e6eff 100644 --- a/rs/sns/governance/src/pb/conversions.rs +++ b/rs/sns/governance/src/pb/conversions.rs @@ -479,6 +479,7 @@ impl From for pb_api::ManageDappCanisterSettings reserved_cycles_limit: item.reserved_cycles_limit, log_visibility: item.log_visibility, wasm_memory_limit: item.wasm_memory_limit, + wasm_memory_threshold: item.wasm_memory_threshold, } } } @@ -492,6 +493,7 @@ impl From for pb::ManageDappCanisterSettings reserved_cycles_limit: item.reserved_cycles_limit, log_visibility: item.log_visibility, wasm_memory_limit: item.wasm_memory_limit, + wasm_memory_threshold: item.wasm_memory_threshold, } } } diff --git a/rs/sns/governance/src/proposal.rs b/rs/sns/governance/src/proposal.rs index e82d3e77591..c61cf98e685 100644 --- a/rs/sns/governance/src/proposal.rs +++ b/rs/sns/governance/src/proposal.rs @@ -3232,6 +3232,7 @@ mod tests { 0, 0, 0, + 0, ) } @@ -4542,6 +4543,7 @@ Version { reserved_cycles_limit: Some(1_000_000_000_000), log_visibility: Some(LogVisibility::Public as i32), wasm_memory_limit: Some(1_000_000_000), + wasm_memory_threshold: Some(1_000_000), }) .unwrap(); } @@ -4668,6 +4670,7 @@ Payload rendering here"# reserved_cycles_limit: Some(1_000_000_000_000), log_visibility: Some(LogVisibility::Public as i32), wasm_memory_limit: Some(1_000_000_000), + wasm_memory_threshold: Some(1_000_000), }) .unwrap(); assert_eq!( diff --git a/rs/sns/governance/src/sns_root_types.rs b/rs/sns/governance/src/sns_root_types.rs index a3743604941..3b3212810f4 100644 --- a/rs/sns/governance/src/sns_root_types.rs +++ b/rs/sns/governance/src/sns_root_types.rs @@ -184,6 +184,8 @@ pub struct ManageDappCanisterSettingsRequest { pub log_visibility: ::core::option::Option, #[prost(uint64, optional, tag = "7")] pub wasm_memory_limit: ::core::option::Option, + #[prost(uint64, optional, tag = "8")] + pub wasm_memory_threshold: ::core::option::Option, } #[derive(candid::CandidType, candid::Deserialize, comparable::Comparable)] diff --git a/rs/sns/governance/src/types.rs b/rs/sns/governance/src/types.rs index 0dcd9df51fe..4b171aa20ed 100644 --- a/rs/sns/governance/src/types.rs +++ b/rs/sns/governance/src/types.rs @@ -2445,6 +2445,7 @@ impl From for ManageDappCanisterSettingsRequest { reserved_cycles_limit, log_visibility, wasm_memory_limit, + wasm_memory_threshold, } = manage_dapp_canister_settings; ManageDappCanisterSettingsRequest { @@ -2455,6 +2456,7 @@ impl From for ManageDappCanisterSettingsRequest { reserved_cycles_limit, log_visibility, wasm_memory_limit, + wasm_memory_threshold, } } } diff --git a/rs/sns/integration_tests/src/manage_dapp_canister_settings.rs b/rs/sns/integration_tests/src/manage_dapp_canister_settings.rs index 4c1f0a8a90d..1e8eaa9cf7d 100644 --- a/rs/sns/integration_tests/src/manage_dapp_canister_settings.rs +++ b/rs/sns/integration_tests/src/manage_dapp_canister_settings.rs @@ -106,6 +106,7 @@ fn test_manage_dapp_canister_settings_successful() { Some(1 << 30), 100_000, Some(1_000_000_000), + 0, ), ); @@ -121,6 +122,7 @@ fn test_manage_dapp_canister_settings_successful() { reserved_cycles_limit: Some(0), log_visibility: Some(LogVisibility::Controllers as i32), wasm_memory_limit: Some(2_000_000_000), + wasm_memory_threshold: Some(0), }, )), ..Default::default() @@ -157,6 +159,7 @@ fn test_manage_dapp_canister_settings_successful() { Some(0), 0, Some(2_000_000_000), + 0, ), ); } @@ -232,6 +235,7 @@ fn test_manage_dapp_canister_settings_failure() { Some(1 << 30), 100_000, Some(1_000_000_000), + 0, ), ); @@ -303,6 +307,7 @@ fn test_manage_dapp_canister_settings_failure() { Some(1 << 30), 100_000, Some(1_000_000_000), + 0, ), ); diff --git a/rs/sns/root/canister/root.did b/rs/sns/root/canister/root.did index 0790711d95a..d86d2a0967b 100644 --- a/rs/sns/root/canister/root.did +++ b/rs/sns/root/canister/root.did @@ -61,6 +61,7 @@ type DefiniteCanisterSettings = record { wasm_memory_limit : opt nat; memory_allocation : opt nat; compute_allocation : opt nat; + wasm_memory_threshold : opt nat; }; type DefiniteCanisterSettingsArgs = record { @@ -69,6 +70,7 @@ type DefiniteCanisterSettingsArgs = record { wasm_memory_limit : opt nat; memory_allocation : nat; compute_allocation : nat; + wasm_memory_threshold : nat; }; type FailedUpdate = record { @@ -113,6 +115,7 @@ type ManageDappCanisterSettingsRequest = record { wasm_memory_limit : opt nat64; memory_allocation : opt nat64; compute_allocation : opt nat64; + wasm_memory_threshold : opt nat64; }; type ManageDappCanisterSettingsResponse = record { diff --git a/rs/sns/root/proto/ic_sns_root/pb/v1/root.proto b/rs/sns/root/proto/ic_sns_root/pb/v1/root.proto index 198da97129e..13a307d16b0 100644 --- a/rs/sns/root/proto/ic_sns_root/pb/v1/root.proto +++ b/rs/sns/root/proto/ic_sns_root/pb/v1/root.proto @@ -128,6 +128,7 @@ message ManageDappCanisterSettingsRequest { optional uint64 reserved_cycles_limit = 5; optional LogVisibility log_visibility = 6; optional uint64 wasm_memory_limit = 7; + optional uint64 wasm_memory_threshold = 8; } message ManageDappCanisterSettingsResponse { diff --git a/rs/sns/root/src/gen/ic_sns_root.pb.v1.rs b/rs/sns/root/src/gen/ic_sns_root.pb.v1.rs index 60ea81783e4..182d0b49bd4 100644 --- a/rs/sns/root/src/gen/ic_sns_root.pb.v1.rs +++ b/rs/sns/root/src/gen/ic_sns_root.pb.v1.rs @@ -234,6 +234,8 @@ pub struct ManageDappCanisterSettingsRequest { pub log_visibility: ::core::option::Option, #[prost(uint64, optional, tag = "7")] pub wasm_memory_limit: ::core::option::Option, + #[prost(uint64, optional, tag = "8")] + pub wasm_memory_threshold: ::core::option::Option, } #[derive( candid::CandidType, diff --git a/rs/sns/root/src/lib.rs b/rs/sns/root/src/lib.rs index 84811ab333d..e866d94c17d 100644 --- a/rs/sns/root/src/lib.rs +++ b/rs/sns/root/src/lib.rs @@ -195,6 +195,7 @@ impl ValidatedManageDappCanisterSettingsRequest { reserved_cycles_limit: request.reserved_cycles_limit.map(Nat::from), log_visibility: LogVisibility::try_from(request.log_visibility()).ok(), wasm_memory_limit: request.wasm_memory_limit.map(Nat::from), + wasm_memory_threshold: request.wasm_memory_threshold.map(Nat::from), }; let invalid_dapp_canister_ids = request .canister_ids @@ -2201,6 +2202,7 @@ mod tests { reserved_cycles_limit: Some(1_000_000_000_000), log_visibility: Some(crate::pb::v1::LogVisibility::Controllers as i32), wasm_memory_limit: Some(1_000_000_000), + wasm_memory_threshold: Some(1_000_000), }; let validated_request = ValidatedManageDappCanisterSettingsRequest::try_from( request, @@ -2226,6 +2228,7 @@ mod tests { reserved_cycles_limit: Some(Nat::from(1_000_000_000_000u64)), log_visibility: Some(LogVisibility::Controllers), wasm_memory_limit: Some(Nat::from(1_000_000_000u64)), + wasm_memory_threshold: Some(Nat::from(1_000_000u64)), }, } ); @@ -2245,6 +2248,7 @@ mod tests { reserved_cycles_limit: Some(1_000_000_000_000), log_visibility: Some(crate::pb::v1::LogVisibility::Controllers as i32), wasm_memory_limit: Some(1_000_000_000), + wasm_memory_threshold: Some(1_000_000), }; let failure_reason = ValidatedManageDappCanisterSettingsRequest::try_from( request, diff --git a/rs/sns/swap/canister/swap.did b/rs/sns/swap/canister/swap.did index 295231a8624..240243acf17 100644 --- a/rs/sns/swap/canister/swap.did +++ b/rs/sns/swap/canister/swap.did @@ -53,6 +53,7 @@ type DefiniteCanisterSettingsArgs = record { wasm_memory_limit : opt nat; memory_allocation : nat; compute_allocation : nat; + wasm_memory_threshold : nat; }; type DerivedState = record { diff --git a/rs/sns/swap/canister/tests.rs b/rs/sns/swap/canister/tests.rs index 4466a377cac..866b954eebc 100644 --- a/rs/sns/swap/canister/tests.rs +++ b/rs/sns/swap/canister/tests.rs @@ -54,6 +54,7 @@ async fn test_get_canister_status() { memory_allocation: candid::Nat::from(0_u32), freezing_threshold: candid::Nat::from(0_u32), wasm_memory_limit: Some(candid::Nat::from(0_u32)), + wasm_memory_threshold: candid::Nat::from(0_u32), }, memory_size: candid::Nat::from(0_u32), cycles: candid::Nat::from(0_u32), @@ -74,6 +75,7 @@ async fn test_get_canister_status() { reserved_cycles_limit: candid::Nat::from(0_u32), wasm_memory_limit: candid::Nat::from(0_u32), log_visibility: LogVisibility::Controllers, + wasm_memory_threshold: candid::Nat::from(0_u32), }, cycles: candid::Nat::from(0_u32), idle_cycles_burned_per_day: candid::Nat::from(0_u32), diff --git a/rs/types/management_canister_types/src/lib.rs b/rs/types/management_canister_types/src/lib.rs index 63a06d95bc2..0d040bf56c6 100644 --- a/rs/types/management_canister_types/src/lib.rs +++ b/rs/types/management_canister_types/src/lib.rs @@ -937,6 +937,10 @@ impl DefiniteCanisterSettingsArgs { self.wasm_memory_limit.clone() } + pub fn wasm_memory_threshold(&self) -> candid::Nat { + self.wasm_memory_threshold.clone() + } + pub fn compute_allocation(&self) -> candid::Nat { self.compute_allocation.clone() } From b2bf1c01a8f5eb9a834c521ca14bdf511bfbbe12 Mon Sep 17 00:00:00 2001 From: Dragoljub Duric Date: Mon, 2 Dec 2024 14:54:39 +0000 Subject: [PATCH 05/21] Fix clippy. --- rs/nns/governance/tests/governance.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/rs/nns/governance/tests/governance.rs b/rs/nns/governance/tests/governance.rs index 7f53af80cb9..4f54708a84d 100644 --- a/rs/nns/governance/tests/governance.rs +++ b/rs/nns/governance/tests/governance.rs @@ -12111,6 +12111,7 @@ lazy_static! { 448076, // freezing_threshold 268693, // idle_cycles_burned_per_day (3.5 * (1 << 30) as f32) as u64, // wasm_memory_limit (3.5gb) + 123478, // wasm_memory_threshold )), }), governance: Some(ic_sns_root::CanisterSummary { From b2225577e114908f7b22a74509c16d63c713e43d Mon Sep 17 00:00:00 2001 From: Dragoljub Duric Date: Mon, 2 Dec 2024 15:41:11 +0000 Subject: [PATCH 06/21] Fix unit tests. --- rs/nns/governance/api/src/ic_nns_governance.pb.v1.rs | 2 +- rs/nns/governance/canister/governance.did | 1 + rs/nns/governance/canister/governance_test.did | 1 + .../governance/src/proposals/update_canister_settings.rs | 8 ++++---- rs/nns/handlers/root/impl/canister/root.did | 2 ++ 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/rs/nns/governance/api/src/ic_nns_governance.pb.v1.rs b/rs/nns/governance/api/src/ic_nns_governance.pb.v1.rs index a56b70d71a7..b71848d5c54 100644 --- a/rs/nns/governance/api/src/ic_nns_governance.pb.v1.rs +++ b/rs/nns/governance/api/src/ic_nns_governance.pb.v1.rs @@ -2571,7 +2571,7 @@ pub mod update_canister_settings { #[prost(uint64, optional, tag = "6")] pub wasm_memory_limit: Option, #[prost(uint64, optional, tag = "7")] - pub wasm_memory_threshold: ::core::option::Option, + pub wasm_memory_threshold: Option, } /// Log visibility of a canister. #[derive( diff --git a/rs/nns/governance/canister/governance.did b/rs/nns/governance/canister/governance.did index 237c1a67708..626d0b7335e 100644 --- a/rs/nns/governance/canister/governance.did +++ b/rs/nns/governance/canister/governance.did @@ -64,6 +64,7 @@ type CanisterSettings = record { wasm_memory_limit : opt nat64; memory_allocation : opt nat64; compute_allocation : opt nat64; + wasm_memory_threshold : opt nat64; }; type CanisterStatusResultV2 = record { diff --git a/rs/nns/governance/canister/governance_test.did b/rs/nns/governance/canister/governance_test.did index f7a5d40795d..55fc03a9e79 100644 --- a/rs/nns/governance/canister/governance_test.did +++ b/rs/nns/governance/canister/governance_test.did @@ -64,6 +64,7 @@ type CanisterSettings = record { wasm_memory_limit : opt nat64; memory_allocation : opt nat64; compute_allocation : opt nat64; + wasm_memory_threshold : opt nat64; }; type CanisterStatusResultV2 = record { diff --git a/rs/nns/governance/src/proposals/update_canister_settings.rs b/rs/nns/governance/src/proposals/update_canister_settings.rs index 60b49dcdcf9..4acc5c8d861 100644 --- a/rs/nns/governance/src/proposals/update_canister_settings.rs +++ b/rs/nns/governance/src/proposals/update_canister_settings.rs @@ -226,7 +226,7 @@ mod tests { }), memory_allocation: Some(1 << 32), wasm_memory_limit: Some(1 << 31), - wasm_memory_threshold: Some(1 << 31), + wasm_memory_threshold: Some(1 << 33), compute_allocation: Some(10), freezing_threshold: Some(100), log_visibility: Some(LogVisibility::Public as i32), @@ -261,7 +261,7 @@ mod tests { freezing_threshold: Some(Nat::from(100u64)), log_visibility: Some(RootLogVisibility::Public), reserved_cycles_limit: None, - wasm_memory_threshold: Some(Nat::from(1000u64)), + wasm_memory_threshold: Some(Nat::from(1u64 << 33)), } } ); @@ -278,7 +278,7 @@ mod tests { }), memory_allocation: Some(1 << 32), wasm_memory_limit: Some(1 << 31), - wasm_memory_threshold: Some(1 << 31), + wasm_memory_threshold: Some(1 << 33), compute_allocation: Some(10), freezing_threshold: Some(100), log_visibility: Some(LogVisibility::Public as i32), @@ -311,7 +311,7 @@ mod tests { freezing_threshold: Some(Nat::from(100u64)), log_visibility: Some(RootLogVisibility::Public), reserved_cycles_limit: None, - wasm_memory_threshold: Some(Nat::from(1000u64)), + wasm_memory_threshold: Some(Nat::from(1u64 << 33)), } ); } diff --git a/rs/nns/handlers/root/impl/canister/root.did b/rs/nns/handlers/root/impl/canister/root.did index 974d6bde7e2..ee6ab152c0b 100644 --- a/rs/nns/handlers/root/impl/canister/root.did +++ b/rs/nns/handlers/root/impl/canister/root.did @@ -30,6 +30,7 @@ type CanisterSettings = record { wasm_memory_limit : opt nat; memory_allocation : opt nat; compute_allocation : opt nat; + wasm_memory_threshold : opt nat; }; type CanisterStatusResult = record { @@ -85,6 +86,7 @@ type DefiniteCanisterSettings = record { wasm_memory_limit : opt nat; memory_allocation : opt nat; compute_allocation : opt nat; + wasm_memory_threshold : opt nat; }; type LogVisibility = variant { From a4351a9addc9232779bac9715e2292cad380f367 Mon Sep 17 00:00:00 2001 From: Dragoljub Duric Date: Tue, 3 Dec 2024 12:45:36 +0000 Subject: [PATCH 07/21] . --- rs/nns/integration_tests/src/update_canister_settings.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rs/nns/integration_tests/src/update_canister_settings.rs b/rs/nns/integration_tests/src/update_canister_settings.rs index 2d6e7781613..ee3e4e56137 100644 --- a/rs/nns/integration_tests/src/update_canister_settings.rs +++ b/rs/nns/integration_tests/src/update_canister_settings.rs @@ -126,7 +126,7 @@ fn test_update_canister_settings_proposal( Some(Nat::from(target_wasm_memory_limit)) ); assert_eq!( - original_settings.wasm_memory_threshold, + updated_settings.wasm_memory_threshold, Some(Nat::from(target_wasm_memory_threshold)) ); assert_eq!(updated_settings.log_visibility, target_log_visibility); From 5188a6837d58696635ed82f301fac1a07a7dc94f Mon Sep 17 00:00:00 2001 From: Dragoljub Duric Date: Tue, 3 Dec 2024 13:32:37 +0000 Subject: [PATCH 08/21] . --- .../governance/src/proposals/update_canister_settings.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rs/nns/governance/src/proposals/update_canister_settings.rs b/rs/nns/governance/src/proposals/update_canister_settings.rs index 4acc5c8d861..c008ec352a9 100644 --- a/rs/nns/governance/src/proposals/update_canister_settings.rs +++ b/rs/nns/governance/src/proposals/update_canister_settings.rs @@ -226,7 +226,7 @@ mod tests { }), memory_allocation: Some(1 << 32), wasm_memory_limit: Some(1 << 31), - wasm_memory_threshold: Some(1 << 33), + wasm_memory_threshold: Some(1 << 30), compute_allocation: Some(10), freezing_threshold: Some(100), log_visibility: Some(LogVisibility::Public as i32), @@ -261,7 +261,7 @@ mod tests { freezing_threshold: Some(Nat::from(100u64)), log_visibility: Some(RootLogVisibility::Public), reserved_cycles_limit: None, - wasm_memory_threshold: Some(Nat::from(1u64 << 33)), + wasm_memory_threshold: Some(Nat::from(1u64 << 30)), } } ); @@ -278,7 +278,7 @@ mod tests { }), memory_allocation: Some(1 << 32), wasm_memory_limit: Some(1 << 31), - wasm_memory_threshold: Some(1 << 33), + wasm_memory_threshold: Some(1 << 30), compute_allocation: Some(10), freezing_threshold: Some(100), log_visibility: Some(LogVisibility::Public as i32), @@ -311,7 +311,7 @@ mod tests { freezing_threshold: Some(Nat::from(100u64)), log_visibility: Some(RootLogVisibility::Public), reserved_cycles_limit: None, - wasm_memory_threshold: Some(Nat::from(1u64 << 33)), + wasm_memory_threshold: Some(Nat::from(1u64 << 30)), } ); } From c32221d4b8c9b556839b88b27100d325caea4921 Mon Sep 17 00:00:00 2001 From: Dragoljub Duric Date: Tue, 3 Dec 2024 13:49:43 +0000 Subject: [PATCH 09/21] . --- rs/nns/handlers/lifeline/impl/lifeline.did | 1 + rs/nns/handlers/lifeline/impl/lifeline.mo | 1 + 2 files changed, 2 insertions(+) diff --git a/rs/nns/handlers/lifeline/impl/lifeline.did b/rs/nns/handlers/lifeline/impl/lifeline.did index a591df91ee6..e3f5b403b57 100644 --- a/rs/nns/handlers/lifeline/impl/lifeline.did +++ b/rs/nns/handlers/lifeline/impl/lifeline.did @@ -15,6 +15,7 @@ type CanisterSettings = record { reserved_cycles_limit: opt nat; wasm_memory_limit: opt nat; log_visibility: opt LogVisibility; + wasm_memory_threshold: opt nat; }; type LogVisibility = variant { controllers; public }; diff --git a/rs/nns/handlers/lifeline/impl/lifeline.mo b/rs/nns/handlers/lifeline/impl/lifeline.mo index 07129722c29..76a4dbb2cdd 100644 --- a/rs/nns/handlers/lifeline/impl/lifeline.mo +++ b/rs/nns/handlers/lifeline/impl/lifeline.mo @@ -31,6 +31,7 @@ actor { reserved_cycles_limit: ?Nat; wasm_memory_limit: ?Nat; log_visibility: ?LogVisibility; + wasm_memory_threshold: ?Nat; }; // IC00 is the management canister. We rely on it for the four From b0f5e22ff9a4b837426e21f9eb545d6a17af0b46 Mon Sep 17 00:00:00 2001 From: Dragoljub Duric Date: Tue, 3 Dec 2024 13:56:26 +0000 Subject: [PATCH 10/21] . --- rs/nns/integration_tests/src/update_canister_settings.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rs/nns/integration_tests/src/update_canister_settings.rs b/rs/nns/integration_tests/src/update_canister_settings.rs index ee3e4e56137..37d937e3152 100644 --- a/rs/nns/integration_tests/src/update_canister_settings.rs +++ b/rs/nns/integration_tests/src/update_canister_settings.rs @@ -36,7 +36,7 @@ fn test_update_canister_settings_proposal( let target_memory_allocation = 1u64 << 33; let target_compute_allocation = 10u64; let target_freezing_threshold = 100_000u64; - let target_wasm_memory_limit = 1u64 << 32; + let target_wasm_memory_limit = 1u64 << 36; let target_wasm_memory_threshold = 1u64 << 34; let target_log_visibility = Some(LogVisibility::Public); let canister_settings = || -> DefiniteCanisterSettings { From 4a56b7b2350f37e9592a2bd9830162917140c2e2 Mon Sep 17 00:00:00 2001 From: Dragoljub Duric Date: Tue, 3 Dec 2024 16:44:59 +0000 Subject: [PATCH 11/21] . --- rs/nervous_system/clients/src/canister_status.rs | 2 +- rs/nns/handlers/root/interface/src/client.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rs/nervous_system/clients/src/canister_status.rs b/rs/nervous_system/clients/src/canister_status.rs index e3416abf202..34e5dce5949 100644 --- a/rs/nervous_system/clients/src/canister_status.rs +++ b/rs/nervous_system/clients/src/canister_status.rs @@ -305,7 +305,7 @@ impl CanisterStatusResultV2 { 45, // freezing_threshold 46, // idle_cycles_burned_per_day 47, // wasm_memory_limit - 48, // wasm_memory_threshold + 41, // wasm_memory_threshold ) } diff --git a/rs/nns/handlers/root/interface/src/client.rs b/rs/nns/handlers/root/interface/src/client.rs index a6aff012261..09d556152c0 100644 --- a/rs/nns/handlers/root/interface/src/client.rs +++ b/rs/nns/handlers/root/interface/src/client.rs @@ -220,7 +220,7 @@ impl SpyNnsRootCanisterClientReply { reserved_cycles_limit: Some(candid::Nat::from(10_u32)), wasm_memory_limit: Some(candid::Nat::from(11_u32)), log_visibility: Some(LogVisibility::Controllers), - wasm_memory_threshold: Some(candid::Nat::from(12_u32)), + wasm_memory_threshold: Some(candid::Nat::from(6_u32)), }, cycles: candid::Nat::from(42_u32), idle_cycles_burned_per_day: Some(candid::Nat::from(43_u32)), From 555abfcb2e9717339d9a47a5c26363719eb1193e Mon Sep 17 00:00:00 2001 From: Dragoljub Duric Date: Tue, 3 Dec 2024 17:12:43 +0000 Subject: [PATCH 12/21] . --- packages/pocket-ic/src/management_canister.rs | 2 ++ rs/bitcoin/ckbtc/minter/ckbtc_minter.did | 1 + rs/ethereum/cketh/minter/cketh_minter.did | 1 + .../ledger-suite-orchestrator/ledger_suite_orchestrator.did | 1 + 4 files changed, 5 insertions(+) diff --git a/packages/pocket-ic/src/management_canister.rs b/packages/pocket-ic/src/management_canister.rs index 1878e6728e2..f31904e3b49 100644 --- a/packages/pocket-ic/src/management_canister.rs +++ b/packages/pocket-ic/src/management_canister.rs @@ -28,6 +28,7 @@ pub struct DefiniteCanisterSettings { pub wasm_memory_limit: candid::Nat, pub memory_allocation: candid::Nat, pub compute_allocation: candid::Nat, + pub wasm_memory_threshold: candid::Nat, } #[derive(CandidType, Deserialize, Debug, Clone, Default)] @@ -39,6 +40,7 @@ pub struct CanisterSettings { pub wasm_memory_limit: Option, pub memory_allocation: Option, pub compute_allocation: Option, + pub wasm_memory_threshold: Option, } #[derive(CandidType, Deserialize, Debug, Clone)] diff --git a/rs/bitcoin/ckbtc/minter/ckbtc_minter.did b/rs/bitcoin/ckbtc/minter/ckbtc_minter.did index e4ee40126e9..5464bd00a9d 100644 --- a/rs/bitcoin/ckbtc/minter/ckbtc_minter.did +++ b/rs/bitcoin/ckbtc/minter/ckbtc_minter.did @@ -29,6 +29,7 @@ type DefiniteCanisterSettings = record { reserved_cycles_limit : nat; log_visibility: LogVisibility; wasm_memory_limit : nat; + wasm_memory_threshold : nat; }; type LogVisibility = variant { diff --git a/rs/ethereum/cketh/minter/cketh_minter.did b/rs/ethereum/cketh/minter/cketh_minter.did index 2f938ae190f..d455b1bc3a7 100644 --- a/rs/ethereum/cketh/minter/cketh_minter.did +++ b/rs/ethereum/cketh/minter/cketh_minter.did @@ -28,6 +28,7 @@ type DefiniteCanisterSettings = record { reserved_cycles_limit : nat; log_visibility: LogVisibility; wasm_memory_limit : nat; + wasm_memory_threshold : nat; }; type LogVisibility = variant { diff --git a/rs/ethereum/ledger-suite-orchestrator/ledger_suite_orchestrator.did b/rs/ethereum/ledger-suite-orchestrator/ledger_suite_orchestrator.did index 36df009afd0..e87d6b3ec22 100644 --- a/rs/ethereum/ledger-suite-orchestrator/ledger_suite_orchestrator.did +++ b/rs/ethereum/ledger-suite-orchestrator/ledger_suite_orchestrator.did @@ -227,6 +227,7 @@ type DefiniteCanisterSettings = record { reserved_cycles_limit : nat; log_visibility: LogVisibility; wasm_memory_limit : nat; + wasm_memory_threshold : nat; }; type LogVisibility = variant { From 6cb09d3c28ee09166374a91e7fba8cad54864a16 Mon Sep 17 00:00:00 2001 From: Dragoljub Duric Date: Tue, 3 Dec 2024 21:00:53 +0000 Subject: [PATCH 13/21] Remove field from pocket-ic. --- packages/pocket-ic/src/management_canister.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/pocket-ic/src/management_canister.rs b/packages/pocket-ic/src/management_canister.rs index f31904e3b49..7ccc076fc31 100644 --- a/packages/pocket-ic/src/management_canister.rs +++ b/packages/pocket-ic/src/management_canister.rs @@ -28,7 +28,6 @@ pub struct DefiniteCanisterSettings { pub wasm_memory_limit: candid::Nat, pub memory_allocation: candid::Nat, pub compute_allocation: candid::Nat, - pub wasm_memory_threshold: candid::Nat, } #[derive(CandidType, Deserialize, Debug, Clone, Default)] From afb9f8cca6380e42c6d30c689bc92601c6ef2874 Mon Sep 17 00:00:00 2001 From: Dragoljub Duric Date: Tue, 3 Dec 2024 21:02:21 +0000 Subject: [PATCH 14/21] Remove field from pocket-ic 2. --- packages/pocket-ic/src/management_canister.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/pocket-ic/src/management_canister.rs b/packages/pocket-ic/src/management_canister.rs index 7ccc076fc31..1878e6728e2 100644 --- a/packages/pocket-ic/src/management_canister.rs +++ b/packages/pocket-ic/src/management_canister.rs @@ -39,7 +39,6 @@ pub struct CanisterSettings { pub wasm_memory_limit: Option, pub memory_allocation: Option, pub compute_allocation: Option, - pub wasm_memory_threshold: Option, } #[derive(CandidType, Deserialize, Debug, Clone)] From 2df4d7bf371a351a95328547a275b49d88ec6dc5 Mon Sep 17 00:00:00 2001 From: Dragoljub Duric Date: Wed, 4 Dec 2024 12:22:49 +0000 Subject: [PATCH 15/21] Revert changes on cross-chain side. --- rs/bitcoin/ckbtc/minter/ckbtc_minter.did | 1 - rs/ethereum/cketh/minter/cketh_minter.did | 1 - .../ledger-suite-orchestrator/ledger_suite_orchestrator.did | 1 - 3 files changed, 3 deletions(-) diff --git a/rs/bitcoin/ckbtc/minter/ckbtc_minter.did b/rs/bitcoin/ckbtc/minter/ckbtc_minter.did index 5464bd00a9d..e4ee40126e9 100644 --- a/rs/bitcoin/ckbtc/minter/ckbtc_minter.did +++ b/rs/bitcoin/ckbtc/minter/ckbtc_minter.did @@ -29,7 +29,6 @@ type DefiniteCanisterSettings = record { reserved_cycles_limit : nat; log_visibility: LogVisibility; wasm_memory_limit : nat; - wasm_memory_threshold : nat; }; type LogVisibility = variant { diff --git a/rs/ethereum/cketh/minter/cketh_minter.did b/rs/ethereum/cketh/minter/cketh_minter.did index d455b1bc3a7..2f938ae190f 100644 --- a/rs/ethereum/cketh/minter/cketh_minter.did +++ b/rs/ethereum/cketh/minter/cketh_minter.did @@ -28,7 +28,6 @@ type DefiniteCanisterSettings = record { reserved_cycles_limit : nat; log_visibility: LogVisibility; wasm_memory_limit : nat; - wasm_memory_threshold : nat; }; type LogVisibility = variant { diff --git a/rs/ethereum/ledger-suite-orchestrator/ledger_suite_orchestrator.did b/rs/ethereum/ledger-suite-orchestrator/ledger_suite_orchestrator.did index e87d6b3ec22..36df009afd0 100644 --- a/rs/ethereum/ledger-suite-orchestrator/ledger_suite_orchestrator.did +++ b/rs/ethereum/ledger-suite-orchestrator/ledger_suite_orchestrator.did @@ -227,7 +227,6 @@ type DefiniteCanisterSettings = record { reserved_cycles_limit : nat; log_visibility: LogVisibility; wasm_memory_limit : nat; - wasm_memory_threshold : nat; }; type LogVisibility = variant { From 50388ccd2e321cb02edd3f043828db754c5d6cde Mon Sep 17 00:00:00 2001 From: Dragoljub Djuric Date: Fri, 13 Dec 2024 16:14:23 +0100 Subject: [PATCH 16/21] Update update_canister_settings.rs Add comment. --- rs/nns/integration_tests/src/update_canister_settings.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/rs/nns/integration_tests/src/update_canister_settings.rs b/rs/nns/integration_tests/src/update_canister_settings.rs index 37d937e3152..5bb879388dc 100644 --- a/rs/nns/integration_tests/src/update_canister_settings.rs +++ b/rs/nns/integration_tests/src/update_canister_settings.rs @@ -36,6 +36,7 @@ fn test_update_canister_settings_proposal( let target_memory_allocation = 1u64 << 33; let target_compute_allocation = 10u64; let target_freezing_threshold = 100_000u64; + // `target_wasm_memory_limit` needs to be larger than `target_wasm_memory_threshold`. let target_wasm_memory_limit = 1u64 << 36; let target_wasm_memory_threshold = 1u64 << 34; let target_log_visibility = Some(LogVisibility::Public); From 547900e87c6e7d207752e5cc9f5602fbdd0ce0fd Mon Sep 17 00:00:00 2001 From: Andre Popovitch Date: Tue, 17 Dec 2024 11:52:50 -0600 Subject: [PATCH 17/21] Make field in DefiniteCanisterSettingsArgs optional --- rs/nervous_system/clients/src/canister_status.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rs/nervous_system/clients/src/canister_status.rs b/rs/nervous_system/clients/src/canister_status.rs index 34e5dce5949..1b95ee0692e 100644 --- a/rs/nervous_system/clients/src/canister_status.rs +++ b/rs/nervous_system/clients/src/canister_status.rs @@ -258,7 +258,7 @@ impl CanisterStatusResultV2 { memory_allocation, freezing_threshold, Some(wasm_memory_limit), - wasm_memory_threshold, + Some(wasm_memory_threshold), ), idle_cycles_burned_per_day: candid::Nat::from(idle_cycles_burned_per_day), } @@ -327,7 +327,7 @@ pub struct DefiniteCanisterSettingsArgs { pub memory_allocation: candid::Nat, pub freezing_threshold: candid::Nat, pub wasm_memory_limit: Option, - pub wasm_memory_threshold: candid::Nat, + pub wasm_memory_threshold: Option, } impl From @@ -340,7 +340,7 @@ impl From memory_allocation: settings.memory_allocation(), freezing_threshold: settings.freezing_threshold(), wasm_memory_limit: Some(settings.wasm_memory_limit()), - wasm_memory_threshold: settings.wasm_memory_threshold(), + wasm_memory_threshold: Some(settings.wasm_memory_threshold()), } } } @@ -352,7 +352,7 @@ impl DefiniteCanisterSettingsArgs { memory_allocation: Option, freezing_threshold: u64, wasm_memory_limit: Option, - wasm_memory_threshold: u64, + wasm_memory_threshold: Option, ) -> Self { let memory_allocation = match memory_allocation { None => candid::Nat::from(0_u32), @@ -364,7 +364,7 @@ impl DefiniteCanisterSettingsArgs { memory_allocation, freezing_threshold: candid::Nat::from(freezing_threshold), wasm_memory_limit: wasm_memory_limit.map(candid::Nat::from), - wasm_memory_threshold: candid::Nat::from(wasm_memory_threshold), + wasm_memory_threshold: wasm_memory_threshold.map(candid::Nat::from), } } @@ -396,7 +396,7 @@ impl From for CanisterStatusResultV2 memory_allocation: value.settings.memory_allocation, freezing_threshold: value.settings.freezing_threshold, wasm_memory_limit: Some(value.settings.wasm_memory_limit), - wasm_memory_threshold: value.settings.wasm_memory_threshold, + wasm_memory_threshold: Some(value.settings.wasm_memory_threshold), }, memory_size: value.memory_size, cycles: value.cycles, From ba94b5cf7c5309754897bf3cec6b099cf3307949 Mon Sep 17 00:00:00 2001 From: Dragoljub Djuric Date: Tue, 17 Dec 2024 19:01:22 +0100 Subject: [PATCH 18/21] Fix test after refactor --- rs/sns/swap/canister/tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rs/sns/swap/canister/tests.rs b/rs/sns/swap/canister/tests.rs index 866b954eebc..a968c631482 100644 --- a/rs/sns/swap/canister/tests.rs +++ b/rs/sns/swap/canister/tests.rs @@ -54,7 +54,7 @@ async fn test_get_canister_status() { memory_allocation: candid::Nat::from(0_u32), freezing_threshold: candid::Nat::from(0_u32), wasm_memory_limit: Some(candid::Nat::from(0_u32)), - wasm_memory_threshold: candid::Nat::from(0_u32), + wasm_memory_threshold: Some(candid::Nat::from(0_u32)), }, memory_size: candid::Nat::from(0_u32), cycles: candid::Nat::from(0_u32), From d3334f92d04d9ff5ebc9594d22855d525c52c657 Mon Sep 17 00:00:00 2001 From: Andre Popovitch Date: Tue, 17 Dec 2024 13:17:00 -0600 Subject: [PATCH 19/21] fix compilation errors --- .../src/manage_dapp_canister_settings.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rs/sns/integration_tests/src/manage_dapp_canister_settings.rs b/rs/sns/integration_tests/src/manage_dapp_canister_settings.rs index 1e8eaa9cf7d..6f667f5e141 100644 --- a/rs/sns/integration_tests/src/manage_dapp_canister_settings.rs +++ b/rs/sns/integration_tests/src/manage_dapp_canister_settings.rs @@ -106,7 +106,7 @@ fn test_manage_dapp_canister_settings_successful() { Some(1 << 30), 100_000, Some(1_000_000_000), - 0, + Some(0), ), ); @@ -159,7 +159,7 @@ fn test_manage_dapp_canister_settings_successful() { Some(0), 0, Some(2_000_000_000), - 0, + Some(0), ), ); } @@ -235,7 +235,7 @@ fn test_manage_dapp_canister_settings_failure() { Some(1 << 30), 100_000, Some(1_000_000_000), - 0, + Some(0), ), ); @@ -307,7 +307,7 @@ fn test_manage_dapp_canister_settings_failure() { Some(1 << 30), 100_000, Some(1_000_000_000), - 0, + Some(0), ), ); From 988af09eba28fdbf3b62f8873c28b74822694dd4 Mon Sep 17 00:00:00 2001 From: Andre Popovitch Date: Tue, 17 Dec 2024 17:23:49 -0600 Subject: [PATCH 20/21] Fix candid --- rs/sns/governance/canister/governance.did | 2 +- rs/sns/governance/canister/governance_test.did | 2 +- rs/sns/root/canister/root.did | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rs/sns/governance/canister/governance.did b/rs/sns/governance/canister/governance.did index be9f95be185..b379d8687eb 100644 --- a/rs/sns/governance/canister/governance.did +++ b/rs/sns/governance/canister/governance.did @@ -157,7 +157,7 @@ type DefiniteCanisterSettingsArgs = record { wasm_memory_limit : opt nat; memory_allocation : nat; compute_allocation : nat; - wasm_memory_threshold : nat; + wasm_memory_threshold : opt nat; }; type DeregisterDappCanisters = record { diff --git a/rs/sns/governance/canister/governance_test.did b/rs/sns/governance/canister/governance_test.did index 5deab9b24b7..4ba441aabda 100644 --- a/rs/sns/governance/canister/governance_test.did +++ b/rs/sns/governance/canister/governance_test.did @@ -166,7 +166,7 @@ type DefiniteCanisterSettingsArgs = record { wasm_memory_limit : opt nat; memory_allocation : nat; compute_allocation : nat; - wasm_memory_threshold : nat; + wasm_memory_threshold : opt nat; }; type DeregisterDappCanisters = record { diff --git a/rs/sns/root/canister/root.did b/rs/sns/root/canister/root.did index d86d2a0967b..bc3856b691d 100644 --- a/rs/sns/root/canister/root.did +++ b/rs/sns/root/canister/root.did @@ -70,7 +70,7 @@ type DefiniteCanisterSettingsArgs = record { wasm_memory_limit : opt nat; memory_allocation : nat; compute_allocation : nat; - wasm_memory_threshold : nat; + wasm_memory_threshold : opt nat; }; type FailedUpdate = record { From 69de4fb8019ba13f7363a48020f5952ec231e8f2 Mon Sep 17 00:00:00 2001 From: Arshavir Ter-Gabrielyan Date: Wed, 18 Dec 2024 11:46:46 +0100 Subject: [PATCH 21/21] Update rs/sns/swap/canister/swap.did --- rs/sns/swap/canister/swap.did | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rs/sns/swap/canister/swap.did b/rs/sns/swap/canister/swap.did index 240243acf17..2f1ab199496 100644 --- a/rs/sns/swap/canister/swap.did +++ b/rs/sns/swap/canister/swap.did @@ -53,7 +53,7 @@ type DefiniteCanisterSettingsArgs = record { wasm_memory_limit : opt nat; memory_allocation : nat; compute_allocation : nat; - wasm_memory_threshold : nat; + wasm_memory_threshold : opt nat; }; type DerivedState = record {