Skip to content

Commit

Permalink
Update canisters post release (#5654)
Browse files Browse the repository at this point in the history
  • Loading branch information
hpeebles authored Apr 9, 2024
1 parent ead83cd commit a60e031
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 36 deletions.
2 changes: 2 additions & 0 deletions backend/canisters/identity/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

## [[2.0.1133](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1133-identity)] - 2024-04-09

### Changed

- Re-sync principals to Identity canister but excluding bot users ([#5650](https://github.com/open-chat-labs/open-chat/pull/5650))
Expand Down
1 change: 0 additions & 1 deletion backend/canisters/identity/impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ struct Data {
cycles_dispenser_canister_id: CanisterId,
internet_identity_canister_id: CanisterId,
user_principals: UserPrincipals,
#[serde(skip_deserializing)]
legacy_principals: HashSet<Principal>,
#[serde(skip)]
signature_map: SignatureMap,
Expand Down
2 changes: 2 additions & 0 deletions backend/canisters/user_index/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

## [[2.0.1134](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1134-user_index)] - 2024-04-09

### Changed

- Log error if any users have duplicate usernames or principals ([#5645](https://github.com/open-chat-labs/open-chat/pull/5645))
Expand Down
37 changes: 2 additions & 35 deletions backend/canisters/user_index/impl/src/lifecycle/post_upgrade.rs
Original file line number Diff line number Diff line change
@@ -1,11 +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_macros::post_upgrade;
use stable_memory::get_reader;
use tracing::{error, info};
use tracing::info;
use user_index_canister::post_upgrade::Args;
use utils::cycles::init_cycles_dispenser_client;

Expand All @@ -24,37 +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 users_with_duplicate_usernames: Vec<_> = state
.data
.users
.users_with_duplicate_usernames
.iter()
.map(|(u1, u2)| (u1.to_string(), u2.to_string()))
.collect();

let users_with_duplicate_principals: Vec<_> = state
.data
.users
.users_with_duplicate_principals
.iter()
.map(|(u1, u2)| (u1.to_string(), u2.to_string()))
.collect();

if !users_with_duplicate_usernames.is_empty() {
error!(?users_with_duplicate_usernames);
}

if !users_with_duplicate_principals.is_empty() {
error!(?users_with_duplicate_principals);
}

state
.data
.legacy_principals_sync_queue
.extend(state.data.users.iter().filter(|u| !u.is_bot).map(|u| u.principal));

crate::jobs::sync_legacy_user_principals::start_job_if_required(state);
})
}

0 comments on commit a60e031

Please sign in to comment.