From b927766543f371ee19abf0974f518791825be1d1 Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Thu, 18 Jul 2024 08:18:11 +0100 Subject: [PATCH] Update canisters post release (#6054) --- Cargo.lock | 1 - backend/canisters/group_index/CHANGELOG.md | 2 + backend/canisters/identity/CHANGELOG.md | 2 + .../canisters/local_user_index/CHANGELOG.md | 2 + backend/canisters/proposals_bot/CHANGELOG.md | 2 + .../impl/src/model/nervous_systems.rs | 1 - backend/canisters/user/CHANGELOG.md | 2 + backend/canisters/user_index/CHANGELOG.md | 2 + backend/canisters/user_index/impl/Cargo.toml | 1 - backend/canisters/user_index/impl/src/lib.rs | 2 - .../impl/src/lifecycle/post_upgrade.rs | 50 +------------------ 11 files changed, 13 insertions(+), 54 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f71e0c3230..789ac26ae9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8833,7 +8833,6 @@ dependencies = [ "stable_memory", "storage_index_canister", "storage_index_canister_c2c_client", - "test-case", "testing", "time", "tracing", diff --git a/backend/canisters/group_index/CHANGELOG.md b/backend/canisters/group_index/CHANGELOG.md index a983ed3574..855b1ed6fe 100644 --- a/backend/canisters/group_index/CHANGELOG.md +++ b/backend/canisters/group_index/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [unreleased] +## [[2.0.1240](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1240-group_index)] - 2024-07-17 + ### Fixed - Handle `mark_local_group_index_full` in `inspect_message` ([#6010](https://github.com/open-chat-labs/open-chat/pull/6010)) diff --git a/backend/canisters/identity/CHANGELOG.md b/backend/canisters/identity/CHANGELOG.md index 1cced95c5a..c204b27c56 100644 --- a/backend/canisters/identity/CHANGELOG.md +++ b/backend/canisters/identity/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [unreleased] +## [[2.0.1239](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1239-identity)] - 2024-07-17 + ### Added - Sync userIds to Identity canister ([#6027](https://github.com/open-chat-labs/open-chat/pull/6027)) diff --git a/backend/canisters/local_user_index/CHANGELOG.md b/backend/canisters/local_user_index/CHANGELOG.md index b9b2cae2f5..11b9bd0927 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.1241](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1241-local_user_index)] - 2024-07-17 + ### Added - Support gates with multiple verifiable credentials ([#6029](https://github.com/open-chat-labs/open-chat/pull/6029)) diff --git a/backend/canisters/proposals_bot/CHANGELOG.md b/backend/canisters/proposals_bot/CHANGELOG.md index f0e4b9d371..72393df5ec 100644 --- a/backend/canisters/proposals_bot/CHANGELOG.md +++ b/backend/canisters/proposals_bot/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [unreleased] +## [[2.0.1237](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1237-proposals_bot)] - 2024-07-16 + ### Added - Add `lookup_proposal_message` ([#6031](https://github.com/open-chat-labs/open-chat/pull/6031)) diff --git a/backend/canisters/proposals_bot/impl/src/model/nervous_systems.rs b/backend/canisters/proposals_bot/impl/src/model/nervous_systems.rs index 707b2dc832..4e8087fa6b 100644 --- a/backend/canisters/proposals_bot/impl/src/model/nervous_systems.rs +++ b/backend/canisters/proposals_bot/impl/src/model/nervous_systems.rs @@ -330,7 +330,6 @@ pub struct NervousSystem { min_neuron_stake: u64, min_dissolve_delay_to_vote: Milliseconds, proposal_rejection_fee: u64, - #[serde(default)] proposal_messages: BTreeMap, } diff --git a/backend/canisters/user/CHANGELOG.md b/backend/canisters/user/CHANGELOG.md index d613e8bfe2..368974384c 100644 --- a/backend/canisters/user/CHANGELOG.md +++ b/backend/canisters/user/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [unreleased] +## [[2.0.1243](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1243-user)] - 2024-07-17 + ### Changed - Added lots more achievements to enum ([#6020](https://github.com/open-chat-labs/open-chat/pull/6020)) diff --git a/backend/canisters/user_index/CHANGELOG.md b/backend/canisters/user_index/CHANGELOG.md index 8f8d8756ac..9aaac50c8e 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.1242](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1242-user_index)] - 2024-07-17 + ### Added - Sync userIds to Identity canister ([#6027](https://github.com/open-chat-labs/open-chat/pull/6027)) diff --git a/backend/canisters/user_index/impl/Cargo.toml b/backend/canisters/user_index/impl/Cargo.toml index a76abd0e2a..12b1dd0118 100644 --- a/backend/canisters/user_index/impl/Cargo.toml +++ b/backend/canisters/user_index/impl/Cargo.toml @@ -57,7 +57,6 @@ sha2 = { workspace = true } stable_memory = { path = "../../../libraries/stable_memory" } storage_index_canister = { path = "../../storage_index/api" } storage_index_canister_c2c_client = { path = "../../storage_index/c2c_client" } -test-case = { workspace = true } testing = { path = "../../../libraries/testing" } time = { workspace = true } tracing = { workspace = true } diff --git a/backend/canisters/user_index/impl/src/lib.rs b/backend/canisters/user_index/impl/src/lib.rs index adfaab37ef..1f74259c69 100644 --- a/backend/canisters/user_index/impl/src/lib.rs +++ b/backend/canisters/user_index/impl/src/lib.rs @@ -312,9 +312,7 @@ struct Data { pub empty_users: HashSet, pub chit_leaderboard: ChitLeaderboard, pub deleted_users: Vec, - #[serde(default)] pub ic_root_key: Vec, - #[serde(default)] pub identity_canister_user_sync_queue: VecDeque<(Principal, Option)>, } 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 214c010a52..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,13 +1,11 @@ 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 stable_memory::get_reader; -use test_case::test_case; use tracing::info; -use types::CanisterId; use user_index_canister::post_upgrade::Args; use utils::cycles::init_cycles_dispenser_client; @@ -26,50 +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| { - for user in state.data.users.iter() { - state - .data - .identity_canister_user_sync_queue - .push_back((user.principal, Some(user.user_id))); - } - crate::jobs::sync_users_to_identity_canister::start_job_if_required(state); - - for canister_id in state.data.deleted_users.iter().map(|u| CanisterId::from(u.user_id)) { - let local_user_index = local_user_index_canister(canister_id, state.data.test_mode); - let event = local_user_index_canister::Event::AddCanisterToPool(canister_id); - state.data.user_index_event_sync_queue.push(local_user_index, event); - } - crate::jobs::sync_events_to_local_user_index_canisters::start_job_if_required(state); - }) -} - -fn local_user_index_canister(canister_id: CanisterId, test_mode: bool) -> CanisterId { - let bytes = canister_id.as_slice(); - if bytes > [0, 0, 0, 0, 2, 32, 0, 0, 1, 1].as_slice() && bytes < [0, 0, 0, 0, 2, 48, 0, 0, 1, 1].as_slice() { - return CanisterId::from_text("aboy3-giaaa-aaaar-aaaaq-cai").unwrap(); - } - if bytes > [0, 0, 0, 0, 0, 160, 0, 0, 1, 1].as_slice() && bytes < [0, 0, 0, 0, 0, 176, 0, 0, 1, 1].as_slice() { - return if test_mode { - CanisterId::from_text("pecvb-tqaaa-aaaaf-bhdiq-cai").unwrap() - } else { - CanisterId::from_text("nq4qv-wqaaa-aaaaf-bhdgq-cai").unwrap() - }; - } - - assert!(test_mode); - // This will only be reached during tests + local development - CanisterId::from_text("be2us-64aaa-aaaaa-qaabq-cai").unwrap() -} - -#[test_case("foyjw-giaaa-aaaaf-big5a-cai", true, "pecvb-tqaaa-aaaaf-bhdiq-cai")] -#[test_case("x2jhd-2yaaa-aaaaf-bif6a-cai", true, "pecvb-tqaaa-aaaaf-bhdiq-cai")] -#[test_case("ueepn-qiaaa-aaaar-ampla-cai", false, "aboy3-giaaa-aaaar-aaaaq-cai")] -#[test_case("nfjlt-kaaaa-aaaar-axpxq-cai", false, "aboy3-giaaa-aaaar-aaaaq-cai")] -#[test_case("7msbr-laaaa-aaaaf-ayvuq-cai", false, "nq4qv-wqaaa-aaaaf-bhdgq-cai")] -#[test_case("2cpmn-myaaa-aaaaf-ayvia-cai", false, "nq4qv-wqaaa-aaaaf-bhdgq-cai")] -fn local_user_index_canister_tests(canister_id: &str, test_mode: bool, expected: &str) { - let result = local_user_index_canister(CanisterId::from_text(canister_id).unwrap(), test_mode); - assert_eq!(result.to_text(), expected); }