From 2a6b1ddafc71dfde55afd70c4f6ecefb26b99c5c Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Mon, 29 Jul 2024 11:10:55 +0100 Subject: [PATCH] Fix empty `ic_root_key` (#6134) --- backend/canisters/user_index/CHANGELOG.md | 4 ++++ backend/canisters/user_index/impl/src/lib.rs | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/backend/canisters/user_index/CHANGELOG.md b/backend/canisters/user_index/CHANGELOG.md index d3aea3324f..8b85167a56 100644 --- a/backend/canisters/user_index/CHANGELOG.md +++ b/backend/canisters/user_index/CHANGELOG.md @@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Register the AirdropBot user ([#6129](https://github.com/open-chat-labs/open-chat/pull/6129)) +### Fixed + +- Fix empty `ic_root_key` ([#6134](https://github.com/open-chat-labs/open-chat/pull/6134)) + ## [[2.0.1258](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1258-user_index)] - 2024-07-26 ### Added diff --git a/backend/canisters/user_index/impl/src/lib.rs b/backend/canisters/user_index/impl/src/lib.rs index 3cd24dff50..63241c2e64 100644 --- a/backend/canisters/user_index/impl/src/lib.rs +++ b/backend/canisters/user_index/impl/src/lib.rs @@ -31,7 +31,7 @@ use types::{ }; use utils::canister::{CanistersRequiringUpgrade, FailedUpgradeCount}; use utils::canister_event_sync_queue::CanisterEventSyncQueue; -use utils::consts::DEV_TEAM_DFX_PRINCIPAL; +use utils::consts::{DEV_TEAM_DFX_PRINCIPAL, IC_ROOT_KEY}; use utils::env::Environment; use utils::time::{MonthKey, DAY_IN_MS}; @@ -318,10 +318,15 @@ struct Data { pub empty_users: HashSet, pub chit_leaderboard: ChitLeaderboard, pub deleted_users: Vec, + #[serde(with = "serde_bytes", skip_deserializing, default = "ic_root_key")] pub ic_root_key: Vec, pub identity_canister_user_sync_queue: VecDeque<(Principal, Option)>, } +fn ic_root_key() -> Vec { + IC_ROOT_KEY.to_vec() +} + fn init_airdrop_bot_canister_id() -> CanisterId { Principal::from_text("62rh2-kiaaa-aaaaf-bmy5q-cai").unwrap() }