Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update canisters post release #7087

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions backend/canisters/cycles_dispenser/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

## [[2.0.1527](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1527-cycles_dispenser)] - 2024-12-19

### Changed

- Allow Registry to add additional canisters to the allow list ([#7072](https://github.com/open-chat-labs/open-chat/pull/7072))
Expand Down
1 change: 0 additions & 1 deletion backend/canisters/cycles_dispenser/impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ impl State {
struct Data {
pub governance_principals: HashSet<Principal>,
pub canisters: Canisters,
#[serde(default = "CanisterId::anonymous")]
pub registry_canister_id: CanisterId,
pub sns_root_canister: Option<CanisterId>,
pub max_top_up_amount: Cycles,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,16 @@ use cycles_dispenser_canister::post_upgrade::Args;
use ic_cdk::post_upgrade;
use stable_memory::get_reader;
use tracing::info;
use types::CanisterId;

#[post_upgrade]
#[trace]
fn post_upgrade(args: Args) {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);

let (mut data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) =
let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) =
msgpack::deserialize(reader).unwrap();

if data.test_mode {
data.registry_canister_id = CanisterId::from_text("cglwi-oaaaa-aaaar-aqw4q-cai").unwrap();
} else {
data.registry_canister_id = CanisterId::from_text("cpi5u-yiaaa-aaaar-aqw5a-cai").unwrap();
}

canister_logger::init_with_logs(data.test_mode, errors, logs, traces);

let env = init_env(data.rng_seed);
Expand Down
2 changes: 2 additions & 0 deletions backend/canisters/escrow/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

## [[2.0.1526](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1526-escrow)] - 2024-12-19

### Changed

- Disallow P2P swaps of disabled tokens ([#7057](https://github.com/open-chat-labs/open-chat/pull/7057))
Expand Down
2 changes: 0 additions & 2 deletions backend/canisters/escrow/impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,8 @@ struct Data {
pub pending_payments_queue: PendingPaymentsQueue,
pub notify_status_change_queue: NotifyStatusChangeQueue,
timer_jobs: TimerJobs<TimerJob>,
#[serde(default = "CanisterId::anonymous")]
pub registry_canister_id: CanisterId,
pub cycles_dispenser_canister_id: CanisterId,
#[serde(default)]
pub disabled_tokens: BTreeSet<CanisterId>,
pub rng_seed: [u8; 32],
pub test_mode: bool,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use escrow_canister::post_upgrade::Args;
use ic_cdk::post_upgrade;
use stable_memory::get_reader;
use tracing::info;
use types::CanisterId;
use utils::cycles::init_cycles_dispenser_client;

#[post_upgrade]
Expand All @@ -16,15 +15,9 @@ fn post_upgrade(args: Args) {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);

let (mut data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) =
let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) =
msgpack::deserialize(reader).unwrap();

if data.test_mode {
data.registry_canister_id = CanisterId::from_text("cglwi-oaaaa-aaaar-aqw4q-cai").unwrap();
} else {
data.registry_canister_id = CanisterId::from_text("cpi5u-yiaaa-aaaar-aqw5a-cai").unwrap();
}

canister_logger::init_with_logs(data.test_mode, errors, logs, traces);

let env = init_env(data.rng_seed);
Expand Down
2 changes: 2 additions & 0 deletions backend/canisters/event_relay/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

## [[2.0.1525](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1525-event_relay)] - 2024-12-19

### Added

- Add an error log with http endpoint ([#6608](https://github.com/open-chat-labs/open-chat/pull/6608))
Expand Down
1 change: 0 additions & 1 deletion backend/canisters/event_relay/impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ struct Data {
pub event_store_client: EventStoreClient<CdkRuntime>,
pub event_deduper: EventDeduper,
pub cycles_dispenser_canister_id: CanisterId,
#[serde(default = "CanisterId::anonymous")]
pub registry_canister_id: CanisterId,
pub chat_ledger_canister_id: CanisterId,
pub chat_governance_canister_id: CanisterId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use event_relay_canister::post_upgrade::Args;
use ic_cdk::post_upgrade;
use stable_memory::get_reader;
use tracing::info;
use types::CanisterId;
use utils::cycles::init_cycles_dispenser_client;

#[post_upgrade]
Expand All @@ -16,17 +15,10 @@ fn post_upgrade(args: Args) {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);

let (mut data, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) =
msgpack::deserialize(reader).unwrap();

if data.test_mode {
data.registry_canister_id = CanisterId::from_text("cglwi-oaaaa-aaaar-aqw4q-cai").unwrap();
} else {
data.registry_canister_id = CanisterId::from_text("cpi5u-yiaaa-aaaar-aqw5a-cai").unwrap();
}

// TODO: After release change this to
// let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) = msgpack::deserialize(reader).unwrap();
canister_logger::init_with_logs(data.test_mode, Vec::new(), logs, traces);
canister_logger::init_with_logs(data.test_mode, errors, logs, traces);

let env = init_env(data.rng_seed);
init_cycles_dispenser_client(data.cycles_dispenser_canister_id, data.test_mode);
Expand Down
2 changes: 2 additions & 0 deletions backend/canisters/group_index/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

## [[2.0.1519](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1519-group_index)] - 2024-12-19

### Changed

- Allow Registry to add additional LocalGroupIndexes ([#7072](https://github.com/open-chat-labs/open-chat/pull/7072))
Expand Down
1 change: 0 additions & 1 deletion backend/canisters/group_index/impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ struct Data {
pub proposals_bot_user_id: UserId,
pub escrow_canister_id: CanisterId,
pub event_relay_canister_id: CanisterId,
#[serde(default = "CanisterId::anonymous")]
pub registry_canister_id: CanisterId,
pub internet_identity_canister_id: CanisterId,
pub canisters_requiring_upgrade: CanistersRequiringUpgrade,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use group_index_canister::post_upgrade::Args;
use ic_cdk::post_upgrade;
use stable_memory::get_reader;
use tracing::info;
use types::CanisterId;
use utils::cycles::init_cycles_dispenser_client;

#[post_upgrade]
Expand All @@ -16,15 +15,9 @@ fn post_upgrade(args: Args) {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);

let (mut data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) =
let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) =
msgpack::deserialize(reader).unwrap();

if data.test_mode {
data.registry_canister_id = CanisterId::from_text("cglwi-oaaaa-aaaar-aqw4q-cai").unwrap();
} else {
data.registry_canister_id = CanisterId::from_text("cpi5u-yiaaa-aaaar-aqw5a-cai").unwrap();
}

canister_logger::init_with_logs(data.test_mode, errors, logs, traces);

let env = init_env(data.rng_seed);
Expand Down
2 changes: 2 additions & 0 deletions backend/canisters/local_group_index/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

## [[2.0.1531](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1531-local_group_index)] - 2024-12-19

### Changed

- Handle installing large wasms onto new subnets ([#7078](https://github.com/open-chat-labs/open-chat/pull/7078))
Expand Down
2 changes: 2 additions & 0 deletions backend/canisters/local_user_index/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

## [[2.0.1530](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1530-local_user_index)] - 2024-12-19

### Added

- Implement streak insurance ([#7036](https://github.com/open-chat-labs/open-chat/pull/7036))
Expand Down
2 changes: 2 additions & 0 deletions backend/canisters/neuron_controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

## [[2.0.1523](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1523-neuron_controller)] - 2024-12-19

### Changed

- Expose size of each virtual stable memory in metrics ([#6981](https://github.com/open-chat-labs/open-chat/pull/6981))
Expand Down
2 changes: 2 additions & 0 deletions backend/canisters/notifications_index/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

## [[2.0.1529](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1529-notifications_index)] - 2024-12-19

### Changed

- Allow Registry to add additional Notifications canisters ([#7072](https://github.com/open-chat-labs/open-chat/pull/7072))
Expand Down
1 change: 0 additions & 1 deletion backend/canisters/notifications_index/impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ struct Data {
pub push_service_principals: HashSet<Principal>,
pub user_index_canister_id: CanisterId,
pub cycles_dispenser_canister_id: CanisterId,
#[serde(default = "CanisterId::anonymous")]
pub registry_canister_id: CanisterId,
pub principal_to_user_id_map: PrincipalToUserIdMap,
pub subscriptions: Subscriptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use ic_cdk::post_upgrade;
use notifications_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]
Expand All @@ -18,15 +17,9 @@ fn post_upgrade(args: Args) {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);

let (mut data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) =
let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) =
msgpack::deserialize(reader).unwrap();

if data.test_mode {
data.registry_canister_id = CanisterId::from_text("cglwi-oaaaa-aaaar-aqw4q-cai").unwrap();
} else {
data.registry_canister_id = CanisterId::from_text("cpi5u-yiaaa-aaaar-aqw5a-cai").unwrap();
}

canister_logger::init_with_logs(data.test_mode, errors, logs, traces);

let env = init_env(data.rng_seed);
Expand Down
2 changes: 2 additions & 0 deletions backend/canisters/proposals_bot/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

## [[2.0.1534](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1534-proposals_bot)] - 2024-12-19

### Changed

- Generate 64bit message Ids ([#6978](https://github.com/open-chat-labs/open-chat/pull/6978))
Expand Down
2 changes: 2 additions & 0 deletions backend/canisters/registry/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

## [[2.0.1524](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1524-registry)] - 2024-12-19

### Added

- Implement ability to expand onto additional subnets ([#7072](https://github.com/open-chat-labs/open-chat/pull/7072))
Expand Down
8 changes: 0 additions & 8 deletions backend/canisters/registry/impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,13 @@ struct Data {
governance_principals: HashSet<Principal>,
proposals_bot_canister_id: CanisterId,
user_index_canister_id: CanisterId,
#[serde(default = "CanisterId::anonymous")]
group_index_canister_id: CanisterId,
#[serde(default = "CanisterId::anonymous")]
notifications_index_canister_id: CanisterId,
#[serde(default = "CanisterId::anonymous")]
event_relay_canister_id: CanisterId,
sns_wasm_canister_id: CanisterId,
#[serde(default = "CanisterId::anonymous")]
escrow_canister_id: CanisterId,
cycles_dispenser_canister_id: CanisterId,
#[serde(default = "CanisterId::anonymous")]
icp_ledger_canister_id: CanisterId,
#[serde(default = "CanisterId::anonymous")]
cycles_minting_canister_id: CanisterId,
tokens: Tokens,
nervous_systems: NervousSystems,
Expand All @@ -109,9 +103,7 @@ struct Data {
total_supply: Timestamped<u128>,
circulating_supply: Timestamped<u128>,
airdrop_config: Timestamped<Option<AirdropConfig>>,
#[serde(default)]
subnets: Subnets,
#[serde(default)]
timer_jobs: TimerJobs<TimerJob>,
rng_seed: [u8; 32],
test_mode: bool,
Expand Down
71 changes: 2 additions & 69 deletions backend/canisters/registry/impl/src/lifecycle/post_upgrade.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
use crate::lifecycle::{init_env, init_state};
use crate::memory::get_upgrades_memory;
use crate::{read_state, Data};
use candid::Principal;
use crate::Data;
use canister_logger::LogEntry;
use canister_tracing_macros::trace;
use ic_cdk::post_upgrade;
use registry_canister::post_upgrade::Args;
use registry_canister::subnets::Subnet;
use stable_memory::get_reader;
use std::time::Duration;
use tracing::info;
use types::CanisterId;
use utils::cycles::init_cycles_dispenser_client;

#[post_upgrade]
Expand All @@ -19,77 +15,14 @@ fn post_upgrade(args: Args) {
let memory = get_upgrades_memory();
let reader = get_reader(&memory);

let (mut data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) =
let (data, errors, logs, traces): (Data, Vec<LogEntry>, Vec<LogEntry>, Vec<LogEntry>) =
msgpack::deserialize(reader).unwrap();

if data.test_mode {
data.group_index_canister_id = CanisterId::from_text("7kifq-3yaaa-aaaaf-ab2cq-cai").unwrap();
data.notifications_index_canister_id = CanisterId::from_text("4glvk-ryaaa-aaaaf-aaaia-cai").unwrap();
data.event_relay_canister_id = CanisterId::from_text("6jejw-xyaaa-aaaaf-biiba-cai").unwrap();
data.escrow_canister_id = CanisterId::from_text("tspqt-xaaaa-aaaal-qcnna-cai").unwrap();

data.subnets.subnets.push(Subnet {
subnet_id: Principal::from_text("eq6en-6jqla-fbu5s-daskr-h6hx2-376n5-iqabl-qgrng-gfqmv-n3yjr-mqe").unwrap(),
local_user_index: CanisterId::from_text("pecvb-tqaaa-aaaaf-bhdiq-cai").unwrap(),
local_group_index: CanisterId::from_text("sbhuw-gyaaa-aaaaf-bfynq-cai").unwrap(),
notifications_canister: CanisterId::from_text("dhcdh-fqaaa-aaaaf-adnmq-cai").unwrap(),
});
} else {
data.group_index_canister_id = CanisterId::from_text("4ijyc-kiaaa-aaaaf-aaaja-cai").unwrap();
data.notifications_index_canister_id = CanisterId::from_text("7ekiy-aiaaa-aaaaf-ab2dq-cai").unwrap();
data.event_relay_canister_id = CanisterId::from_text("6ofpc-2aaaa-aaaaf-biibq-cai").unwrap();
data.escrow_canister_id = CanisterId::from_text("s4yi7-yiaaa-aaaar-qacpq-cai").unwrap();

data.subnets.subnets.push(Subnet {
subnet_id: Principal::from_text("eq6en-6jqla-fbu5s-daskr-h6hx2-376n5-iqabl-qgrng-gfqmv-n3yjr-mqe").unwrap(),
local_user_index: CanisterId::from_text("nq4qv-wqaaa-aaaaf-bhdgq-cai").unwrap(),
local_group_index: CanisterId::from_text("suaf3-hqaaa-aaaaf-bfyoa-cai").unwrap(),
notifications_canister: CanisterId::from_text("dobi3-tyaaa-aaaaf-adnna-cai").unwrap(),
});

data.subnets.subnets.push(Subnet {
subnet_id: Principal::from_text("2fq7c-slacv-26cgz-vzbx2-2jrcs-5edph-i5s2j-tck77-c3rlz-iobzx-mqe").unwrap(),
local_user_index: CanisterId::from_text("aboy3-giaaa-aaaar-aaaaq-cai").unwrap(),
local_group_index: CanisterId::from_text("ainth-qaaaa-aaaar-aaaba-cai").unwrap(),
notifications_canister: CanisterId::from_text("apmvt-5yaaa-aaaar-aaabq-cai").unwrap(),
});
}
data.icp_ledger_canister_id = CanisterId::from_text("ryjl3-tyaaa-aaaaa-aaaba-cai").unwrap();
data.cycles_minting_canister_id = CanisterId::from_text("rkp4c-7iaaa-aaaaa-aaaca-cai").unwrap();

canister_logger::init_with_logs(data.test_mode, errors, logs, traces);

let env = init_env(data.rng_seed);
init_cycles_dispenser_client(data.cycles_dispenser_canister_id, data.test_mode);
init_state(env, data, args.wasm_version);

info!(version = %args.wasm_version, "Post-upgrade complete");

ic_cdk_timers::set_timer(Duration::ZERO, || ic_cdk::spawn(set_disabled_tokens_in_escrow_canister()));
}

async fn set_disabled_tokens_in_escrow_canister() {
let (disabled_tokens, escrow_canister_id) = read_state(|state| {
let disabled_tokens: Vec<_> = state
.data
.tokens
.iter()
.filter(|t| !t.enabled)
.map(|t| t.ledger_canister_id)
.collect();

(disabled_tokens, state.data.escrow_canister_id)
});

for ledger_canister_id in disabled_tokens {
escrow_canister_c2c_client::c2c_set_token_enabled(
escrow_canister_id,
&escrow_canister::c2c_set_token_enabled::Args {
ledger_canister_id,
enabled: false,
},
)
.await
.unwrap();
}
}
Loading
Loading