diff --git a/rs/config/src/execution_environment.rs b/rs/config/src/execution_environment.rs index e9defd7e6fa5..e3fc037766cd 100644 --- a/rs/config/src/execution_environment.rs +++ b/rs/config/src/execution_environment.rs @@ -170,6 +170,9 @@ pub const MAX_COMPILATION_CACHE_SIZE: NumBytes = NumBytes::new(10 * GIB); /// Maximum number of controllers allowed in a request (specified in the interface spec). pub const MAX_ALLOWED_CONTROLLERS_COUNT: usize = 10; +/// Default maximum number of canisters per subnet if not set in the registry. +pub const DEFAULT_MAX_NUMBER_OF_CANISTERS: u64 = 120_000; + /// Maximum number of canister snapshots that can be stored for a single canister. pub const MAX_NUMBER_OF_SNAPSHOTS_PER_CANISTER: usize = 10; diff --git a/rs/messaging/src/message_routing.rs b/rs/messaging/src/message_routing.rs index b7b8b7038433..dafc0cff895d 100644 --- a/rs/messaging/src/message_routing.rs +++ b/rs/messaging/src/message_routing.rs @@ -1,6 +1,8 @@ use crate::state_machine::{StateMachine, StateMachineImpl}; use crate::{routing, scheduling}; -use ic_config::execution_environment::{BitcoinConfig, Config as HypervisorConfig}; +use ic_config::execution_environment::{ + BitcoinConfig, Config as HypervisorConfig, DEFAULT_MAX_NUMBER_OF_CANISTERS, +}; use ic_config::message_routing::{MAX_STREAM_MESSAGES, TARGET_STREAM_SIZE_BYTES}; use ic_cycles_account_manager::CyclesAccountManager; use ic_interfaces::execution_environment::{ @@ -869,7 +871,11 @@ impl BatchProcessorImpl { let node_public_keys = self.try_to_populate_node_public_keys(&nodes, registry_version)?; let subnet_features = subnet_record.features.unwrap_or_default().into(); - let max_number_of_canisters = subnet_record.max_number_of_canisters; + let max_number_of_canisters = if subnet_record.max_number_of_canisters == 0 { + DEFAULT_MAX_NUMBER_OF_CANISTERS + } else { + subnet_record.max_number_of_canisters + }; let chain_key_settings = if let Some(chain_key_config) = subnet_record.chain_key_config { let chain_key_config = ChainKeyConfig::try_from(chain_key_config).map_err(|err| { diff --git a/rs/protobuf/def/registry/subnet/v1/subnet.proto b/rs/protobuf/def/registry/subnet/v1/subnet.proto index e6ece52f6f9d..ce4f08ad8783 100644 --- a/rs/protobuf/def/registry/subnet/v1/subnet.proto +++ b/rs/protobuf/def/registry/subnet/v1/subnet.proto @@ -49,8 +49,7 @@ message SubnetRecord { // The maximum number of canisters that may be present on the subnet at any given time. // - // A value of 0 is equivalent to setting no limit. This also provides an easy way - // to maintain compatibility of different versions of replica and registry. + // A value of 0 means that the replica's default value will be used. uint64 max_number_of_canisters = 24; // The list of public keys whose owners have "readonly" SSH access to all replicas on this subnet, diff --git a/rs/protobuf/src/gen/registry/registry.subnet.v1.rs b/rs/protobuf/src/gen/registry/registry.subnet.v1.rs index 8aa2537eb55f..eff5cf8b10a8 100644 --- a/rs/protobuf/src/gen/registry/registry.subnet.v1.rs +++ b/rs/protobuf/src/gen/registry/registry.subnet.v1.rs @@ -45,8 +45,7 @@ pub struct SubnetRecord { pub features: ::core::option::Option, /// The maximum number of canisters that may be present on the subnet at any given time. /// - /// A value of 0 is equivalent to setting no limit. This also provides an easy way - /// to maintain compatibility of different versions of replica and registry. + /// A value of 0 means that the replica's default value will be used. #[prost(uint64, tag = "24")] pub max_number_of_canisters: u64, /// The list of public keys whose owners have "readonly" SSH access to all replicas on this subnet, diff --git a/rs/protobuf/src/gen/state/registry.subnet.v1.rs b/rs/protobuf/src/gen/state/registry.subnet.v1.rs index acedbe31e77c..afb84c436db7 100644 --- a/rs/protobuf/src/gen/state/registry.subnet.v1.rs +++ b/rs/protobuf/src/gen/state/registry.subnet.v1.rs @@ -45,8 +45,7 @@ pub struct SubnetRecord { pub features: ::core::option::Option, /// The maximum number of canisters that may be present on the subnet at any given time. /// - /// A value of 0 is equivalent to setting no limit. This also provides an easy way - /// to maintain compatibility of different versions of replica and registry. + /// A value of 0 means that the replica's default value will be used. #[prost(uint64, tag = "24")] pub max_number_of_canisters: u64, /// The list of public keys whose owners have "readonly" SSH access to all replicas on this subnet, diff --git a/rs/protobuf/src/gen/types/registry.subnet.v1.rs b/rs/protobuf/src/gen/types/registry.subnet.v1.rs index acedbe31e77c..afb84c436db7 100644 --- a/rs/protobuf/src/gen/types/registry.subnet.v1.rs +++ b/rs/protobuf/src/gen/types/registry.subnet.v1.rs @@ -45,8 +45,7 @@ pub struct SubnetRecord { pub features: ::core::option::Option, /// The maximum number of canisters that may be present on the subnet at any given time. /// - /// A value of 0 is equivalent to setting no limit. This also provides an easy way - /// to maintain compatibility of different versions of replica and registry. + /// A value of 0 means that the replica's default value will be used. #[prost(uint64, tag = "24")] pub max_number_of_canisters: u64, /// The list of public keys whose owners have "readonly" SSH access to all replicas on this subnet,