diff --git a/backend/canisters/local_user_index/CHANGELOG.md b/backend/canisters/local_user_index/CHANGELOG.md index 550e9f9e53..d213dbfe40 100644 --- a/backend/canisters/local_user_index/CHANGELOG.md +++ b/backend/canisters/local_user_index/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [unreleased] +## [[2.0.1281](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1281-local_user_index)] - 2024-08-02 + ### Changed - Remove canister which holds some tokens from the canister pool ([#6188](https://github.com/open-chat-labs/open-chat/pull/6188)) diff --git a/backend/canisters/local_user_index/impl/src/lifecycle/post_upgrade.rs b/backend/canisters/local_user_index/impl/src/lifecycle/post_upgrade.rs index c736fc09f6..1529c2593a 100644 --- a/backend/canisters/local_user_index/impl/src/lifecycle/post_upgrade.rs +++ b/backend/canisters/local_user_index/impl/src/lifecycle/post_upgrade.rs @@ -1,13 +1,12 @@ use crate::lifecycle::{init_env, init_state}; use crate::memory::get_upgrades_memory; -use crate::{mutate_state, Data}; +use crate::Data; use canister_logger::LogEntry; use canister_tracing_macros::trace; use ic_cdk::post_upgrade; use local_user_index_canister::post_upgrade::Args; use stable_memory::get_reader; use tracing::info; -use types::CanisterId; use utils::cycles::init_cycles_dispenser_client; #[post_upgrade] @@ -25,11 +24,4 @@ fn post_upgrade(args: Args) { init_state(env, data, args.wasm_version); info!(version = %args.wasm_version, "Post-upgrade complete"); - - mutate_state(|state| { - state - .data - .canister_pool - .remove(&CanisterId::from_text("plfbt-7aaaa-aaaar-a3dga-cai").unwrap()) - }); } diff --git a/backend/canisters/online_users/CHANGELOG.md b/backend/canisters/online_users/CHANGELOG.md index 514d87ef2e..7e3c3cd8d9 100644 --- a/backend/canisters/online_users/CHANGELOG.md +++ b/backend/canisters/online_users/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [unreleased] +## [[2.0.1283](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1283-online_users)] - 2024-08-02 + ### Added - Added `c2c_remove_user` to be called by the UserIndex ([#6179](https://github.com/open-chat-labs/open-chat/pull/6179)) diff --git a/backend/canisters/online_users/impl/src/lifecycle/post_upgrade.rs b/backend/canisters/online_users/impl/src/lifecycle/post_upgrade.rs index a434762fb0..7ba1c36fda 100644 --- a/backend/canisters/online_users/impl/src/lifecycle/post_upgrade.rs +++ b/backend/canisters/online_users/impl/src/lifecycle/post_upgrade.rs @@ -1,6 +1,6 @@ use crate::lifecycle::{init_env, init_state}; use crate::memory::get_upgrades_memory; -use crate::{mutate_state, Data}; +use crate::Data; use canister_logger::LogEntry; use canister_tracing_macros::trace; use ic_cdk::post_upgrade; @@ -24,7 +24,4 @@ fn post_upgrade(args: Args) { init_state(env, data, args.wasm_version); info!(version = %args.wasm_version, "Post-upgrade complete"); - - // TODO remove this after upgrade - mutate_state(|state| state.data.principal_to_user_id_map.clear()); } diff --git a/backend/canisters/online_users/impl/src/model/principal_to_user_id_map.rs b/backend/canisters/online_users/impl/src/model/principal_to_user_id_map.rs index ac3b13fe16..8ca331ceeb 100644 --- a/backend/canisters/online_users/impl/src/model/principal_to_user_id_map.rs +++ b/backend/canisters/online_users/impl/src/model/principal_to_user_id_map.rs @@ -22,10 +22,6 @@ impl PrincipalToUserIdMap { pub fn remove(&mut self, principal: &Principal) -> Option { self.map.remove(principal).map(|u| u.into()) } - - pub fn clear(&mut self) { - self.map.clear_new() - } } fn init_map() -> StableBTreeMap { diff --git a/backend/canisters/user_index/CHANGELOG.md b/backend/canisters/user_index/CHANGELOG.md index 75c6688bac..29dccba019 100644 --- a/backend/canisters/user_index/CHANGELOG.md +++ b/backend/canisters/user_index/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [unreleased] +## [[2.0.1280](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1280-user_index)] - 2024-08-02 + ### Added - Remove deleted users from OnlineUsers canister ([#6179](https://github.com/open-chat-labs/open-chat/pull/6179)) diff --git a/backend/canisters/user_index/impl/src/lib.rs b/backend/canisters/user_index/impl/src/lib.rs index a78974d9a6..f4e79933fb 100644 --- a/backend/canisters/user_index/impl/src/lib.rs +++ b/backend/canisters/user_index/impl/src/lib.rs @@ -289,7 +289,6 @@ struct Data { pub identity_canister_id: CanisterId, pub proposals_bot_canister_id: CanisterId, pub airdrop_bot_canister_id: CanisterId, - #[serde(default = "online_users_canister_id")] pub online_users_canister_id: CanisterId, pub canisters_requiring_upgrade: CanistersRequiringUpgrade, pub total_cycles_spent_on_canisters: Cycles, @@ -327,14 +326,9 @@ struct Data { #[serde(with = "serde_bytes")] pub ic_root_key: Vec, pub identity_canister_user_sync_queue: VecDeque<(Principal, Option)>, - #[serde(default)] pub remove_from_online_users_queue: VecDeque, } -fn online_users_canister_id() -> CanisterId { - CanisterId::from_text("3vlw6-fiaaa-aaaaf-aaa3a-cai").unwrap() -} - impl Data { #[allow(clippy::too_many_arguments)] pub fn new( diff --git a/backend/canisters/user_index/impl/src/lifecycle/post_upgrade.rs b/backend/canisters/user_index/impl/src/lifecycle/post_upgrade.rs index a34768993c..c163dddb67 100644 --- a/backend/canisters/user_index/impl/src/lifecycle/post_upgrade.rs +++ b/backend/canisters/user_index/impl/src/lifecycle/post_upgrade.rs @@ -1,10 +1,9 @@ use crate::lifecycle::{init_env, init_state}; use crate::memory::get_upgrades_memory; -use crate::{mutate_state, Data}; +use crate::Data; use canister_logger::LogEntry; use canister_tracing_macros::trace; use ic_cdk::post_upgrade; -use ic_ledger_types::{AccountIdentifier, DEFAULT_SUBACCOUNT}; use stable_memory::get_reader; use tracing::info; use user_index_canister::post_upgrade::Args; @@ -25,23 +24,4 @@ fn post_upgrade(args: Args) { init_state(env, data, args.wasm_version); info!(version = %args.wasm_version, "Post-upgrade complete"); - - mutate_state(|state| { - let account_id = - AccountIdentifier::from_hex("0d8b25153f3450c024a30694e8834d199387a9d9a0f2641d053719cc6068223c").unwrap(); - - for user in state.data.deleted_users.iter() { - if AccountIdentifier::new(&user.user_id.into(), &DEFAULT_SUBACCOUNT) == account_id { - info!("Found match: {}", user.user_id); - break; - } - } - - for user in state.data.users.iter() { - state - .data - .chit_leaderboard - .update_position(user.user_id, user.total_chit_earned()); - } - }); }