fn generate_new_canister_id(
        &self,
        state: &mut ReplicatedState,
    ) -> Result<CanisterId, CanisterManagerError> {
        let canister_id_ranges = state
            .metadata
            .network_topology
            .routing_table
            .ranges(self.config.own_subnet_id);
        if state.metadata.generated_id_counter as u128 >= canister_id_ranges.total_count() {
            error!(
                self.log,
                "Subnet is full.  Total allowed is {} and generated_count is {}",
                canister_id_ranges.total_count(),
                state.metadata.generated_id_counter
            );
            return Err(CanisterManagerError::SubnetOutOfCanisterIds {
                allowed: canister_id_ranges.total_count(),
            });
        }
        let canister_id = canister_id_ranges.locate(state.metadata.generated_id_counter);
        state.metadata.generated_id_counter += 1;
        Ok(canister_id)
    }
// WARNING!!! If you change the logic here, please ensure that the sequence
// of NNS canister ids as defined in nns/constants/src/constants.rs are also
// updated.
WARNING!!. If you change the logic here, please ensure that the sequence
of NNS canister ids as defined in nns/constants/src/constants.rs are also
updated.
WARNING!! . If you change the logic here please ensure that the sequence of NNS canister ids as defined in nns / constants / src / constants . rs are also updated .
fn generate_new_canister_id(
        &self,
        state: &mut ReplicatedState,
    ) -> Result<CanisterId, CanisterManagerError> {
        let canister_id_ranges = state
            .metadata
            .network_topology
            .routing_table
            .ranges(self.config.own_subnet_id);
        if state.metadata.generated_id_counter as u128 >= canister_id_ranges.total_count() {
            error!(
                self.log,
                "Subnet is full.  Total allowed is {} and generated_count is {}",
                canister_id_ranges.total_count(),
                state.metadata.generated_id_counter
            );
            return Err(CanisterManagerError::SubnetOutOfCanisterIds {
                allowed: canister_id_ranges.total_count(),
            });
        }
        let canister_id = canister_id_ranges.locate(state.metadata.generated_id_counter);
        state.metadata.generated_id_counter += 1;
        Ok(canister_id)
    }
fn generate_new_canister_id ( & self , state : & mut ReplicatedState , ) -> Result < CanisterId , CanisterManagerError > { let canister_id_ranges = state . metadata . network_topology . routing_table . ranges ( self . config . own_subnet_id ) ; if state . metadata . generated_id_counter as u128 >= canister_id_ranges . total_count ( ) { error ! ( self log " " canister_id_ranges total_count ( ) state metadata generated_id_counter ) ; return Err ( CanisterManagerError :: SubnetOutOfCanisterIds { allowed : canister_id_ranges . total_count ( ) , } ) ; } let canister_id = canister_id_ranges . locate ( state . metadata . generated_id_counter ) ; state . metadata . generated_id_counter += 1 ; Ok ( canister_id ) }
WARNING!!!
WARNING!!!
&self
state
&mut ReplicatedState
&self
state
&mut ReplicatedState