From 8fb174b3ca93ed7c2c8f7df71b613b4c06e81205 Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Wed, 24 Jan 2024 16:30:55 +0000 Subject: [PATCH 01/19] Remove one time code to withdraw missing EXE (#5259) --- .../user/impl/src/lifecycle/post_upgrade.rs | 29 +------------------ 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/backend/canisters/user/impl/src/lifecycle/post_upgrade.rs b/backend/canisters/user/impl/src/lifecycle/post_upgrade.rs index ddfd69d115..0b51004a03 100644 --- a/backend/canisters/user/impl/src/lifecycle/post_upgrade.rs +++ b/backend/canisters/user/impl/src/lifecycle/post_upgrade.rs @@ -1,15 +1,11 @@ use crate::lifecycle::{init_env, init_state}; use crate::memory::get_upgrades_memory; -use crate::timer_job_types::ProcessTokenSwapJob; -use crate::{read_state, Data}; +use crate::Data; use canister_logger::LogEntry; -use canister_timer_jobs::Job; use canister_tracing_macros::trace; use ic_cdk_macros::post_upgrade; use stable_memory::get_reader; -use std::time::Duration; use tracing::info; -use types::CanisterId; use user_canister::post_upgrade::Args; #[post_upgrade] @@ -26,27 +22,4 @@ fn post_upgrade(args: Args) { init_state(env, data, args.wasm_version); info!(version = %args.wasm_version, "Post-upgrade complete"); - - let windoge_swaps_failed_due_to_fee_change: Vec<_> = read_state(|state| { - state - .data - .token_swaps - .iter() - .filter(|s| { - s.started > 1705000000000 - && s.success.is_none() - && s.args.output_token.ledger == CanisterId::from_text("rh2pm-ryaaa-aaaan-qeniq-cai").unwrap() - && s.args.output_token.fee != 100_000 - }) - .cloned() - .collect() - }); - - for mut token_swap in windoge_swaps_failed_due_to_fee_change { - token_swap.args.output_token.fee = 100_000; - ic_cdk_timers::set_timer(Duration::ZERO, || { - let job = ProcessTokenSwapJob { token_swap, attempt: 0 }; - job.execute(); - }); - } } From 06a158b5dc81426d692ea8f7cb44b9e6f4d76eb8 Mon Sep 17 00:00:00 2001 From: Matt Grogan Date: Thu, 25 Jan 2024 08:55:11 +0000 Subject: [PATCH 02/19] Introduce the Translations canister (#5261) --- Cargo.lock | 36 ++++++++++ Cargo.toml | 2 + backend/canister_installer/Cargo.toml | 1 + backend/canister_installer/src/lib.rs | 16 ++++- backend/canister_installer/src/main.rs | 4 ++ backend/canister_upgrader/Cargo.toml | 1 + backend/canister_upgrader/src/lib.rs | 19 +++++ backend/canister_upgrader/src/main.rs | 4 ++ backend/canisters/translations/CHANGELOG.md | 6 ++ backend/canisters/translations/api/Cargo.toml | 11 +++ backend/canisters/translations/api/can.did | 1 + backend/canisters/translations/api/src/lib.rs | 5 ++ .../translations/api/src/lifecycle/init.rs | 10 +++ .../translations/api/src/lifecycle/mod.rs | 2 + .../api/src/lifecycle/post_upgrade.rs | 8 +++ .../canisters/translations/api/src/main.rs | 5 ++ .../translations/api/src/updates/mod.rs | 1 + .../canisters/translations/impl/Cargo.toml | 30 ++++++++ .../canisters/translations/impl/src/lib.rs | 72 +++++++++++++++++++ .../translations/impl/src/lifecycle/init.rs | 21 ++++++ .../translations/impl/src/lifecycle/mod.rs | 39 ++++++++++ .../impl/src/lifecycle/post_upgrade.rs | 27 +++++++ .../impl/src/lifecycle/pre_upgrade.rs | 26 +++++++ .../canisters/translations/impl/src/memory.rs | 21 ++++++ .../impl/src/queries/http_request.rs | 26 +++++++ .../translations/impl/src/queries/mod.rs | 1 + .../translations/impl/src/updates/mod.rs | 1 + backend/integration_tests/Cargo.toml | 1 + backend/integration_tests/src/lib.rs | 1 + backend/integration_tests/src/setup.rs | 16 +++++ backend/integration_tests/src/wasms.rs | 1 + .../libraries/canister_agent_utils/src/lib.rs | 4 ++ canister_ids.json | 6 +- dfx.json | 25 +++++-- scripts/deploy-local.sh | 1 + scripts/deploy-testnet.sh | 1 + scripts/deploy.sh | 5 +- scripts/download-all-canister-wasms.sh | 1 + scripts/generate-all-canister-wasms.sh | 1 + scripts/proposals/upgrade_translations.sh | 17 +++++ scripts/upgrade-canister.sh | 2 + .../cycles_dispenser.ini | 2 +- .../register_canisters_with_sns/escrow.ini | 2 +- .../group_index.ini | 2 +- .../register_canisters_with_sns/identity.ini | 2 +- .../market_maker.ini | 2 +- .../neuron_controller.ini | 2 +- .../notifications_index.ini | 2 +- .../online_users.ini | 2 +- .../proposal_validation.ini | 2 +- .../proposals_bot.ini | 2 +- .../register_canisters_with_sns/registry.ini | 2 +- .../storage_index.ini | 2 +- .../translations.ini | 4 ++ .../user_index.ini | 2 +- 55 files changed, 487 insertions(+), 21 deletions(-) create mode 100644 backend/canisters/translations/CHANGELOG.md create mode 100644 backend/canisters/translations/api/Cargo.toml create mode 100644 backend/canisters/translations/api/can.did create mode 100644 backend/canisters/translations/api/src/lib.rs create mode 100644 backend/canisters/translations/api/src/lifecycle/init.rs create mode 100644 backend/canisters/translations/api/src/lifecycle/mod.rs create mode 100644 backend/canisters/translations/api/src/lifecycle/post_upgrade.rs create mode 100644 backend/canisters/translations/api/src/main.rs create mode 100644 backend/canisters/translations/api/src/updates/mod.rs create mode 100644 backend/canisters/translations/impl/Cargo.toml create mode 100644 backend/canisters/translations/impl/src/lib.rs create mode 100644 backend/canisters/translations/impl/src/lifecycle/init.rs create mode 100644 backend/canisters/translations/impl/src/lifecycle/mod.rs create mode 100644 backend/canisters/translations/impl/src/lifecycle/post_upgrade.rs create mode 100644 backend/canisters/translations/impl/src/lifecycle/pre_upgrade.rs create mode 100644 backend/canisters/translations/impl/src/memory.rs create mode 100644 backend/canisters/translations/impl/src/queries/http_request.rs create mode 100644 backend/canisters/translations/impl/src/queries/mod.rs create mode 100644 backend/canisters/translations/impl/src/updates/mod.rs create mode 100755 scripts/proposals/upgrade_translations.sh create mode 100644 sns/scripts/proposals/register_canisters_with_sns/translations.ini diff --git a/Cargo.lock b/Cargo.lock index 801db6e23f..b745ac1aca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1038,6 +1038,7 @@ dependencies = [ "registry_canister", "storage_index_canister", "tokio", + "translations_canister", "types", "user_canister", "user_index_canister", @@ -1119,6 +1120,7 @@ dependencies = [ "storage_index_canister", "storage_index_canister_client", "tokio", + "translations_canister", "types", "user_canister", "user_index_canister", @@ -3484,6 +3486,7 @@ dependencies = [ "storage_bucket_canister", "storage_index_canister", "test-case", + "translations_canister", "types", "user_canister", "user_index_canister", @@ -7000,6 +7003,39 @@ dependencies = [ "tracing-serde", ] +[[package]] +name = "translations_canister" +version = "0.1.0" +dependencies = [ + "candid", + "serde", + "types", +] + +[[package]] +name = "translations_canister_impl" +version = "0.1.0" +dependencies = [ + "candid", + "canister_api_macros", + "canister_logger", + "canister_state_macros", + "canister_tracing_macros", + "http_request", + "ic-cdk 0.11.3", + "ic-cdk-macros 0.7.0", + "ic-cdk-timers", + "ic-stable-structures", + "rand", + "serde", + "serializer", + "stable_memory", + "tracing", + "translations_canister", + "types", + "utils", +] + [[package]] name = "try-lock" version = "0.2.4" diff --git a/Cargo.toml b/Cargo.toml index f65f477f10..736fd0fa6d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -69,6 +69,8 @@ members = [ "backend/canisters/storage_index/c2c_client", "backend/canisters/storage_index/client", "backend/canisters/storage_index/impl", + "backend/canisters/translations/api", + "backend/canisters/translations/impl", "backend/canisters/user/api", "backend/canisters/user/c2c_client", "backend/canisters/user/client", diff --git a/backend/canister_installer/Cargo.toml b/backend/canister_installer/Cargo.toml index bd096745ce..377b2f7998 100644 --- a/backend/canister_installer/Cargo.toml +++ b/backend/canister_installer/Cargo.toml @@ -26,6 +26,7 @@ proposals_bot_canister = { path = "../canisters/proposals_bot/api" } registry_canister = { path = "../canisters/registry/api" } storage_index_canister = { path = "../canisters/storage_index/api" } tokio = { workspace = true, features = ["full"] } +translations_canister = { path = "../canisters/translations/api" } types = { path = "../libraries/types" } user_canister = { path = "../canisters/user/api" } user_index_canister = { path = "../canisters/user_index/api" } diff --git a/backend/canister_installer/src/lib.rs b/backend/canister_installer/src/lib.rs index 17d4734664..ed858413d0 100644 --- a/backend/canister_installer/src/lib.rs +++ b/backend/canister_installer/src/lib.rs @@ -35,6 +35,7 @@ async fn install_service_canisters_impl( set_controllers(management_canister, &canister_ids.market_maker, controllers.clone()), set_controllers(management_canister, &canister_ids.neuron_controller, controllers.clone()), set_controllers(management_canister, &canister_ids.escrow, controllers.clone()), + set_controllers(management_canister, &canister_ids.translations, controllers.clone()), set_controllers( management_canister, &canister_ids.local_user_index, @@ -108,6 +109,13 @@ async fn install_service_canisters_impl( test_mode, }; + let translations_canister_wasm = get_canister_wasm(CanisterName::Translations, version); + let translations_init_args = translations_canister::init::Args { + cycles_dispenser_canister_id: canister_ids.cycles_dispenser, + wasm_version: version, + test_mode, + }; + let online_users_canister_wasm = get_canister_wasm(CanisterName::OnlineUsers, version); let online_users_init_args = online_users_canister::init::Args { user_index_canister_id: canister_ids.user_index, @@ -277,7 +285,7 @@ async fn install_service_canisters_impl( ) .await; - futures::future::join( + futures::future::join3( install_wasm( management_canister, &canister_ids.neuron_controller, @@ -290,6 +298,12 @@ async fn install_service_canisters_impl( &escrow_canister_wasm.module, escrow_init_args, ), + install_wasm( + management_canister, + &canister_ids.translations, + &translations_canister_wasm.module, + translations_init_args, + ), ) .await; diff --git a/backend/canister_installer/src/main.rs b/backend/canister_installer/src/main.rs index 0b2f40da8a..36e4f18fcb 100644 --- a/backend/canister_installer/src/main.rs +++ b/backend/canister_installer/src/main.rs @@ -23,6 +23,7 @@ async fn main() { market_maker: opts.market_maker, neuron_controller: opts.neuron_controller, escrow: opts.escrow, + translations: opts.translations, nns_root: opts.nns_root, nns_governance: opts.nns_governance, nns_internet_identity: opts.nns_internet_identity, @@ -93,6 +94,9 @@ struct Opts { #[arg(long)] escrow: CanisterId, + #[arg(long)] + translations: CanisterId, + #[arg(long)] nns_root: CanisterId, diff --git a/backend/canister_upgrader/Cargo.toml b/backend/canister_upgrader/Cargo.toml index 76cdd93633..868c769d93 100644 --- a/backend/canister_upgrader/Cargo.toml +++ b/backend/canister_upgrader/Cargo.toml @@ -26,6 +26,7 @@ registry_canister = { path = "../canisters/registry/api" } storage_index_canister = { path = "../canisters/storage_index/api" } storage_index_canister_client = { path = "../canisters/storage_index/client" } tokio = { workspace = true, features = ["full"] } +translations_canister = { path = "../canisters/translations/api" } types = { path = "../libraries/types" } user_canister = { path = "../canisters/user/api" } user_index_canister = { path = "../canisters/user_index/api" } diff --git a/backend/canister_upgrader/src/lib.rs b/backend/canister_upgrader/src/lib.rs index afbec9c53a..9f49e31635 100644 --- a/backend/canister_upgrader/src/lib.rs +++ b/backend/canister_upgrader/src/lib.rs @@ -83,6 +83,25 @@ pub async fn upgrade_identity_canister( println!("Identity canister upgraded"); } +pub async fn upgrade_translations_canister( + identity: Box, + url: String, + translations_canister_id: CanisterId, + version: BuildVersion, +) { + upgrade_top_level_canister( + identity, + url, + translations_canister_id, + version, + translations_canister::post_upgrade::Args { wasm_version: version }, + CanisterName::Translations, + ) + .await; + + println!("Identity canister upgraded"); +} + pub async fn upgrade_online_users_canister( identity: Box, url: String, diff --git a/backend/canister_upgrader/src/main.rs b/backend/canister_upgrader/src/main.rs index 0c8c286b7e..5a966ee9b4 100644 --- a/backend/canister_upgrader/src/main.rs +++ b/backend/canister_upgrader/src/main.rs @@ -36,6 +36,7 @@ async fn main() { upgrade_proposals_bot_canister(identity, opts.url, opts.proposals_bot, opts.version).await } CanisterName::Registry => upgrade_registry_canister(identity, opts.url, opts.registry, opts.version).await, + CanisterName::Translations => upgrade_registry_canister(identity, opts.url, opts.translations, opts.version).await, CanisterName::StorageBucket => { upgrade_storage_bucket_canister(identity, opts.url, opts.storage_index, opts.version).await } @@ -85,6 +86,9 @@ struct Opts { #[arg(long)] registry: CanisterId, + #[arg(long)] + translations: CanisterId, + #[arg(long)] market_maker: CanisterId, diff --git a/backend/canisters/translations/CHANGELOG.md b/backend/canisters/translations/CHANGELOG.md new file mode 100644 index 0000000000..8646827d5a --- /dev/null +++ b/backend/canisters/translations/CHANGELOG.md @@ -0,0 +1,6 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). + +## [unreleased] diff --git a/backend/canisters/translations/api/Cargo.toml b/backend/canisters/translations/api/Cargo.toml new file mode 100644 index 0000000000..8fd246e4a5 --- /dev/null +++ b/backend/canisters/translations/api/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "translations_canister" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +candid = { workspace = true } +serde = { workspace = true } +types = { path = "../../../libraries/types" } diff --git a/backend/canisters/translations/api/can.did b/backend/canisters/translations/api/can.did new file mode 100644 index 0000000000..f424d81e86 --- /dev/null +++ b/backend/canisters/translations/api/can.did @@ -0,0 +1 @@ +service : {} diff --git a/backend/canisters/translations/api/src/lib.rs b/backend/canisters/translations/api/src/lib.rs new file mode 100644 index 0000000000..638f3e2703 --- /dev/null +++ b/backend/canisters/translations/api/src/lib.rs @@ -0,0 +1,5 @@ +mod lifecycle; +// mod updates; + +pub use lifecycle::*; +// pub use updates::*; diff --git a/backend/canisters/translations/api/src/lifecycle/init.rs b/backend/canisters/translations/api/src/lifecycle/init.rs new file mode 100644 index 0000000000..bf6aebaba6 --- /dev/null +++ b/backend/canisters/translations/api/src/lifecycle/init.rs @@ -0,0 +1,10 @@ +use candid::CandidType; +use serde::{Deserialize, Serialize}; +use types::{BuildVersion, CanisterId}; + +#[derive(CandidType, Serialize, Deserialize, Debug)] +pub struct Args { + pub cycles_dispenser_canister_id: CanisterId, + pub wasm_version: BuildVersion, + pub test_mode: bool, +} diff --git a/backend/canisters/translations/api/src/lifecycle/mod.rs b/backend/canisters/translations/api/src/lifecycle/mod.rs new file mode 100644 index 0000000000..70bd4f5a23 --- /dev/null +++ b/backend/canisters/translations/api/src/lifecycle/mod.rs @@ -0,0 +1,2 @@ +pub mod init; +pub mod post_upgrade; diff --git a/backend/canisters/translations/api/src/lifecycle/post_upgrade.rs b/backend/canisters/translations/api/src/lifecycle/post_upgrade.rs new file mode 100644 index 0000000000..470a25ac40 --- /dev/null +++ b/backend/canisters/translations/api/src/lifecycle/post_upgrade.rs @@ -0,0 +1,8 @@ +use candid::CandidType; +use serde::{Deserialize, Serialize}; +use types::BuildVersion; + +#[derive(CandidType, Serialize, Deserialize, Debug)] +pub struct Args { + pub wasm_version: BuildVersion, +} diff --git a/backend/canisters/translations/api/src/main.rs b/backend/canisters/translations/api/src/main.rs new file mode 100644 index 0000000000..37e8c25054 --- /dev/null +++ b/backend/canisters/translations/api/src/main.rs @@ -0,0 +1,5 @@ +#[allow(deprecated)] +fn main() { + candid::export_service!(); + std::print!("{}", __export_service()); +} diff --git a/backend/canisters/translations/api/src/updates/mod.rs b/backend/canisters/translations/api/src/updates/mod.rs new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/backend/canisters/translations/api/src/updates/mod.rs @@ -0,0 +1 @@ + diff --git a/backend/canisters/translations/impl/Cargo.toml b/backend/canisters/translations/impl/Cargo.toml new file mode 100644 index 0000000000..8a89e4b93d --- /dev/null +++ b/backend/canisters/translations/impl/Cargo.toml @@ -0,0 +1,30 @@ +[package] +name = "translations_canister_impl" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[lib] +path = "src/lib.rs" +crate-type = ["cdylib"] + +[dependencies] +candid = { workspace = true } +canister_api_macros = { path = "../../../libraries/canister_api_macros" } +canister_logger = { path = "../../../libraries/canister_logger" } +canister_state_macros = { path = "../../../libraries/canister_state_macros" } +canister_tracing_macros = { path = "../../../libraries/canister_tracing_macros" } +http_request = { path = "../../../libraries/http_request" } +ic-cdk = { workspace = true } +ic-cdk-macros = { workspace = true } +ic-cdk-timers = { workspace = true } +ic-stable-structures = { workspace = true } +rand = { workspace = true } +serde = { workspace = true } +serializer = { path = "../../../libraries/serializer" } +stable_memory = { path = "../../../libraries/stable_memory" } +tracing = { workspace = true } +translations_canister = { path = "../api" } +types = { path = "../../../libraries/types" } +utils = { path = "../../../libraries/utils" } diff --git a/backend/canisters/translations/impl/src/lib.rs b/backend/canisters/translations/impl/src/lib.rs new file mode 100644 index 0000000000..4d6be31732 --- /dev/null +++ b/backend/canisters/translations/impl/src/lib.rs @@ -0,0 +1,72 @@ +use canister_state_macros::canister_state; +use serde::{Deserialize, Serialize}; +use std::cell::RefCell; +use types::{BuildVersion, CanisterId, Cycles, TimestampMillis, Timestamped}; +use utils::env::Environment; + +mod lifecycle; +mod memory; +mod queries; +mod updates; + +thread_local! { + static WASM_VERSION: RefCell> = RefCell::default(); +} + +canister_state!(RuntimeState); + +struct RuntimeState { + pub env: Box, + pub data: Data, +} + +impl RuntimeState { + pub fn new(env: Box, data: Data) -> RuntimeState { + RuntimeState { env, data } + } + + pub fn metrics(&self) -> Metrics { + Metrics { + memory_used: utils::memory::used(), + now: self.env.now(), + cycles_balance: self.env.cycles_balance(), + wasm_version: WASM_VERSION.with_borrow(|v| **v), + git_commit_id: utils::git::git_commit_id().to_string(), + canister_ids: CanisterIds { + cycles_dispenser: self.data.cycles_dispenser_canister_id, + }, + } + } +} + +#[derive(Serialize, Deserialize)] +struct Data { + pub cycles_dispenser_canister_id: CanisterId, + pub rng_seed: [u8; 32], + pub test_mode: bool, +} + +impl Data { + pub fn new(cycles_dispenser_canister_id: CanisterId, test_mode: bool) -> Data { + Data { + cycles_dispenser_canister_id, + rng_seed: [0; 32], + test_mode, + } + } +} + +#[derive(Serialize, Debug)] +pub struct Metrics { + pub now: TimestampMillis, + pub memory_used: u64, + pub cycles_balance: Cycles, + pub wasm_version: BuildVersion, + pub git_commit_id: String, + pub canister_ids: CanisterIds, +} + +#[derive(Serialize, Debug)] +pub struct CanisterIds { + pub cycles_dispenser: CanisterId, +} diff --git a/backend/canisters/translations/impl/src/lifecycle/init.rs b/backend/canisters/translations/impl/src/lifecycle/init.rs new file mode 100644 index 0000000000..993241335b --- /dev/null +++ b/backend/canisters/translations/impl/src/lifecycle/init.rs @@ -0,0 +1,21 @@ +use crate::lifecycle::{init_env, init_state}; +use crate::Data; +use canister_tracing_macros::trace; +use ic_cdk_macros::init; +use tracing::info; +use translations_canister::init::Args; +use utils::cycles::init_cycles_dispenser_client; + +#[init] +#[trace] +fn init(args: Args) { + canister_logger::init(args.test_mode); + init_cycles_dispenser_client(args.cycles_dispenser_canister_id, args.test_mode); + + let env = init_env([0; 32]); + let data = Data::new(args.cycles_dispenser_canister_id, args.test_mode); + + init_state(env, data, args.wasm_version); + + info!(version = %args.wasm_version, "Initialization complete"); +} diff --git a/backend/canisters/translations/impl/src/lifecycle/mod.rs b/backend/canisters/translations/impl/src/lifecycle/mod.rs new file mode 100644 index 0000000000..aaf9b1d99f --- /dev/null +++ b/backend/canisters/translations/impl/src/lifecycle/mod.rs @@ -0,0 +1,39 @@ +use crate::{mutate_state, Data, RuntimeState, WASM_VERSION}; +use std::time::Duration; +use tracing::trace; +use types::{BuildVersion, Timestamped}; +use utils::canister::get_random_seed; +use utils::env::canister::CanisterEnv; +use utils::env::Environment; + +mod init; +mod post_upgrade; +mod pre_upgrade; + +fn init_env(rng_seed: [u8; 32]) -> Box { + if rng_seed == [0; 32] { + ic_cdk_timers::set_timer(Duration::ZERO, reseed_rng); + } + Box::new(CanisterEnv::new(rng_seed)) +} + +fn init_state(env: Box, data: Data, wasm_version: BuildVersion) { + let now = env.now(); + let state = RuntimeState::new(env, data); + + crate::init_state(state); + WASM_VERSION.set(Timestamped::new(wasm_version, now)); +} + +fn reseed_rng() { + ic_cdk::spawn(reseed_rng_inner()); + + async fn reseed_rng_inner() { + let seed = get_random_seed().await; + mutate_state(|state| { + state.data.rng_seed = seed; + state.env = Box::new(CanisterEnv::new(seed)) + }); + trace!("Successfully reseeded rng"); + } +} diff --git a/backend/canisters/translations/impl/src/lifecycle/post_upgrade.rs b/backend/canisters/translations/impl/src/lifecycle/post_upgrade.rs new file mode 100644 index 0000000000..9c737ff817 --- /dev/null +++ b/backend/canisters/translations/impl/src/lifecycle/post_upgrade.rs @@ -0,0 +1,27 @@ +use crate::lifecycle::{init_env, init_state}; +use crate::memory::get_upgrades_memory; +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::info; +use translations_canister::post_upgrade::Args; +use utils::cycles::init_cycles_dispenser_client; + +#[post_upgrade] +#[trace] +fn post_upgrade(args: Args) { + let memory = get_upgrades_memory(); + let reader = get_reader(&memory); + + let (data, logs, traces): (Data, Vec, Vec) = serializer::deserialize(reader).unwrap(); + + canister_logger::init_with_logs(data.test_mode, 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"); +} diff --git a/backend/canisters/translations/impl/src/lifecycle/pre_upgrade.rs b/backend/canisters/translations/impl/src/lifecycle/pre_upgrade.rs new file mode 100644 index 0000000000..220192443f --- /dev/null +++ b/backend/canisters/translations/impl/src/lifecycle/pre_upgrade.rs @@ -0,0 +1,26 @@ +use crate::memory::get_upgrades_memory; +use crate::take_state; +use canister_tracing_macros::trace; +use ic_cdk_macros::pre_upgrade; +use rand::Rng; +use stable_memory::get_writer; +use tracing::info; + +#[pre_upgrade] +#[trace] +fn pre_upgrade() { + info!("Pre-upgrade starting"); + + let mut state = take_state(); + state.data.rng_seed = state.env.rng().gen(); + + let logs = canister_logger::export_logs(); + let traces = canister_logger::export_traces(); + + let stable_state = (state.data, logs, traces); + + let mut memory = get_upgrades_memory(); + let writer = get_writer(&mut memory); + + serializer::serialize(stable_state, writer).unwrap(); +} diff --git a/backend/canisters/translations/impl/src/memory.rs b/backend/canisters/translations/impl/src/memory.rs new file mode 100644 index 0000000000..430afd5c57 --- /dev/null +++ b/backend/canisters/translations/impl/src/memory.rs @@ -0,0 +1,21 @@ +use ic_stable_structures::{ + memory_manager::{MemoryId, MemoryManager, VirtualMemory}, + DefaultMemoryImpl, +}; + +const UPGRADES: MemoryId = MemoryId::new(0); + +pub type Memory = VirtualMemory; + +thread_local! { + static MEMORY_MANAGER: MemoryManager + = MemoryManager::init_with_bucket_size(DefaultMemoryImpl::default(), 16); +} + +pub fn get_upgrades_memory() -> Memory { + get_memory(UPGRADES) +} + +fn get_memory(id: MemoryId) -> Memory { + MEMORY_MANAGER.with(|m| m.get(id)) +} diff --git a/backend/canisters/translations/impl/src/queries/http_request.rs b/backend/canisters/translations/impl/src/queries/http_request.rs new file mode 100644 index 0000000000..fea6d8d402 --- /dev/null +++ b/backend/canisters/translations/impl/src/queries/http_request.rs @@ -0,0 +1,26 @@ +use crate::{read_state, RuntimeState}; +use http_request::{build_json_response, encode_logs, extract_route, Route}; +use ic_cdk_macros::query; +use types::{HttpRequest, HttpResponse, TimestampMillis}; + +#[query] +fn http_request(request: HttpRequest) -> HttpResponse { + fn get_logs_impl(since: Option) -> HttpResponse { + encode_logs(canister_logger::export_logs(), since.unwrap_or(0)) + } + + fn get_traces_impl(since: Option) -> HttpResponse { + encode_logs(canister_logger::export_traces(), since.unwrap_or(0)) + } + + fn get_metrics_impl(state: &RuntimeState) -> HttpResponse { + build_json_response(&state.metrics()) + } + + match extract_route(&request.url) { + Route::Logs(since) => get_logs_impl(since), + Route::Traces(since) => get_traces_impl(since), + Route::Metrics => read_state(get_metrics_impl), + _ => HttpResponse::not_found(), + } +} diff --git a/backend/canisters/translations/impl/src/queries/mod.rs b/backend/canisters/translations/impl/src/queries/mod.rs new file mode 100644 index 0000000000..1cfa1ad736 --- /dev/null +++ b/backend/canisters/translations/impl/src/queries/mod.rs @@ -0,0 +1 @@ +mod http_request; diff --git a/backend/canisters/translations/impl/src/updates/mod.rs b/backend/canisters/translations/impl/src/updates/mod.rs new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/backend/canisters/translations/impl/src/updates/mod.rs @@ -0,0 +1 @@ + diff --git a/backend/integration_tests/Cargo.toml b/backend/integration_tests/Cargo.toml index aecbc20b2f..4ace1f96e0 100644 --- a/backend/integration_tests/Cargo.toml +++ b/backend/integration_tests/Cargo.toml @@ -35,6 +35,7 @@ serial_test = "2.0.0" storage_bucket_canister = { path = "../canisters/storage_bucket/api" } storage_index_canister = { path = "../canisters/storage_index/api" } test-case = { workspace = true } +translations_canister = { path = "../canisters/translations/api" } types = { path = "../libraries/types" } user_canister = { path = "../canisters/user/api" } user_index_canister = { path = "../canisters/user_index/api" } diff --git a/backend/integration_tests/src/lib.rs b/backend/integration_tests/src/lib.rs index b986bcc837..168ce01362 100644 --- a/backend/integration_tests/src/lib.rs +++ b/backend/integration_tests/src/lib.rs @@ -92,6 +92,7 @@ pub struct CanisterIds { pub cycles_dispenser: CanisterId, pub registry: CanisterId, pub escrow: CanisterId, + pub translations: CanisterId, pub icp_ledger: CanisterId, pub chat_ledger: CanisterId, pub cycles_minting_canister: CanisterId, diff --git a/backend/integration_tests/src/setup.rs b/backend/integration_tests/src/setup.rs index 8294861cae..3401a03fa2 100644 --- a/backend/integration_tests/src/setup.rs +++ b/backend/integration_tests/src/setup.rs @@ -80,6 +80,7 @@ fn install_canisters(env: &mut PocketIc, controller: Principal) -> CanisterIds { let cycles_dispenser_canister_id = create_canister(env, controller); let registry_canister_id = create_canister(env, controller); let escrow_canister_id = create_canister(env, controller); + let translations_canister_id = create_canister(env, controller); let local_user_index_canister_id = create_canister(env, user_index_canister_id); let local_group_index_canister_id = create_canister(env, group_index_canister_id); @@ -103,6 +104,7 @@ fn install_canisters(env: &mut PocketIc, controller: Principal) -> CanisterIds { let sns_wasm_canister_wasm = wasms::SNS_WASM.clone(); let storage_bucket_canister_wasm = wasms::STORAGE_BUCKET.clone(); let storage_index_canister_wasm = wasms::STORAGE_INDEX.clone(); + let translations_canister_wasm = wasms::TRANSLATIONS.clone(); let user_canister_wasm = wasms::USER.clone(); let user_index_canister_wasm = wasms::USER_INDEX.clone(); @@ -183,6 +185,19 @@ fn install_canisters(env: &mut PocketIc, controller: Principal) -> CanisterIds { identity_init_args, ); + let translations_init_args = translations_canister::init::Args { + cycles_dispenser_canister_id, + wasm_version: BuildVersion::min(), + test_mode: true, + }; + install_canister( + env, + controller, + translations_canister_id, + translations_canister_wasm, + translations_init_args, + ); + let online_users_init_args = online_users_canister::init::Args { user_index_canister_id, cycles_dispenser_canister_id, @@ -411,6 +426,7 @@ fn install_canisters(env: &mut PocketIc, controller: Principal) -> CanisterIds { icp_ledger: nns_ledger_canister_id, chat_ledger: chat_ledger_canister_id, cycles_minting_canister: cycles_minting_canister_id, + translations: translations_canister_id, } } diff --git a/backend/integration_tests/src/wasms.rs b/backend/integration_tests/src/wasms.rs index eee9e050a0..a97397c4da 100644 --- a/backend/integration_tests/src/wasms.rs +++ b/backend/integration_tests/src/wasms.rs @@ -24,6 +24,7 @@ lazy_static! { pub static ref SNS_WASM: CanisterWasm = get_canister_wasm("sns_wasm"); pub static ref STORAGE_BUCKET: CanisterWasm = get_canister_wasm("storage_bucket"); pub static ref STORAGE_INDEX: CanisterWasm = get_canister_wasm("storage_index"); + pub static ref TRANSLATIONS: CanisterWasm = get_canister_wasm("translations"); pub static ref USER: CanisterWasm = get_canister_wasm("user"); pub static ref USER_INDEX: CanisterWasm = get_canister_wasm("user_index"); } diff --git a/backend/libraries/canister_agent_utils/src/lib.rs b/backend/libraries/canister_agent_utils/src/lib.rs index 785303d57f..f3e924d57a 100644 --- a/backend/libraries/canister_agent_utils/src/lib.rs +++ b/backend/libraries/canister_agent_utils/src/lib.rs @@ -29,6 +29,7 @@ pub enum CanisterName { Registry, StorageBucket, StorageIndex, + Translations, User, UserIndex, } @@ -55,6 +56,7 @@ impl FromStr for CanisterName { "registry" => Ok(CanisterName::Registry), "storage_bucket" => Ok(CanisterName::StorageBucket), "storage_index" => Ok(CanisterName::StorageIndex), + "translations" => Ok(CanisterName::Translations), "user" => Ok(CanisterName::User), "user_index" => Ok(CanisterName::UserIndex), _ => Err(format!("Unrecognised canister name: {s}")), @@ -82,6 +84,7 @@ impl Display for CanisterName { CanisterName::Registry => "registry", CanisterName::StorageBucket => "storage_bucket", CanisterName::StorageIndex => "storage_index", + CanisterName::Translations => "translations", CanisterName::User => "user", CanisterName::UserIndex => "user_index", }; @@ -107,6 +110,7 @@ pub struct CanisterIds { pub market_maker: CanisterId, pub neuron_controller: CanisterId, pub escrow: CanisterId, + pub translations: CanisterId, pub nns_root: CanisterId, pub nns_governance: CanisterId, pub nns_internet_identity: CanisterId, diff --git a/canister_ids.json b/canister_ids.json index 132f5fbdc8..1aea797952 100644 --- a/canister_ids.json +++ b/canister_ids.json @@ -59,6 +59,10 @@ "ic": "cpi5u-yiaaa-aaaar-aqw5a-cai", "ic_test": "cglwi-oaaaa-aaaar-aqw4q-cai" }, + "translations": { + "ic": "lxq5i-mqaaa-aaaaf-bih7q-cai", + "ic_test": "lqr34-biaaa-aaaaf-bih7a-cai" + }, "sns_governance": { "ic": "2jvtu-yqaaa-aaaaq-aaama-cai", "ic_test": "t5cdl-3iaaa-aaaak-qbumq-cai" @@ -92,4 +96,4 @@ "ic_test": "pfs7b-iqaaa-aaaaf-abs7q-cai", "web_test": "xp7uu-xyaaa-aaaaf-aoa6a-cai" } -} +} \ No newline at end of file diff --git a/dfx.json b/dfx.json index 0ce4686e03..95318bc0df 100644 --- a/dfx.json +++ b/dfx.json @@ -109,8 +109,17 @@ "wasm": "wasms/escrow.wasm.gz", "build": "./scripts/generate-wasm.sh escrow" }, + "translations": { + "type": "custom", + "candid": "backend/canisters/translations/api/can.did", + "wasm": "wasms/translations.wasm.gz", + "build": "./scripts/generate-wasm.sh translations" + }, "website": { - "source": ["frontend/app/build", "frontend/app/public"], + "source": [ + "frontend/app/build", + "frontend/app/public" + ], "type": "assets" }, "sns_governance": { @@ -153,17 +162,23 @@ } }, "ic": { - "providers": ["https://ic0.app/"], + "providers": [ + "https://ic0.app/" + ], "type": "persistent" }, "ic_test": { - "providers": ["https://ic0.app/"], + "providers": [ + "https://ic0.app/" + ], "type": "persistent" }, "web_test": { - "providers": ["https://ic0.app/"], + "providers": [ + "https://ic0.app/" + ], "type": "persistent" } }, "version": 1 -} +} \ No newline at end of file diff --git a/scripts/deploy-local.sh b/scripts/deploy-local.sh index 14eed4080d..939156e14f 100755 --- a/scripts/deploy-local.sh +++ b/scripts/deploy-local.sh @@ -37,6 +37,7 @@ dfx --identity $IDENTITY canister create --no-wallet --with-cycles 1000000000000 dfx --identity $IDENTITY canister create --no-wallet --with-cycles 100000000000000 market_maker dfx --identity $IDENTITY canister create --no-wallet --with-cycles 100000000000000 neuron_controller dfx --identity $IDENTITY canister create --no-wallet --with-cycles 100000000000000 escrow +dfx --identity $IDENTITY canister create --no-wallet --with-cycles 100000000000000 translations # Install the OpenChat canisters ./scripts/deploy.sh local \ diff --git a/scripts/deploy-testnet.sh b/scripts/deploy-testnet.sh index fa0825d32e..5a1d5d9db8 100755 --- a/scripts/deploy-testnet.sh +++ b/scripts/deploy-testnet.sh @@ -33,6 +33,7 @@ dfx --identity $IDENTITY canister create --provisional-create-canister-effective dfx --identity $IDENTITY canister create --provisional-create-canister-effective-canister-id jrlun-jiaaa-aaaab-aaaaa-cai --network $NETWORK --no-wallet --with-cycles 100000000000000 market_maker dfx --identity $IDENTITY canister create --provisional-create-canister-effective-canister-id jrlun-jiaaa-aaaab-aaaaa-cai --network $NETWORK --no-wallet --with-cycles 100000000000000 neuron_controller dfx --identity $IDENTITY canister create --provisional-create-canister-effective-canister-id jrlun-jiaaa-aaaab-aaaaa-cai --network $NETWORK --no-wallet --with-cycles 100000000000000 escrow +dfx --identity $IDENTITY canister create --provisional-create-canister-effective-canister-id jrlun-jiaaa-aaaab-aaaaa-cai --network $NETWORK --no-wallet --with-cycles 100000000000000 translations # Install the OpenChat canisters ./scripts/deploy.sh $NETWORK \ diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 60c6ccd3f6..4b7026c82d 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -43,6 +43,7 @@ REGISTRY_CANISTER_ID=$(dfx canister --network $NETWORK id registry) MARKET_MAKER_CANISTER_ID=$(dfx canister --network $NETWORK id market_maker) NEURON_CONTROLLER_CANISTER_ID=$(dfx canister --network $NETWORK id neuron_controller) ESCROW_CANISTER_ID=$(dfx canister --network $NETWORK id escrow) +TRANSLATIONS_CANISTER_ID=$(dfx canister --network $NETWORK id translations) cargo run \ --manifest-path backend/canister_installer/Cargo.toml -- \ @@ -70,4 +71,6 @@ cargo run \ --nns-ledger $NNS_LEDGER_CANISTER_ID \ --nns-cmc $NNS_CMC_CANISTER_ID \ --nns-sns-wasm $NNS_SNS_WASM_CANISTER_ID \ - --nns-index $NNS_INDEX_CANISTER_ID + --nns-index $NNS_INDEX_CANISTER_ID \ + --translations $TRANSLATIONS_CANISTER_ID + diff --git a/scripts/download-all-canister-wasms.sh b/scripts/download-all-canister-wasms.sh index 515b14511b..de2ae6863b 100755 --- a/scripts/download-all-canister-wasms.sh +++ b/scripts/download-all-canister-wasms.sh @@ -31,6 +31,7 @@ echo "Downloading wasms" ./download-canister-wasm.sh registry $WASM_SRC || exit 1 ./download-canister-wasm.sh storage_bucket $WASM_SRC || exit 1 ./download-canister-wasm.sh storage_index $WASM_SRC || exit 1 +./download-canister-wasm.sh translations $WASM_SRC || exit 1 ./download-canister-wasm.sh user $WASM_SRC || exit 1 ./download-canister-wasm.sh user_index $WASM_SRC || exit 1 diff --git a/scripts/generate-all-canister-wasms.sh b/scripts/generate-all-canister-wasms.sh index e624c29c44..9aa174530e 100755 --- a/scripts/generate-all-canister-wasms.sh +++ b/scripts/generate-all-canister-wasms.sh @@ -22,5 +22,6 @@ cd $SCRIPT_DIR/.. ./scripts/generate-wasm.sh registry ./scripts/generate-wasm.sh storage_bucket ./scripts/generate-wasm.sh storage_index +./scripts/generate-wasm.sh translations ./scripts/generate-wasm.sh user ./scripts/generate-wasm.sh user_index diff --git a/scripts/proposals/upgrade_translations.sh b/scripts/proposals/upgrade_translations.sh new file mode 100755 index 0000000000..81bc90b284 --- /dev/null +++ b/scripts/proposals/upgrade_translations.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +VERSION=$1 +SUMMARY_PATH=$2 + +TITLE="Upgrade Translations canister to $VERSION" +SUMMARY=`cat $SUMMARY_PATH` +FUNCTION_ID=3 +CANISTER_NAME=translations + +# Set current directory to the scripts root +SCRIPT=$(readlink -f "$0") +SCRIPT_DIR=$(dirname "$SCRIPT") +cd $SCRIPT_DIR/.. + +# Submit the proposal +./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$SUMMARY" diff --git a/scripts/upgrade-canister.sh b/scripts/upgrade-canister.sh index 47233de323..113a1118ec 100755 --- a/scripts/upgrade-canister.sh +++ b/scripts/upgrade-canister.sh @@ -34,6 +34,7 @@ REGISTRY_CANISTER_ID=$(dfx canister --network $NETWORK id registry) MARKET_MAKER_CANISTER_ID=$(dfx canister --network $NETWORK id market_maker) NEURON_CONTROLLER_CANISTER_ID=$(dfx canister --network $NETWORK id neuron_controller) ESCROW_CANISTER_ID=$(dfx canister --network $NETWORK id escrow) +TRANSLATIONS_CANISTER_ID=$(dfx canister --network $NETWORK id translations) cargo run \ --manifest-path backend/canister_upgrader/Cargo.toml -- \ @@ -51,5 +52,6 @@ cargo run \ --market-maker $MARKET_MAKER_CANISTER_ID \ --neuron-controller $NEURON_CONTROLLER_CANISTER_ID \ --escrow $ESCROW_CANISTER_ID \ + --translations $TRANSLATIONS_CANISTER_ID \ --canister-to-upgrade $CANISTER_NAME \ --version $VERSION \ diff --git a/sns/scripts/proposals/register_canisters_with_sns/cycles_dispenser.ini b/sns/scripts/proposals/register_canisters_with_sns/cycles_dispenser.ini index f99a512ef6..8dd2af85f5 100644 --- a/sns/scripts/proposals/register_canisters_with_sns/cycles_dispenser.ini +++ b/sns/scripts/proposals/register_canisters_with_sns/cycles_dispenser.ini @@ -1,3 +1,3 @@ TITLE="Register cycles_dispenser as an SNS controlled canister" -URL="https://github.com/open-chat-labs/cycles-dispenser/blob/61d2ecec5e143397b5f00f5dc941f41519bc2918/canister/impl/src/lib.rs" +URL="https://github.com/open-chat-labs/cycles-dispenser/tree/master/canister/impl/src/lib.rs" SUMMARY="This canister is responsible for topping up the other canisters with cycles" \ No newline at end of file diff --git a/sns/scripts/proposals/register_canisters_with_sns/escrow.ini b/sns/scripts/proposals/register_canisters_with_sns/escrow.ini index 31e4164db3..b94812de3c 100644 --- a/sns/scripts/proposals/register_canisters_with_sns/escrow.ini +++ b/sns/scripts/proposals/register_canisters_with_sns/escrow.ini @@ -1,3 +1,3 @@ TITLE="Register 'Escrow' as an SNS controlled canister" -URL="https://github.com/open-chat-labs/open-chat/blob/8969ceb69426bf7fac16a2842497b17a992b4487/backend/canisters/escrow/impl/src/lib.rs" +URL="https://github.com/open-chat-labs/open-chat/tree/master/backend/canisters/escrow/impl/src/lib.rs" SUMMARY="This canister allows users to perform P2P swaps" \ No newline at end of file diff --git a/sns/scripts/proposals/register_canisters_with_sns/group_index.ini b/sns/scripts/proposals/register_canisters_with_sns/group_index.ini index bfea07b8e9..89256b0a7e 100644 --- a/sns/scripts/proposals/register_canisters_with_sns/group_index.ini +++ b/sns/scripts/proposals/register_canisters_with_sns/group_index.ini @@ -1,3 +1,3 @@ TITLE="Register group_index as an SNS controlled canister" -URL="https://github.com/open-chat-labs/open-chat/blob/8a4aecfeebffc2c7fd49fb1233448eef7296f51e/backend/canisters/group_index/impl/src/lib.rs" +URL="https://github.com/open-chat-labs/open-chat/tree/master/backend/canisters/group_index/impl/src/lib.rs" SUMMARY="This canister holds a registry of the OC groups and controls the local_group_index canister in each subnet" \ No newline at end of file diff --git a/sns/scripts/proposals/register_canisters_with_sns/identity.ini b/sns/scripts/proposals/register_canisters_with_sns/identity.ini index 7b7f4c4bb4..9a6da727e6 100644 --- a/sns/scripts/proposals/register_canisters_with_sns/identity.ini +++ b/sns/scripts/proposals/register_canisters_with_sns/identity.ini @@ -1,3 +1,3 @@ TITLE="Register 'Identity' as an SNS controlled canister" -URL="https://github.com/open-chat-labs/open-chat/blob/8969ceb69426bf7fac16a2842497b17a992b4487/backend/canisters/identity/impl/src/lib.rs" +URL="https://github.com/open-chat-labs/open-chat/tree/master/backend/canisters/identity/impl/src/lib.rs" SUMMARY="This canister manages user authentication" \ No newline at end of file diff --git a/sns/scripts/proposals/register_canisters_with_sns/market_maker.ini b/sns/scripts/proposals/register_canisters_with_sns/market_maker.ini index 1938b55fcf..6a5d94de7e 100644 --- a/sns/scripts/proposals/register_canisters_with_sns/market_maker.ini +++ b/sns/scripts/proposals/register_canisters_with_sns/market_maker.ini @@ -1,5 +1,5 @@ TITLE="Register MarketMaker canister as an SNS controlled canister" -URL="https://github.com/open-chat-labs/open-chat/blob/c7a496d445937acf51080748a0cb272f0b5095ad/backend/canisters/market_maker/impl/src/lib.rs" +URL="https://github.com/open-chat-labs/open-chat/tree/master/backend/canisters/market_maker/impl/src/lib.rs" SUMMARY="This proposal hands control of the new MarketMaker canister over to the OpenChat SNS. This canister is currently only integrated with ICDex but in the future it can integrate with many more order book DEXes. diff --git a/sns/scripts/proposals/register_canisters_with_sns/neuron_controller.ini b/sns/scripts/proposals/register_canisters_with_sns/neuron_controller.ini index 35da031d9f..847b049f4a 100644 --- a/sns/scripts/proposals/register_canisters_with_sns/neuron_controller.ini +++ b/sns/scripts/proposals/register_canisters_with_sns/neuron_controller.ini @@ -1,3 +1,3 @@ TITLE="Register 'Neuron Controller' as an SNS controlled canister" -URL="https://github.com/open-chat-labs/open-chat/blob/0c2c5c3b977897b72ee470b1baeb2de8eeff916e/backend/canisters/neuron_controller/impl/src/lib.rs" +URL="https://github.com/open-chat-labs/open-chat/tree/master/backend/canisters/neuron_controller/impl/src/lib.rs" SUMMARY="This canister can stake and manage neurons on behalf of the SNS" \ No newline at end of file diff --git a/sns/scripts/proposals/register_canisters_with_sns/notifications_index.ini b/sns/scripts/proposals/register_canisters_with_sns/notifications_index.ini index b592318a90..dcfea6ac8a 100644 --- a/sns/scripts/proposals/register_canisters_with_sns/notifications_index.ini +++ b/sns/scripts/proposals/register_canisters_with_sns/notifications_index.ini @@ -1,3 +1,3 @@ TITLE="Register notifications_index as an SNS controlled canister" -URL="https://github.com/open-chat-labs/open-chat/blob/8a4aecfeebffc2c7fd49fb1233448eef7296f51e/backend/canisters/notifications_index/impl/src/lib.rs" +URL="https://github.com/open-chat-labs/open-chat/tree/master/backend/canisters/notifications_index/impl/src/lib.rs" SUMMARY="This canister holds a registry of web push notification device subscriptions and controls the notifications canister in each subnet" \ No newline at end of file diff --git a/sns/scripts/proposals/register_canisters_with_sns/online_users.ini b/sns/scripts/proposals/register_canisters_with_sns/online_users.ini index 8f6aabfb60..2337f9e205 100644 --- a/sns/scripts/proposals/register_canisters_with_sns/online_users.ini +++ b/sns/scripts/proposals/register_canisters_with_sns/online_users.ini @@ -1,3 +1,3 @@ TITLE="Register online_users as an SNS controlled canister" -URL="https://github.com/open-chat-labs/open-chat/blob/8a4aecfeebffc2c7fd49fb1233448eef7296f51e/backend/canisters/online_users/impl/src/lib.rs" +URL="https://github.com/open-chat-labs/open-chat/tree/master/backend/canisters/online_users/impl/src/lib.rs" SUMMARY="This canister maintains the last online timestamps for each user" \ No newline at end of file diff --git a/sns/scripts/proposals/register_canisters_with_sns/proposal_validation.ini b/sns/scripts/proposals/register_canisters_with_sns/proposal_validation.ini index b04025d3ca..9991835c17 100644 --- a/sns/scripts/proposals/register_canisters_with_sns/proposal_validation.ini +++ b/sns/scripts/proposals/register_canisters_with_sns/proposal_validation.ini @@ -1,5 +1,5 @@ TITLE="Register ProposalValidation canister as an SNS controlled canister" -URL="https://github.com/open-chat-labs/open-chat/blob/8e4a2fa275ba9ce89cad49820abb711ef4e150f7/backend/canisters/proposal_validation/impl/src/lib.rs" +URL="https://github.com/open-chat-labs/open-chat/tree/master/backend/canisters/proposal_validation/impl/src/lib.rs" SUMMARY="This proposal hands control of the new ProposalValidation canister over to the OpenChat SNS. For each SNS proposal which calls a custom function, there must be a corresponding 'validation' function which validates the proposal's payload and provides a human-readable rendering of it. diff --git a/sns/scripts/proposals/register_canisters_with_sns/proposals_bot.ini b/sns/scripts/proposals/register_canisters_with_sns/proposals_bot.ini index caf4e1a161..5bf452875a 100644 --- a/sns/scripts/proposals/register_canisters_with_sns/proposals_bot.ini +++ b/sns/scripts/proposals/register_canisters_with_sns/proposals_bot.ini @@ -1,3 +1,3 @@ TITLE="Register the proposals_bot as an SNS controlled canister" -URL="https://github.com/open-chat-labs/open-chat/blob/8a4aecfeebffc2c7fd49fb1233448eef7296f51e/backend/canisters/proposals_bot/impl/src/lib.rs" +URL="https://github.com/open-chat-labs/open-chat/tree/master/backend/canisters/proposals_bot/impl/src/lib.rs" SUMMARY="This canister syncs proposals from the NNS and each registered SNS with the equivalent proposals group in OpenChat" \ No newline at end of file diff --git a/sns/scripts/proposals/register_canisters_with_sns/registry.ini b/sns/scripts/proposals/register_canisters_with_sns/registry.ini index 5725d788e0..eaa4a3a666 100644 --- a/sns/scripts/proposals/register_canisters_with_sns/registry.ini +++ b/sns/scripts/proposals/register_canisters_with_sns/registry.ini @@ -1,3 +1,3 @@ TITLE="Register 'Registry' as an SNS controlled canister" -URL="https://github.com/open-chat-labs/open-chat/blob/e36100472d28c4e3781da970bca7fc6caaf4d191/backend/canisters/registry/impl/src/lib.rs" +URL="https://github.com/open-chat-labs/open-chat/tree/master/backend/canisters/registry/impl/src/lib.rs" SUMMARY="This canister holds details of supported cryptocurrency tokens (+ more things in the future)" \ No newline at end of file diff --git a/sns/scripts/proposals/register_canisters_with_sns/storage_index.ini b/sns/scripts/proposals/register_canisters_with_sns/storage_index.ini index 4d9c7555e8..175b400e58 100644 --- a/sns/scripts/proposals/register_canisters_with_sns/storage_index.ini +++ b/sns/scripts/proposals/register_canisters_with_sns/storage_index.ini @@ -1,3 +1,3 @@ TITLE="Register the storage_index as an SNS controlled canister" -URL="https://github.com/open-chat-labs/open-storage/blob/d460ed0e23221c01978f52db64ab2d4d19936050/backend/canisters/index/impl/src/lib.rs" +URL="https://github.com/open-chat-labs/open-storage/tree/master/backend/canisters/index/impl/src/lib.rs" SUMMARY="This canister holds an index of stored files and controls the storage_bucket canisters in each subnet" \ No newline at end of file diff --git a/sns/scripts/proposals/register_canisters_with_sns/translations.ini b/sns/scripts/proposals/register_canisters_with_sns/translations.ini new file mode 100644 index 0000000000..8f3acd8e66 --- /dev/null +++ b/sns/scripts/proposals/register_canisters_with_sns/translations.ini @@ -0,0 +1,4 @@ +TITLE="Register 'Translations' as an SNS controlled canister" +// TODO: This needs updating once the initial PR is merged +URL="https://github.com/open-chat-labs/open-chat/tree/master/backend/canisters/translations/impl/src/lib.rs" +SUMMARY="This canister manages translations" \ No newline at end of file diff --git a/sns/scripts/proposals/register_canisters_with_sns/user_index.ini b/sns/scripts/proposals/register_canisters_with_sns/user_index.ini index 18fd07ca19..57693814bb 100644 --- a/sns/scripts/proposals/register_canisters_with_sns/user_index.ini +++ b/sns/scripts/proposals/register_canisters_with_sns/user_index.ini @@ -1,3 +1,3 @@ TITLE="Register the user_index as an SNS controlled canister" -URL="https://github.com/open-chat-labs/open-chat/blob/8a4aecfeebffc2c7fd49fb1233448eef7296f51e/backend/canisters/user_index/impl/src/lib.rs" +URL="https://github.com/open-chat-labs/open-chat/tree/master/backend/canisters/user_index/impl/src/lib.rs" SUMMARY="This canister holds a registry of the OC users and controls the local_user_index canister in each subnet" \ No newline at end of file From 266794f719a46c042d1ace97a812d0539ff79194 Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Thu, 25 Jan 2024 09:01:07 +0000 Subject: [PATCH 03/19] Update NotificationsPusher post release (#5260) --- backend/notification_pusher/aws/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/notification_pusher/aws/CHANGELOG.md b/backend/notification_pusher/aws/CHANGELOG.md index bbcd00f6d0..8fdfd443ef 100644 --- a/backend/notification_pusher/aws/CHANGELOG.md +++ b/backend/notification_pusher/aws/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [unreleased] +## [[2.0.1023](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1023-notifications_pusher)] - 2024-01-24 + ### Changed - Increase the number of notification pusher threads ([#5237](https://github.com/open-chat-labs/open-chat/pull/5237)) From 7c96ab3ba4e82e6c46a19fdef4e8114b58ebfd30 Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Thu, 25 Jan 2024 09:05:48 +0000 Subject: [PATCH 04/19] Remove one time code to unsuspend a few users (#5262) --- .../impl/src/lifecycle/post_upgrade.rs | 22 ------------------- 1 file changed, 22 deletions(-) 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 4ac515f12c..c898b6c3c9 100644 --- a/backend/canisters/user_index/impl/src/lifecycle/post_upgrade.rs +++ b/backend/canisters/user_index/impl/src/lifecycle/post_upgrade.rs @@ -1,15 +1,11 @@ use crate::lifecycle::{init_env, init_state}; use crate::memory::get_upgrades_memory; -use crate::updates::unsuspend_user::unsuspend_user_impl; use crate::Data; -use candid::Principal; use canister_logger::LogEntry; use canister_tracing_macros::trace; use ic_cdk_macros::post_upgrade; use stable_memory::get_reader; -use std::time::Duration; use tracing::info; -use types::UserId; use user_index_canister::post_upgrade::Args; use utils::cycles::init_cycles_dispenser_client; @@ -28,22 +24,4 @@ fn post_upgrade(args: Args) { init_state(env, data, args.wasm_version); info!(version = %args.wasm_version, "Post-upgrade complete"); - - let users_to_unsuspend: Vec = [ - "qyzts-uiaaa-aaaar-aw4ca-cai", - "zjayq-ryaaa-aaaar-axhrq-cai", - "o6334-oyaaa-aaaar-awgxa-cai", - "s4i57-nqaaa-aaaar-abzcq-cai", - "vecg6-eqaaa-aaaar-a23rq-cai", - "ne6gg-dqaaa-aaaaf-agzwa-cai", - ] - .iter() - .map(|str| Principal::from_text(str).unwrap().into()) - .collect(); - - ic_cdk_timers::set_timer(Duration::ZERO, || { - ic_cdk::spawn(async move { - futures::future::join_all(users_to_unsuspend.into_iter().map(unsuspend_user_impl)).await; - }) - }); } From 37e20713e579328fc712eaa0e4b7dc4f7e70f605 Mon Sep 17 00:00:00 2001 From: Matt Grogan Date: Thu, 25 Jan 2024 10:25:29 +0000 Subject: [PATCH 05/19] Improve wording of `p2pSwap.confirmSend` (#5265) --- frontend/app/src/i18n/cn.json | 4 ++-- frontend/app/src/i18n/de.json | 4 ++-- frontend/app/src/i18n/en.json | 2 +- frontend/app/src/i18n/es.json | 4 ++-- frontend/app/src/i18n/fr.json | 4 ++-- frontend/app/src/i18n/hi.json | 4 ++-- frontend/app/src/i18n/it.json | 4 ++-- frontend/app/src/i18n/iw.json | 4 ++-- frontend/app/src/i18n/jp.json | 4 ++-- frontend/app/src/i18n/ru.json | 4 ++-- frontend/app/src/i18n/vi.json | 4 ++-- 11 files changed, 21 insertions(+), 21 deletions(-) diff --git a/frontend/app/src/i18n/cn.json b/frontend/app/src/i18n/cn.json index 3c56d2db93..6f0a4b3b29 100644 --- a/frontend/app/src/i18n/cn.json +++ b/frontend/app/src/i18n/cn.json @@ -1226,7 +1226,6 @@ "acceptedBy": "此要约已被 {user} 接受并等待完成。", "youCompleted": "您已接受此优惠。", "completed": "此报价已被 {user} 接受。", - "confirmSend": "当您创建此优惠时,{amount} {token}(包括 2 笔交易费用)将从您的钱包转移到 OpenChat 托管罐。它将一直保留在那里,直到要约过期、您取消要约或有人接受要约。你想继续吗?", "confirmAccept": "当您接受此优惠时,{amount} {token}(包括 2 笔交易费用)将从您的钱包转移到 OpenChat 托管罐。作为交换,您将收到 {amountOther} {tokenOther}。你想继续吗?", "confirmCancel": "当您取消此优惠时,{amount} {token} 将从 OpenChat 托管罐转回到您的钱包。你想继续吗?", "insufficientBalanceMessage": "您至少需要{amount} {token}(包括2笔交易费用)才能接受此交换。", @@ -1238,6 +1237,7 @@ "swap_not_found": "找不到此交换报价", "insufficient_funds": "您的剩余资金不足以接受此掉期优惠", "unknown_accept_error": "接受交换报价时出错", - "unknown_cancel_error": "取消掉期优惠时出错" + "unknown_cancel_error": "取消掉期优惠时出错", + "confirmSend": "当您创建此优惠时,{amount} {token}(包括 2 笔交易费用)将从您的钱包转移到 OpenChat 托管罐。它将一直保留在那里,直到要约过期、您取消要约或要约被接受。你想继续吗?" } } \ No newline at end of file diff --git a/frontend/app/src/i18n/de.json b/frontend/app/src/i18n/de.json index 96daf32240..1997a0108a 100644 --- a/frontend/app/src/i18n/de.json +++ b/frontend/app/src/i18n/de.json @@ -1227,7 +1227,6 @@ "acceptedBy": "Dieses Angebot wurde von {user} angenommen und wartet auf den Abschluss.", "youCompleted": "Sie haben dieses Angebot angenommen.", "completed": "Dieses Angebot wurde von {user} angenommen.", - "confirmSend": "Wenn Sie dieses Angebot erstellen, wird {amount} {token} (inklusive 2 Transaktionsgebühren) von Ihrem Wallet in den OpenChat-Escrow-Kanister übertragen. Es bleibt dort, bis entweder das Angebot abläuft, Sie das Angebot stornieren oder jemand das Angebot annimmt. Möchten Sie fortfahren?", "confirmAccept": "Wenn Sie dieses Angebot annehmen, wird {amount} {token} (inklusive 2 Transaktionsgebühren) von Ihrem Wallet in den OpenChat-Treuhandkanister übertragen. Im Gegenzug erhalten Sie {amountOther} {tokenOther}. Möchten Sie fortfahren?", "confirmCancel": "Wenn Sie dieses Angebot stornieren, wird {amount} {token} aus dem OpenChat-Escrow-Kanister zurück auf Ihr Wallet übertragen. Möchten Sie fortfahren?", "insufficientBalanceMessage": "Sie benötigen mindestens {amount} {token} (inklusive 2 Transaktionsgebühren), um diesen Tausch zu akzeptieren.", @@ -1239,6 +1238,7 @@ "swap_not_found": "Dieses Tauschangebot konnte nicht gefunden werden", "insufficient_funds": "Ihr Guthaben reicht nicht aus, um dieses Tauschangebot anzunehmen", "unknown_accept_error": "Fehler beim Annehmen des Tauschangebots", - "unknown_cancel_error": "Fehler beim Stornieren des Tauschangebots" + "unknown_cancel_error": "Fehler beim Stornieren des Tauschangebots", + "confirmSend": "Wenn Sie dieses Angebot erstellen, wird {amount} {token} (inklusive 2 Transaktionsgebühren) von Ihrem Wallet in den OpenChat-Escrow-Kanister übertragen. Es bleibt dort, bis entweder das Angebot abläuft, Sie das Angebot stornieren oder das Angebot angenommen wird. Möchten Sie fortfahren?" } } \ No newline at end of file diff --git a/frontend/app/src/i18n/en.json b/frontend/app/src/i18n/en.json index 6719b755fc..2fd44b0d62 100644 --- a/frontend/app/src/i18n/en.json +++ b/frontend/app/src/i18n/en.json @@ -1217,7 +1217,7 @@ "acceptedBy": "This offer has been accepted by {user} and is pending completion.", "youCompleted": "You have accepted this offer.", "completed": "This offer has been accepted by {user}.", - "confirmSend": "When you create this offer {amount} {token} (includes 2 transaction fees) will be transferred from your wallet to the OpenChat Escrow canister. It will stay there until either the offer expires, you cancel the offer, or someone accepts the offer. Do you wish to proceed?", + "confirmSend": "When you create this offer {amount} {token} (includes 2 transaction fees) will be transferred from your wallet to the OpenChat Escrow canister. It will stay there until either the offer expires, you cancel the offer, or the offer is accepted. Do you wish to proceed?", "confirmAccept": "When you accept this offer {amount} {token} (includes 2 transaction fees) will be transferred from your wallet to the OpenChat Escrow canister. You will receive {amountOther} {tokenOther} in exchange. Do you wish to proceed?", "confirmCancel": "When you cancel this offer {amount} {token} will be transferred from the OpenChat Escrow canister back to your wallet. Do you wish to proceed?", "insufficientBalanceMessage": "You need at least {amount} {token} (includes 2 transaction fees) to accept this swap.", diff --git a/frontend/app/src/i18n/es.json b/frontend/app/src/i18n/es.json index a248eefa97..5e3ba1fd82 100644 --- a/frontend/app/src/i18n/es.json +++ b/frontend/app/src/i18n/es.json @@ -1227,7 +1227,6 @@ "acceptedBy": "Esta oferta ha sido aceptada por {user} y está pendiente de finalización.", "youCompleted": "Has aceptado esta oferta.", "completed": "Esta oferta ha sido aceptada por {user}.", - "confirmSend": "Cuando cree esta oferta, {amount} {token} (incluye 2 tarifas de transacción) se transferirá de su billetera al contenedor de depósito en garantía de OpenChat. Permanecerá allí hasta que la oferta caduque, usted la cancele o alguien la acepte. ¿Desea continuar?", "confirmAccept": "Cuando acepte esta oferta, {amount} {token} (incluye 2 tarifas de transacción) se transferirá de su billetera al contenedor de depósito en garantía de OpenChat. Recibirás {amountOther} {tokenOther} a cambio. ¿Desea continuar?", "confirmCancel": "Cuando cancele esta oferta, {amount} {token} se transferirá del contenedor de OpenChat Escrow a su billetera. ¿Desea continuar?", "insufficientBalanceMessage": "Necesita al menos {amount} {token} (incluye 2 tarifas de transacción) para aceptar este intercambio.", @@ -1239,6 +1238,7 @@ "swap_not_found": "Esta oferta de intercambio no se pudo encontrar", "insufficient_funds": "No le quedan fondos suficientes para aceptar esta oferta de intercambio", "unknown_accept_error": "Error al aceptar la oferta de intercambio", - "unknown_cancel_error": "Error al cancelar la oferta de intercambio" + "unknown_cancel_error": "Error al cancelar la oferta de intercambio", + "confirmSend": "Cuando cree esta oferta, {amount} {token} (incluye 2 tarifas de transacción) se transferirá de su billetera al contenedor de depósito en garantía de OpenChat. Permanecerá allí hasta que la oferta caduque, usted la cancele o se acepte la oferta. ¿Desea continuar?" } } \ No newline at end of file diff --git a/frontend/app/src/i18n/fr.json b/frontend/app/src/i18n/fr.json index 2bd5ce1b85..c661e4095f 100644 --- a/frontend/app/src/i18n/fr.json +++ b/frontend/app/src/i18n/fr.json @@ -1225,7 +1225,6 @@ "acceptedBy": "Cette offre a été acceptée par {user} et est en attente de finalisation.", "youCompleted": "Vous avez accepté cette offre.", "completed": "Cette offre a été acceptée par {user}.", - "confirmSend": "Lorsque vous créez cette offre, {amount} {token} (comprend 2 frais de transaction) sera transféré de votre portefeuille vers le canister OpenChat Escrow. Il y restera jusqu'à ce que l'offre expire, que vous annuliez l'offre ou que quelqu'un accepte l'offre. Voulez-vous continuer?", "confirmAccept": "Lorsque vous acceptez cette offre, {amount} {token} (comprend 2 frais de transaction) sera transféré de votre portefeuille vers le canister OpenChat Escrow. Vous recevrez {amountOther} {tokenOther} en échange. Voulez-vous continuer?", "confirmCancel": "Lorsque vous annulez cette offre, {amount} {token} sera transféré du conteneur OpenChat Escrow vers votre portefeuille. Voulez-vous continuer?", "insufficientBalanceMessage": "Vous avez besoin d'au moins {amount} {token} (comprend 2 frais de transaction) pour accepter cet échange.", @@ -1237,6 +1236,7 @@ "swap_not_found": "Cette offre d'échange est introuvable", "insufficient_funds": "Il ne vous reste pas suffisamment de fonds pour accepter cette offre d'échange", "unknown_accept_error": "Erreur lors de l'acceptation de l'offre d'échange", - "unknown_cancel_error": "Erreur lors de l'annulation de l'offre d'échange" + "unknown_cancel_error": "Erreur lors de l'annulation de l'offre d'échange", + "confirmSend": "Lorsque vous créez cette offre, {amount} {token} (comprend 2 frais de transaction) sera transféré de votre portefeuille vers le canister OpenChat Escrow. Il y restera jusqu'à ce que l'offre expire, que vous annuliez l'offre ou que l'offre soit acceptée. Voulez-vous continuer?" } } \ No newline at end of file diff --git a/frontend/app/src/i18n/hi.json b/frontend/app/src/i18n/hi.json index 621c1e8ad9..2d1ca16a64 100644 --- a/frontend/app/src/i18n/hi.json +++ b/frontend/app/src/i18n/hi.json @@ -1217,7 +1217,6 @@ "acceptedBy": "यह प्रस्ताव {user} द्वारा स्वीकार कर लिया गया है और पूरा होने के लिए लंबित है।", "youCompleted": "आपने यह प्रस्ताव स्वीकार कर लिया है.", "completed": "यह प्रस्ताव {user} द्वारा स्वीकार कर लिया गया है.", - "confirmSend": "जब आप यह ऑफर बनाते हैं तो {amount} {token} (2 लेनदेन शुल्क शामिल है) आपके वॉलेट से ओपनचैट एस्क्रो कनस्तर में स्थानांतरित कर दिया जाएगा। यह तब तक वहीं रहेगा जब तक ऑफ़र समाप्त नहीं हो जाता, आप ऑफ़र रद्द नहीं कर देते, या कोई ऑफ़र स्वीकार नहीं कर लेता। क्या आप आगे बढ़ना चाहते हैं?", "confirmAccept": "जब आप इस ऑफर को स्वीकार करते हैं तो {amount} {token} (2 लेनदेन शुल्क शामिल है) आपके वॉलेट से ओपनचैट एस्क्रो कनस्तर में स्थानांतरित कर दिया जाएगा। बदले में आपको {amountOther} {tokenOther} प्राप्त होगा। क्या आप आगे बढ़ना चाहते हैं?", "confirmCancel": "जब आप इस ऑफर को रद्द करते हैं तो {amount} {token} को ओपनचैट एस्क्रो कनस्तर से वापस आपके वॉलेट में स्थानांतरित कर दिया जाएगा। क्या आप आगे बढ़ना चाहते हैं?", "insufficientBalanceMessage": "इस स्वैप को स्वीकार करने के लिए आपको कम से कम {amount} {token} (2 लेनदेन शुल्क शामिल) की आवश्यकता है।", @@ -1229,6 +1228,7 @@ "swap_not_found": "यह स्वैप ऑफर नहीं मिल सका", "insufficient_funds": "इस स्वैप प्रस्ताव को स्वीकार करने के लिए आपके पास अपर्याप्त धनराशि शेष है", "unknown_accept_error": "स्वैप प्रस्ताव स्वीकार करने में त्रुटि", - "unknown_cancel_error": "स्वैप ऑफ़र रद्द करने में त्रुटि" + "unknown_cancel_error": "स्वैप ऑफ़र रद्द करने में त्रुटि", + "confirmSend": "जब आप यह ऑफर बनाते हैं तो {amount} {token} (2 लेनदेन शुल्क शामिल है) आपके वॉलेट से ओपनचैट एस्क्रो कनस्तर में स्थानांतरित कर दिया जाएगा। यह तब तक वहीं रहेगा जब तक ऑफ़र समाप्त नहीं हो जाता, आप ऑफ़र रद्द नहीं कर देते, या ऑफ़र स्वीकार नहीं कर लिया जाता। क्या आप आगे बढ़ना चाहते हैं?" } } \ No newline at end of file diff --git a/frontend/app/src/i18n/it.json b/frontend/app/src/i18n/it.json index 76c6790fbc..c305f1a17d 100644 --- a/frontend/app/src/i18n/it.json +++ b/frontend/app/src/i18n/it.json @@ -1225,7 +1225,6 @@ "acceptedBy": "Questa offerta è stata accettata da {user} ed è in attesa di completamento.", "youCompleted": "Hai accettato questa offerta.", "completed": "Questa offerta è stata accettata da {user}.", - "confirmSend": "Quando crei questa offerta, {amount} {token} (include 2 commissioni di transazione) verrà trasferito dal tuo portafoglio al contenitore di deposito a garanzia di OpenChat. Rimarrà lì fino alla scadenza dell'offerta, fino all'annullamento dell'offerta o fino all'accettazione dell'offerta da parte di qualcuno. Desideri procedere?", "confirmAccept": "Quando accetti questa offerta, {amount} {token} (include 2 commissioni di transazione) verrà trasferito dal tuo portafoglio al contenitore di deposito a garanzia di OpenChat. Riceverai {amountOther} {tokenOther} in cambio. Desideri procedere?", "confirmCancel": "Quando annulli questa offerta, {amount} {token} verrà trasferito dal contenitore di deposito in garanzia di OpenChat al tuo portafoglio. Desideri procedere?", "insufficientBalanceMessage": "Sono necessari almeno {amount} {token} (include 2 commissioni di transazione) per accettare questo scambio.", @@ -1237,6 +1236,7 @@ "swap_not_found": "Impossibile trovare questa offerta di scambio", "insufficient_funds": "Non hai fondi rimanenti sufficienti per accettare questa offerta di scambio", "unknown_accept_error": "Errore nell'accettazione dell'offerta di scambio", - "unknown_cancel_error": "Errore durante l'annullamento dell'offerta di scambio" + "unknown_cancel_error": "Errore durante l'annullamento dell'offerta di scambio", + "confirmSend": "Quando crei questa offerta, {amount} {token} (include 2 commissioni di transazione) verrà trasferito dal tuo portafoglio al contenitore di deposito a garanzia di OpenChat. Rimarrà lì fino alla scadenza dell'offerta, all'annullamento dell'offerta o all'accettazione dell'offerta. Desideri procedere?" } } \ No newline at end of file diff --git a/frontend/app/src/i18n/iw.json b/frontend/app/src/i18n/iw.json index bd951d1e5f..2a46c4de6c 100644 --- a/frontend/app/src/i18n/iw.json +++ b/frontend/app/src/i18n/iw.json @@ -1223,7 +1223,6 @@ "acceptedBy": "הצעה זו התקבלה על ידי {user} והיא ממתינה להשלמתה.", "youCompleted": "קיבלת את ההצעה הזו.", "completed": "הצעה זו התקבלה על ידי {user}.", - "confirmSend": "כאשר אתה יוצר את ההצעה הזו {amount} {token} (כולל 2 עמלות עסקה) יועבר מהארנק שלך אל קופסת ה-OpenChat Escrow. זה יישאר שם עד שההצעה יפוג, תבטל את ההצעה או שמישהו יקבל את ההצעה. האם אתה מעוניין להמשיך?", "confirmAccept": "כאשר תקבל הצעה זו {amount} {token} (כולל 2 עמלות עסקה) יועברו מהארנק שלך אל קופסת ה-OpenChat Escrow. תקבל {amountOther} {tokenOther} בתמורה. האם אתה מעוניין להמשיך?", "confirmCancel": "כאשר תבטל הצעה זו {amount} {token} יועבר ממיכל ה-OpenChat Escrow בחזרה לארנק שלך. האם אתה מעוניין להמשיך?", "insufficientBalanceMessage": "אתה צריך לפחות {amount} {token} (כולל 2 עמלות עסקה) כדי לקבל את ההחלפה הזו.", @@ -1235,6 +1234,7 @@ "swap_not_found": "לא ניתן למצוא את הצעת ההחלפה הזו", "insufficient_funds": "אין לך מספיק כסף כדי לקבל את הצעת ההחלפה הזו", "unknown_accept_error": "שגיאה בקבלת הצעת ההחלפה", - "unknown_cancel_error": "שגיאה בביטול הצעת ההחלפה" + "unknown_cancel_error": "שגיאה בביטול הצעת ההחלפה", + "confirmSend": "כאשר אתה יוצר את ההצעה הזו {amount} {token} (כולל 2 עמלות עסקה) יועבר מהארנק שלך אל קופסת ה-OpenChat Escrow. זה יישאר שם עד שההצעה יפוג, תבטל את ההצעה או שההצעה תתקבל. האם אתה מעוניין להמשיך?" } } \ No newline at end of file diff --git a/frontend/app/src/i18n/jp.json b/frontend/app/src/i18n/jp.json index 3972abed20..8e438dcf52 100644 --- a/frontend/app/src/i18n/jp.json +++ b/frontend/app/src/i18n/jp.json @@ -1226,7 +1226,6 @@ "acceptedBy": "このオファーは {user} によって受け入れられ、完了待ちです。", "youCompleted": "あなたはこの申し出を受け入れました。", "completed": "このオファーは {user} によって受け入れられました。", - "confirmSend": "このオファーを作成すると、{amount} {token} (2 つの取引手数料を含む) がウォレットから OpenChat エスクロー キャニスターに転送されます。オファーの有効期限が切れるか、ユーザーがオファーをキャンセルするか、誰かがオファーを受け入れるまで、そこに残ります。続行しますか?", "confirmAccept": "このオファーを受け入れると、{amount} {token} (2 つの取引手数料を含む) がウォレットから OpenChat エスクロー キャニスターに転送されます。代わりに {amountOther} {tokenOther} を受け取ります。続行しますか?", "confirmCancel": "このオファーをキャンセルすると、{amount} {token} が OpenChat エスクロー キャニスターからウォレットに戻されます。続行しますか?", "insufficientBalanceMessage": "このスワップを受け入れるには、少なくとも {amount} {token} (2 つの取引手数料を含む) が必要です。", @@ -1238,6 +1237,7 @@ "swap_not_found": "このスワップ オファーが見つかりませんでした", "insufficient_funds": "このスワップオファーを受け入れるには資金が不足しています", "unknown_accept_error": "スワップオファーの受け入れエラー", - "unknown_cancel_error": "スワップオファーのキャンセル中にエラーが発生しました" + "unknown_cancel_error": "スワップオファーのキャンセル中にエラーが発生しました", + "confirmSend": "このオファーを作成すると、{amount} {token} (2 つの取引手数料を含む) がウォレットから OpenChat エスクロー キャニスターに転送されます。オファーの有効期限が切れるか、オファーをキャンセルするか、オファーが受け入れられるまで、そこに残ります。続行しますか?" } } \ No newline at end of file diff --git a/frontend/app/src/i18n/ru.json b/frontend/app/src/i18n/ru.json index ce9b96a913..273e17a4d6 100644 --- a/frontend/app/src/i18n/ru.json +++ b/frontend/app/src/i18n/ru.json @@ -1225,7 +1225,6 @@ "acceptedBy": "Это предложение было принято {user} и ожидает завершения.", "youCompleted": "Вы приняли это предложение.", "completed": "Это предложение было принято {user}.", - "confirmSend": "Когда вы создадите это предложение, {amount} {token} (включает комиссию за 2 транзакции) будет переведен из вашего кошелька в контейнер условного депонирования OpenChat. Он будет оставаться там до тех пор, пока не истечет срок действия предложения, вы не отмените его или кто-то не примет предложение. Вы хотите продолжить?", "confirmAccept": "Когда вы примете это предложение, {amount} {token} (включает 2 комиссии за транзакцию) будет переведен из вашего кошелька в контейнер условного депонирования OpenChat. Взамен вы получите {amountOther} {tokenOther}. Вы хотите продолжить?", "confirmCancel": "Когда вы отмените это предложение, {amount} {token} будет переведен из контейнера OpenChat Escrow обратно в ваш кошелек. Вы хотите продолжить?", "insufficientBalanceMessage": "Чтобы принять этот своп, вам необходимо как минимум {amount} {token} (включая комиссию за 2 транзакции).", @@ -1237,6 +1236,7 @@ "swap_not_found": "Данное предложение обмена не найдено.", "insufficient_funds": "У вас недостаточно средств, чтобы принять это предложение обмена", "unknown_accept_error": "Ошибка при принятии предложения обмена.", - "unknown_cancel_error": "Ошибка при отмене предложения обмена." + "unknown_cancel_error": "Ошибка при отмене предложения обмена.", + "confirmSend": "Когда вы создадите это предложение, {amount} {token} (включает комиссию за 2 транзакции) будет переведен из вашего кошелька в контейнер условного депонирования OpenChat. Он будет оставаться там до тех пор, пока не истечет срок действия предложения, вы не отмените его или предложение не будет принято. Вы хотите продолжить?" } } \ No newline at end of file diff --git a/frontend/app/src/i18n/vi.json b/frontend/app/src/i18n/vi.json index 242773c4ee..611e96a1f8 100644 --- a/frontend/app/src/i18n/vi.json +++ b/frontend/app/src/i18n/vi.json @@ -1226,7 +1226,6 @@ "acceptedBy": "Ưu đãi này đã được {user} chấp nhận và đang chờ hoàn thành.", "youCompleted": "Bạn đã chấp nhận lời đề nghị này.", "completed": "Ưu đãi này đã được {user} chấp nhận.", - "confirmSend": "Khi bạn tạo ưu đãi này, {amount} {token} (bao gồm 2 phí giao dịch) sẽ được chuyển từ ví của bạn sang hộp Ký quỹ OpenChat. Nó sẽ ở đó cho đến khi ưu đãi hết hạn, bạn hủy ưu đãi hoặc ai đó chấp nhận ưu đãi. Bạn có muốn tiếp tục?", "confirmAccept": "Khi bạn chấp nhận ưu đãi này, {amount} {token} (bao gồm 2 phí giao dịch) sẽ được chuyển từ ví của bạn sang hộp Ký quỹ OpenChat. Đổi lại bạn sẽ nhận được {amountOther} {tokenOther}. Bạn có muốn tiếp tục?", "confirmCancel": "Khi bạn hủy ưu đãi này, {amount} {token} sẽ được chuyển từ hộp Ký quỹ OpenChat trở lại ví của bạn. Bạn có muốn tiếp tục?", "insufficientBalanceMessage": "Bạn cần ít nhất {amount} {token} (bao gồm 2 phí giao dịch) để chấp nhận giao dịch hoán đổi này.", @@ -1238,6 +1237,7 @@ "swap_not_found": "Không thể tìm thấy ưu đãi trao đổi này", "insufficient_funds": "Bạn không còn đủ tiền để chấp nhận đề nghị hoán đổi này", "unknown_accept_error": "Lỗi chấp nhận đề nghị trao đổi", - "unknown_cancel_error": "Lỗi hủy ưu đãi trao đổi" + "unknown_cancel_error": "Lỗi hủy ưu đãi trao đổi", + "confirmSend": "Khi bạn tạo ưu đãi này, {amount} {token} (bao gồm 2 phí giao dịch) sẽ được chuyển từ ví của bạn sang hộp Ký quỹ OpenChat. Nó sẽ ở đó cho đến khi ưu đãi hết hạn, bạn hủy ưu đãi hoặc ưu đãi được chấp nhận. Bạn có muốn tiếp tục?" } } \ No newline at end of file From e1e4d4cabd8587203dd84ef9867f8bc3003155d2 Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Thu, 25 Jan 2024 11:27:40 +0000 Subject: [PATCH 06/19] Sync user principals to the Identity canister (#5264) --- Cargo.lock | 15 ++++ Cargo.toml | 1 + backend/canisters/identity/CHANGELOG.md | 5 ++ backend/canisters/identity/api/Cargo.toml | 1 + backend/canisters/identity/api/can.did | 10 ++- backend/canisters/identity/api/src/lib.rs | 2 + backend/canisters/identity/api/src/main.rs | 5 +- .../api/src/queries/check_auth_principal.rs | 12 ++++ .../canisters/identity/api/src/queries/mod.rs | 1 + .../c2c_sync_legacy_user_principals.rs | 12 ++++ .../canisters/identity/api/src/updates/mod.rs | 1 + .../canisters/identity/c2c_client/Cargo.toml | 14 ++++ .../canisters/identity/c2c_client/src/lib.rs | 7 ++ backend/canisters/identity/impl/src/guards.rs | 10 ++- backend/canisters/identity/impl/src/lib.rs | 11 +++ .../canisters/identity/impl/src/model/mod.rs | 1 + .../impl/src/model/user_principals.rs | 38 ++++++++++ .../impl/src/queries/check_principal.rs | 20 ++++++ .../identity/impl/src/queries/mod.rs | 1 + .../c2c_sync_legacy_user_principals.rs | 18 +++++ .../identity/impl/src/updates/mod.rs | 1 + backend/canisters/user_index/CHANGELOG.md | 1 + backend/canisters/user_index/impl/Cargo.toml | 2 + .../canisters/user_index/impl/src/jobs/mod.rs | 6 +- .../src/jobs/sync_legacy_user_principals.rs | 71 +++++++++++++++++++ backend/canisters/user_index/impl/src/lib.rs | 11 ++- .../impl/src/lifecycle/post_upgrade.rs | 15 +++- .../impl/src/updates/c2c_notify_events.rs | 4 ++ .../integration_tests/src/client/identity.rs | 3 +- .../integration_tests/src/identity_tests.rs | 36 ++++++++++ backend/integration_tests/src/lib.rs | 1 + 31 files changed, 328 insertions(+), 8 deletions(-) create mode 100644 backend/canisters/identity/api/src/queries/check_auth_principal.rs create mode 100644 backend/canisters/identity/api/src/queries/mod.rs create mode 100644 backend/canisters/identity/api/src/updates/c2c_sync_legacy_user_principals.rs create mode 100644 backend/canisters/identity/c2c_client/Cargo.toml create mode 100644 backend/canisters/identity/c2c_client/src/lib.rs create mode 100644 backend/canisters/identity/impl/src/model/mod.rs create mode 100644 backend/canisters/identity/impl/src/model/user_principals.rs create mode 100644 backend/canisters/identity/impl/src/queries/check_principal.rs create mode 100644 backend/canisters/identity/impl/src/updates/c2c_sync_legacy_user_principals.rs create mode 100644 backend/canisters/user_index/impl/src/jobs/sync_legacy_user_principals.rs create mode 100644 backend/integration_tests/src/identity_tests.rs diff --git a/Cargo.lock b/Cargo.lock index b745ac1aca..800d0f2d9e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3365,10 +3365,23 @@ name = "identity_canister" version = "0.1.0" dependencies = [ "candid", + "candid_gen", "serde", "types", ] +[[package]] +name = "identity_canister_c2c_client" +version = "0.1.0" +dependencies = [ + "candid", + "canister_client", + "ic-cdk 0.11.3", + "identity_canister", + "tracing", + "types", +] + [[package]] name = "identity_canister_impl" version = "0.1.0" @@ -7337,6 +7350,8 @@ dependencies = [ "ic-stable-structures", "icrc-ledger-types", "icrc_ledger_canister_c2c_client", + "identity_canister", + "identity_canister_c2c_client", "itertools 0.11.0", "ledger_utils", "local_user_index_canister", diff --git a/Cargo.toml b/Cargo.toml index 736fd0fa6d..6f6996fd69 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,6 +31,7 @@ members = [ "backend/canisters/group_index/client", "backend/canisters/group_index/impl", "backend/canisters/identity/api", + "backend/canisters/identity/c2c_client", "backend/canisters/identity/impl", "backend/canisters/local_group_index/api", "backend/canisters/local_group_index/c2c_client", diff --git a/backend/canisters/identity/CHANGELOG.md b/backend/canisters/identity/CHANGELOG.md index 8646827d5a..1a92155768 100644 --- a/backend/canisters/identity/CHANGELOG.md +++ b/backend/canisters/identity/CHANGELOG.md @@ -4,3 +4,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [unreleased] + +### Added + +- Implement ability to update user principals ([#5220](https://github.com/open-chat-labs/open-chat/pull/5220)) +- Sync user principals from the UserIndex canister ([#5264](https://github.com/open-chat-labs/open-chat/pull/5264)) diff --git a/backend/canisters/identity/api/Cargo.toml b/backend/canisters/identity/api/Cargo.toml index a8ad746d19..2e5ea8cc72 100644 --- a/backend/canisters/identity/api/Cargo.toml +++ b/backend/canisters/identity/api/Cargo.toml @@ -7,5 +7,6 @@ edition = "2021" [dependencies] candid = { workspace = true } +candid_gen = { path = "../../../libraries/candid_gen" } serde = { workspace = true } types = { path = "../../../libraries/types" } diff --git a/backend/canisters/identity/api/can.did b/backend/canisters/identity/api/can.did index f424d81e86..f6cb81ca38 100644 --- a/backend/canisters/identity/api/can.did +++ b/backend/canisters/identity/api/can.did @@ -1 +1,9 @@ -service : {} +type CheckAuthPrincipalResponse = variant { + Success; + Legacy; + NotFound; +}; + +service : { + check_auth_principal : (record {}) -> (CheckAuthPrincipalResponse) query; +} diff --git a/backend/canisters/identity/api/src/lib.rs b/backend/canisters/identity/api/src/lib.rs index 9550e16025..048db36a9f 100644 --- a/backend/canisters/identity/api/src/lib.rs +++ b/backend/canisters/identity/api/src/lib.rs @@ -1,5 +1,7 @@ mod lifecycle; +mod queries; mod updates; pub use lifecycle::*; +pub use queries::*; pub use updates::*; diff --git a/backend/canisters/identity/api/src/main.rs b/backend/canisters/identity/api/src/main.rs index 37e8c25054..e40a62a40e 100644 --- a/backend/canisters/identity/api/src/main.rs +++ b/backend/canisters/identity/api/src/main.rs @@ -1,5 +1,8 @@ -#[allow(deprecated)] +use candid_gen::generate_candid_method; + fn main() { + generate_candid_method!(identity, check_auth_principal, query); + candid::export_service!(); std::print!("{}", __export_service()); } diff --git a/backend/canisters/identity/api/src/queries/check_auth_principal.rs b/backend/canisters/identity/api/src/queries/check_auth_principal.rs new file mode 100644 index 0000000000..60a6443d40 --- /dev/null +++ b/backend/canisters/identity/api/src/queries/check_auth_principal.rs @@ -0,0 +1,12 @@ +use candid::CandidType; +use serde::{Deserialize, Serialize}; +use types::Empty; + +pub type Args = Empty; + +#[derive(CandidType, Serialize, Deserialize)] +pub enum Response { + Success, + Legacy, + NotFound, +} diff --git a/backend/canisters/identity/api/src/queries/mod.rs b/backend/canisters/identity/api/src/queries/mod.rs new file mode 100644 index 0000000000..baffbe38c7 --- /dev/null +++ b/backend/canisters/identity/api/src/queries/mod.rs @@ -0,0 +1 @@ +pub mod check_auth_principal; diff --git a/backend/canisters/identity/api/src/updates/c2c_sync_legacy_user_principals.rs b/backend/canisters/identity/api/src/updates/c2c_sync_legacy_user_principals.rs new file mode 100644 index 0000000000..ec113fb7a3 --- /dev/null +++ b/backend/canisters/identity/api/src/updates/c2c_sync_legacy_user_principals.rs @@ -0,0 +1,12 @@ +use candid::{CandidType, Principal}; +use serde::{Deserialize, Serialize}; + +#[derive(CandidType, Serialize, Deserialize, Debug)] +pub struct Args { + pub principals: Vec, +} + +#[derive(CandidType, Serialize, Deserialize, Debug)] +pub enum Response { + Success, +} diff --git a/backend/canisters/identity/api/src/updates/mod.rs b/backend/canisters/identity/api/src/updates/mod.rs index b94a1fe5f4..06fb45e737 100644 --- a/backend/canisters/identity/api/src/updates/mod.rs +++ b/backend/canisters/identity/api/src/updates/mod.rs @@ -1 +1,2 @@ +pub mod c2c_sync_legacy_user_principals; pub mod update_user_principal; diff --git a/backend/canisters/identity/c2c_client/Cargo.toml b/backend/canisters/identity/c2c_client/Cargo.toml new file mode 100644 index 0000000000..af0358b808 --- /dev/null +++ b/backend/canisters/identity/c2c_client/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "identity_canister_c2c_client" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +candid = { workspace = true } +canister_client = { path = "../../../libraries/canister_client" } +ic-cdk = { workspace = true } +identity_canister = { path = "../api" } +tracing = { workspace = true } +types = { path = "../../../libraries/types" } diff --git a/backend/canisters/identity/c2c_client/src/lib.rs b/backend/canisters/identity/c2c_client/src/lib.rs new file mode 100644 index 0000000000..8001efc6ba --- /dev/null +++ b/backend/canisters/identity/c2c_client/src/lib.rs @@ -0,0 +1,7 @@ +use canister_client::generate_candid_c2c_call; +use identity_canister::*; + +// Queries + +// Updates +generate_candid_c2c_call!(c2c_sync_legacy_user_principals); diff --git a/backend/canisters/identity/impl/src/guards.rs b/backend/canisters/identity/impl/src/guards.rs index 60780451f2..e20cc3210f 100644 --- a/backend/canisters/identity/impl/src/guards.rs +++ b/backend/canisters/identity/impl/src/guards.rs @@ -1,9 +1,17 @@ use crate::read_state; +pub fn caller_is_user_index_canister() -> Result<(), String> { + if read_state(|state| state.is_caller_user_index_canister()) { + Ok(()) + } else { + Err("Caller is not the user_index canister".to_owned()) + } +} + pub fn caller_is_governance_principal() -> Result<(), String> { if read_state(|state| state.is_caller_governance_principal()) { Ok(()) } else { - Err("Caller is not the governance principal".to_owned()) + Err("Caller is not a governance principal".to_owned()) } } diff --git a/backend/canisters/identity/impl/src/lib.rs b/backend/canisters/identity/impl/src/lib.rs index 654cae403e..886ea1f752 100644 --- a/backend/canisters/identity/impl/src/lib.rs +++ b/backend/canisters/identity/impl/src/lib.rs @@ -1,3 +1,4 @@ +use crate::model::user_principals::UserPrincipals; use candid::Principal; use canister_state_macros::canister_state; use serde::{Deserialize, Serialize}; @@ -9,6 +10,7 @@ use utils::env::Environment; mod guards; mod lifecycle; mod memory; +mod model; mod queries; mod updates; @@ -28,6 +30,11 @@ impl RuntimeState { RuntimeState { env, data } } + pub fn is_caller_user_index_canister(&self) -> bool { + let caller = self.env.caller(); + self.data.user_index_canister_id == caller + } + pub fn is_caller_governance_principal(&self) -> bool { let caller = self.env.caller(); self.data.governance_principals.contains(&caller) @@ -53,6 +60,8 @@ struct Data { pub governance_principals: HashSet, pub user_index_canister_id: CanisterId, pub cycles_dispenser_canister_id: CanisterId, + pub user_principals: UserPrincipals, + pub legacy_principals: HashSet, pub rng_seed: [u8; 32], pub test_mode: bool, } @@ -68,6 +77,8 @@ impl Data { governance_principals, user_index_canister_id, cycles_dispenser_canister_id, + user_principals: UserPrincipals::default(), + legacy_principals: HashSet::default(), rng_seed: [0; 32], test_mode, } diff --git a/backend/canisters/identity/impl/src/model/mod.rs b/backend/canisters/identity/impl/src/model/mod.rs new file mode 100644 index 0000000000..e40db65223 --- /dev/null +++ b/backend/canisters/identity/impl/src/model/mod.rs @@ -0,0 +1 @@ +pub mod user_principals; diff --git a/backend/canisters/identity/impl/src/model/user_principals.rs b/backend/canisters/identity/impl/src/model/user_principals.rs new file mode 100644 index 0000000000..ecfc1168fd --- /dev/null +++ b/backend/canisters/identity/impl/src/model/user_principals.rs @@ -0,0 +1,38 @@ +use candid::Principal; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; +use std::ops::Index; + +#[derive(Serialize, Deserialize, Default)] +pub struct UserPrincipals { + user_principals: Vec, + auth_principal_to_index: HashMap, +} + +#[derive(Serialize, Deserialize)] +pub struct UserPrincipal { + pub index: u32, + pub principal: Principal, + pub auth_principals: Vec, +} + +impl UserPrincipals { + #[allow(dead_code)] + pub fn push(&mut self, index: u32, principal: Principal, auth_principal: Principal) { + assert_eq!(self.user_principals.len(), index as usize); + assert!(!self.auth_principal_to_index.contains_key(&auth_principal)); + + self.user_principals.push(UserPrincipal { + index, + principal, + auth_principals: vec![auth_principal], + }); + self.auth_principal_to_index.insert(auth_principal, index); + } + + pub fn get_by_auth_principal(&self, auth_principal: &Principal) -> Option<&UserPrincipal> { + self.auth_principal_to_index + .get(auth_principal) + .map(|id| self.user_principals.index(*id as usize)) + } +} diff --git a/backend/canisters/identity/impl/src/queries/check_principal.rs b/backend/canisters/identity/impl/src/queries/check_principal.rs new file mode 100644 index 0000000000..b92c82c563 --- /dev/null +++ b/backend/canisters/identity/impl/src/queries/check_principal.rs @@ -0,0 +1,20 @@ +use crate::{read_state, RuntimeState}; +use ic_cdk_macros::query; +use identity_canister::check_auth_principal::{Response::*, *}; + +#[query] +fn check_auth_principal() -> Response { + read_state(check_auth_principal_impl) +} + +fn check_auth_principal_impl(state: &RuntimeState) -> Response { + let caller = state.env.caller(); + + if state.data.user_principals.get_by_auth_principal(&caller).is_some() { + Success + } else if state.data.legacy_principals.contains(&caller) { + Legacy + } else { + NotFound + } +} diff --git a/backend/canisters/identity/impl/src/queries/mod.rs b/backend/canisters/identity/impl/src/queries/mod.rs index 1cfa1ad736..1b7f5e66a9 100644 --- a/backend/canisters/identity/impl/src/queries/mod.rs +++ b/backend/canisters/identity/impl/src/queries/mod.rs @@ -1 +1,2 @@ +mod check_principal; mod http_request; diff --git a/backend/canisters/identity/impl/src/updates/c2c_sync_legacy_user_principals.rs b/backend/canisters/identity/impl/src/updates/c2c_sync_legacy_user_principals.rs new file mode 100644 index 0000000000..02bbb29208 --- /dev/null +++ b/backend/canisters/identity/impl/src/updates/c2c_sync_legacy_user_principals.rs @@ -0,0 +1,18 @@ +use crate::guards::caller_is_user_index_canister; +use crate::{mutate_state, RuntimeState}; +use canister_tracing_macros::trace; +use ic_cdk_macros::update; +use identity_canister::c2c_sync_legacy_user_principals::{Response::*, *}; + +#[update(guard = "caller_is_user_index_canister")] +#[trace] +fn c2c_sync_legacy_user_principals(args: Args) -> Response { + mutate_state(|state| c2c_sync_legacy_user_principals_impl(args, state)) +} + +fn c2c_sync_legacy_user_principals_impl(args: Args, state: &mut RuntimeState) -> Response { + for principal in args.principals { + state.data.legacy_principals.insert(principal); + } + Success +} diff --git a/backend/canisters/identity/impl/src/updates/mod.rs b/backend/canisters/identity/impl/src/updates/mod.rs index 4b480f9fcb..4c28921801 100644 --- a/backend/canisters/identity/impl/src/updates/mod.rs +++ b/backend/canisters/identity/impl/src/updates/mod.rs @@ -1 +1,2 @@ +mod c2c_sync_legacy_user_principals; mod update_user_principal; diff --git a/backend/canisters/user_index/CHANGELOG.md b/backend/canisters/user_index/CHANGELOG.md index 824734be40..eafa30e5f6 100644 --- a/backend/canisters/user_index/CHANGELOG.md +++ b/backend/canisters/user_index/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Added - Implement ability to update user principals ([#5220](https://github.com/open-chat-labs/open-chat/pull/5220)) +- Sync user principals to the Identity canister ([#5264](https://github.com/open-chat-labs/open-chat/pull/5264)) ### Changed diff --git a/backend/canisters/user_index/impl/Cargo.toml b/backend/canisters/user_index/impl/Cargo.toml index 4ff2fb79d0..38f2f6e7d5 100644 --- a/backend/canisters/user_index/impl/Cargo.toml +++ b/backend/canisters/user_index/impl/Cargo.toml @@ -33,6 +33,8 @@ ic-ledger-types = { workspace = true } ic-stable-structures = { workspace = true } icrc_ledger_canister_c2c_client = { path = "../../../external_canisters/icrc_ledger/c2c_client" } icrc-ledger-types = { workspace = true } +identity_canister = { path = "../../identity/api" } +identity_canister_c2c_client = { path = "../../identity/c2c_client" } itertools = { workspace = true } local_user_index_canister = { path = "../../local_user_index/api" } local_user_index_canister_c2c_client = { path = "../../local_user_index/c2c_client" } diff --git a/backend/canisters/user_index/impl/src/jobs/mod.rs b/backend/canisters/user_index/impl/src/jobs/mod.rs index ac62333f68..1ff4e7d125 100644 --- a/backend/canisters/user_index/impl/src/jobs/mod.rs +++ b/backend/canisters/user_index/impl/src/jobs/mod.rs @@ -3,14 +3,16 @@ pub mod make_pending_payments; pub mod notify_user_principal_updates; pub mod submit_message_to_modclub; pub mod sync_events_to_local_user_index_canisters; +pub mod sync_legacy_user_principals; pub mod sync_users_to_storage_index; pub mod upgrade_canisters; pub(crate) fn start(state: &RuntimeState) { + make_pending_payments::start_job_if_required(state); notify_user_principal_updates::start_job_if_required(state); + submit_message_to_modclub::start_job_if_required(state); sync_events_to_local_user_index_canisters::start_job_if_required(state); + sync_legacy_user_principals::start_job_if_required(state); sync_users_to_storage_index::start_job_if_required(state); upgrade_canisters::start_job_if_required(state); - make_pending_payments::start_job_if_required(state); - submit_message_to_modclub::start_job_if_required(state); } diff --git a/backend/canisters/user_index/impl/src/jobs/sync_legacy_user_principals.rs b/backend/canisters/user_index/impl/src/jobs/sync_legacy_user_principals.rs new file mode 100644 index 0000000000..887420bf8d --- /dev/null +++ b/backend/canisters/user_index/impl/src/jobs/sync_legacy_user_principals.rs @@ -0,0 +1,71 @@ +use crate::{mutate_state, RuntimeState}; +use candid::Principal; +use ic_cdk_timers::TimerId; +use std::cell::Cell; +use std::time::Duration; +use tracing::trace; +use types::CanisterId; + +const BATCH_SIZE: usize = 1000; + +thread_local! { + static TIMER_ID: Cell> = Cell::default(); +} + +pub(crate) fn start_job_if_required(state: &RuntimeState) -> bool { + if TIMER_ID.get().is_none() && !state.data.legacy_principals_sync_queue.is_empty() { + let timer_id = ic_cdk_timers::set_timer(Duration::ZERO, run); + TIMER_ID.set(Some(timer_id)); + true + } else { + false + } +} + +pub(crate) fn try_run_now(state: &mut RuntimeState) -> bool { + if let Some((canister_id, principals)) = next_batch(state) { + if let Some(timer_id) = TIMER_ID.take() { + ic_cdk_timers::clear_timer(timer_id); + } + ic_cdk::spawn(sync_principals(canister_id, principals)); + true + } else { + false + } +} + +fn run() { + trace!("'sync_legacy_user_principals' job running"); + TIMER_ID.set(None); + + if let Some((canister_id, principals)) = mutate_state(next_batch) { + ic_cdk::spawn(sync_principals(canister_id, principals)); + } +} + +fn next_batch(state: &mut RuntimeState) -> Option<(CanisterId, Vec)> { + let batch: Vec<_> = (0..BATCH_SIZE) + .map_while(|_| state.data.legacy_principals_sync_queue.pop_front()) + .collect(); + + if batch.is_empty() { + None + } else { + Some((state.data.identity_canister_id, batch)) + } +} + +async fn sync_principals(identity_canister_id: CanisterId, principals: Vec) { + let args = identity_canister::c2c_sync_legacy_user_principals::Args { + principals: principals.clone(), + }; + if identity_canister_c2c_client::c2c_sync_legacy_user_principals(identity_canister_id, &args) + .await + .is_err() + { + mutate_state(|state| { + state.data.legacy_principals_sync_queue.extend(principals); + start_job_if_required(state); + }); + } +} diff --git a/backend/canisters/user_index/impl/src/lib.rs b/backend/canisters/user_index/impl/src/lib.rs index d2bf21749c..0086406d93 100644 --- a/backend/canisters/user_index/impl/src/lib.rs +++ b/backend/canisters/user_index/impl/src/lib.rs @@ -19,7 +19,7 @@ use nns_governance_canister::types::manage_neuron::{ClaimOrRefresh, Command}; use nns_governance_canister::types::{Empty, ManageNeuron, NeuronId}; use serde::{Deserialize, Serialize}; use std::cell::RefCell; -use std::collections::{HashMap, HashSet}; +use std::collections::{HashMap, HashSet, VecDeque}; use types::{ BuildVersion, CanisterId, CanisterWasm, ChatId, Cryptocurrency, Cycles, DiamondMembershipFees, Milliseconds, TimestampMillis, Timestamped, UserId, @@ -219,6 +219,8 @@ struct Data { pub user_index_event_sync_queue: CanisterEventSyncQueue, #[serde(default)] pub user_principal_updates_queue: UserPrincipalUpdatesQueue, + #[serde(default)] + pub legacy_principals_sync_queue: VecDeque, pub pending_payments_queue: PendingPaymentsQueue, pub pending_modclub_submissions_queue: PendingModclubSubmissionsQueue, pub platform_moderators: HashSet, @@ -238,8 +240,11 @@ struct Data { pub nns_8_year_neuron: Option, pub rng_seed: [u8; 32], pub diamond_membership_fees: DiamondMembershipFees, + #[serde(default)] + pub legacy_principals_synced: bool, } +// Post upgrade - remove fn identity_canister_id() -> CanisterId { CanisterId::from_text("6klfq-niaaa-aaaar-qadbq-cai").unwrap() } @@ -279,6 +284,7 @@ impl Data { storage_index_user_sync_queue: OpenStorageUserSyncQueue::default(), user_index_event_sync_queue: CanisterEventSyncQueue::default(), user_principal_updates_queue: UserPrincipalUpdatesQueue::default(), + legacy_principals_sync_queue: VecDeque::default(), pending_payments_queue: PendingPaymentsQueue::default(), pending_modclub_submissions_queue: PendingModclubSubmissionsQueue::default(), platform_moderators: HashSet::new(), @@ -298,6 +304,7 @@ impl Data { fire_and_forget_handler: FireAndForgetHandler::default(), rng_seed: [0; 32], diamond_membership_fees: DiamondMembershipFees::default(), + legacy_principals_synced: false, }; // Register the ProposalsBot @@ -362,6 +369,7 @@ impl Default for Data { storage_index_user_sync_queue: OpenStorageUserSyncQueue::default(), user_index_event_sync_queue: CanisterEventSyncQueue::default(), user_principal_updates_queue: UserPrincipalUpdatesQueue::default(), + legacy_principals_sync_queue: VecDeque::default(), pending_payments_queue: PendingPaymentsQueue::default(), pending_modclub_submissions_queue: PendingModclubSubmissionsQueue::default(), platform_moderators: HashSet::new(), @@ -381,6 +389,7 @@ impl Default for Data { nns_8_year_neuron: None, rng_seed: [0; 32], diamond_membership_fees: DiamondMembershipFees::default(), + legacy_principals_synced: false, } } } 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 c898b6c3c9..4c44c40509 100644 --- a/backend/canisters/user_index/impl/src/lifecycle/post_upgrade.rs +++ b/backend/canisters/user_index/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::Data; +use crate::{mutate_state, Data}; use canister_logger::LogEntry; use canister_tracing_macros::trace; use ic_cdk_macros::post_upgrade; @@ -24,4 +24,17 @@ fn post_upgrade(args: Args) { init_state(env, data, args.wasm_version); info!(version = %args.wasm_version, "Post-upgrade complete"); + + // Post upgrade - remove + mutate_state(|state| { + if !state.data.legacy_principals_synced && state.data.test_mode { + state.data.legacy_principals_synced = true; + state + .data + .legacy_principals_sync_queue + .extend(state.data.users.iter().map(|u| u.principal)); + + crate::jobs::sync_legacy_user_principals::start_job_if_required(state); + } + }); } diff --git a/backend/canisters/user_index/impl/src/updates/c2c_notify_events.rs b/backend/canisters/user_index/impl/src/updates/c2c_notify_events.rs index 37a2f841fb..4b2affea6c 100644 --- a/backend/canisters/user_index/impl/src/updates/c2c_notify_events.rs +++ b/backend/canisters/user_index/impl/src/updates/c2c_notify_events.rs @@ -139,8 +139,12 @@ You can change your username at any time by clicking \"Profile settings\" from t user_id: caller, byte_limit: 100 * ONE_MB, }); + if state.data.test_mode { + state.data.legacy_principals_sync_queue.push_back(caller); + } crate::jobs::sync_users_to_storage_index::try_run_now(state); + crate::jobs::sync_legacy_user_principals::try_run_now(state); if let Some(referrer) = referred_by { state.data.user_referral_leaderboards.add_referral(referrer, now); diff --git a/backend/integration_tests/src/client/identity.rs b/backend/integration_tests/src/client/identity.rs index 87588cce77..38a42a928b 100644 --- a/backend/integration_tests/src/client/identity.rs +++ b/backend/integration_tests/src/client/identity.rs @@ -1,7 +1,8 @@ -use crate::generate_update_call; +use crate::{generate_query_call, generate_update_call}; use identity_canister::*; // Queries +generate_query_call!(check_auth_principal); // Updates generate_update_call!(update_user_principal); diff --git a/backend/integration_tests/src/identity_tests.rs b/backend/integration_tests/src/identity_tests.rs new file mode 100644 index 0000000000..2b6c89f460 --- /dev/null +++ b/backend/integration_tests/src/identity_tests.rs @@ -0,0 +1,36 @@ +use crate::env::ENV; +use crate::rng::random_principal; +use crate::{client, TestEnv}; +use std::ops::Deref; +use types::Empty; + +#[test] +fn new_users_synced_to_identity_canister() { + let mut wrapper = ENV.deref().get(); + let TestEnv { env, canister_ids, .. } = wrapper.env(); + + let user_count = 5usize; + + let users: Vec<_> = (0..user_count) + .map(|_| client::local_user_index::happy_path::register_user(env, canister_ids.local_user_index)) + .collect(); + + env.tick(); + + for user in users { + let response = client::identity::check_auth_principal(env, user.principal, canister_ids.identity, &Empty {}); + assert!(matches!(response, identity_canister::check_auth_principal::Response::Legacy)); + } +} + +#[test] +fn unknown_principal_returns_not_found() { + let mut wrapper = ENV.deref().get(); + let TestEnv { env, canister_ids, .. } = wrapper.env(); + + let response = client::identity::check_auth_principal(env, random_principal(), canister_ids.identity, &Empty {}); + assert!(matches!( + response, + identity_canister::check_auth_principal::Response::NotFound + )); +} diff --git a/backend/integration_tests/src/lib.rs b/backend/integration_tests/src/lib.rs index 168ce01362..597434f4d3 100644 --- a/backend/integration_tests/src/lib.rs +++ b/backend/integration_tests/src/lib.rs @@ -20,6 +20,7 @@ mod escrow_tests; mod fire_and_forget_handler_tests; mod freeze_group_tests; mod gated_group_tests; +mod identity_tests; mod join_group_tests; mod last_online_date_tests; mod mentions_tests; From 53e4ee0ab06dba6769a8578835bfef88de426d8b Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Thu, 25 Jan 2024 14:19:11 +0000 Subject: [PATCH 07/19] Split `sns_root` into its own package within `external_canisters` (#5266) --- Cargo.lock | 23 ++ .../canisters/cycles_dispenser/CHANGELOG.md | 1 + .../cycles_dispenser/impl/Cargo.toml | 2 + .../impl/src/jobs/top_up_sns_canisters.rs | 35 +-- .../sns_root/api/Cargo.toml | 12 + .../external_canisters/sns_root/api/can.did | 24 ++ .../sns_root/api/src/lib.rs | 3 + .../sns_root/api/src/main.rs | 9 + .../src/queries/get_sns_canisters_summary.rs | 26 +++ .../sns_root/api/src/queries/mod.rs | 1 + .../sns_root/c2c_client/Cargo.toml | 13 ++ .../sns_root/c2c_client/src/lib.rs | 5 + .../external_canisters/sns_swap/api/can.did | 221 ------------------ 13 files changed, 121 insertions(+), 254 deletions(-) create mode 100644 backend/external_canisters/sns_root/api/Cargo.toml create mode 100644 backend/external_canisters/sns_root/api/can.did create mode 100644 backend/external_canisters/sns_root/api/src/lib.rs create mode 100644 backend/external_canisters/sns_root/api/src/main.rs create mode 100644 backend/external_canisters/sns_root/api/src/queries/get_sns_canisters_summary.rs create mode 100644 backend/external_canisters/sns_root/api/src/queries/mod.rs create mode 100644 backend/external_canisters/sns_root/c2c_client/Cargo.toml create mode 100644 backend/external_canisters/sns_root/c2c_client/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 800d0f2d9e..d003144c93 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1553,6 +1553,8 @@ dependencies = [ "serde_bytes", "serde_json", "serializer", + "sns_root_canister", + "sns_root_canister_c2c_client", "stable_memory", "tracing", "types", @@ -6265,6 +6267,27 @@ dependencies = [ "types", ] +[[package]] +name = "sns_root_canister" +version = "0.1.0" +dependencies = [ + "candid", + "candid_gen", + "serde", + "types", +] + +[[package]] +name = "sns_root_canister_c2c_client" +version = "0.1.0" +dependencies = [ + "candid", + "canister_client", + "ic-cdk 0.11.3", + "sns_root_canister", + "types", +] + [[package]] name = "sns_swap_canister" version = "0.1.0" diff --git a/backend/canisters/cycles_dispenser/CHANGELOG.md b/backend/canisters/cycles_dispenser/CHANGELOG.md index 2d2d3e58ed..137e46dabc 100644 --- a/backend/canisters/cycles_dispenser/CHANGELOG.md +++ b/backend/canisters/cycles_dispenser/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed - Avoid usages of `make_c2c_call` and use macro instead ([#5252](https://github.com/open-chat-labs/open-chat/pull/5252)) +- Split `sns_root` into its own package within `external_canisters` ([#5266](https://github.com/open-chat-labs/open-chat/pull/5266)) ## [[2.0.1017](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1017-cycles_dispenser)] - 2024-01-19 diff --git a/backend/canisters/cycles_dispenser/impl/Cargo.toml b/backend/canisters/cycles_dispenser/impl/Cargo.toml index d201167ef7..c0d3d35469 100644 --- a/backend/canisters/cycles_dispenser/impl/Cargo.toml +++ b/backend/canisters/cycles_dispenser/impl/Cargo.toml @@ -32,6 +32,8 @@ serde = { workspace = true } serde_bytes = { workspace = true } serde_json = { workspace = true } serializer = { path = "../../../libraries/serializer" } +sns_root_canister = { path = "../../../external_canisters/sns_root/api" } +sns_root_canister_c2c_client = { path = "../../../external_canisters/sns_root/c2c_client" } stable_memory = { path = "../../../libraries/stable_memory" } tracing = { workspace = true } types = { path = "../../../libraries/types" } diff --git a/backend/canisters/cycles_dispenser/impl/src/jobs/top_up_sns_canisters.rs b/backend/canisters/cycles_dispenser/impl/src/jobs/top_up_sns_canisters.rs index c2dd1edc39..a7d204d7af 100644 --- a/backend/canisters/cycles_dispenser/impl/src/jobs/top_up_sns_canisters.rs +++ b/backend/canisters/cycles_dispenser/impl/src/jobs/top_up_sns_canisters.rs @@ -1,5 +1,5 @@ -use crate::jobs::top_up_sns_canisters::get_sns_canisters_summary::CanisterSummary; use crate::read_state; +use sns_root_canister::get_sns_canisters_summary::CanisterSummary; use std::time::Duration; use types::{CanisterId, Cycles, Empty}; use utils::canister::deposit_cycles; @@ -19,7 +19,7 @@ fn run() { } async fn run_async(canister_id: CanisterId) { - if let Ok(response) = get_sns_canisters_summary(canister_id, &Empty {}).await { + if let Ok(response) = sns_root_canister_c2c_client::get_sns_canisters_summary(canister_id, &Empty {}).await { let to_top_up: Vec<_> = vec![ response.root, response.governance, @@ -49,34 +49,3 @@ fn requires_top_up(summary: &CanisterSummary) -> bool { cycles < 100 * T } - -canister_client::generate_candid_c2c_call!(get_sns_canisters_summary); - -pub mod get_sns_canisters_summary { - use candid::{CandidType, Nat, Principal}; - use serde::Deserialize; - use types::Empty; - - pub type Args = Empty; - - #[derive(CandidType, Deserialize, Debug)] - pub struct Response { - pub root: Option, - pub governance: Option, - pub ledger: Option, - pub swap: Option, - pub archives: Vec, - pub index: Option, - } - - #[derive(CandidType, Deserialize, Debug)] - pub struct CanisterSummary { - pub canister_id: Option, - pub status: Option, - } - - #[derive(CandidType, Deserialize, Debug)] - pub struct CanisterStatusResult { - pub cycles: Nat, - } -} diff --git a/backend/external_canisters/sns_root/api/Cargo.toml b/backend/external_canisters/sns_root/api/Cargo.toml new file mode 100644 index 0000000000..c3d6f842f2 --- /dev/null +++ b/backend/external_canisters/sns_root/api/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "sns_root_canister" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +candid = { workspace = true } +candid_gen = { path = "../../../libraries/candid_gen" } +serde = { workspace = true } +types = { path = "../../../libraries/types" } diff --git a/backend/external_canisters/sns_root/api/can.did b/backend/external_canisters/sns_root/api/can.did new file mode 100644 index 0000000000..753e939bea --- /dev/null +++ b/backend/external_canisters/sns_root/api/can.did @@ -0,0 +1,24 @@ +// Copied from https://github.com/dfinity/ic/blob/master/rs/sns/root/canister/root.did + +type CanisterStatusResultV2 = record { + cycles : nat; +}; +type CanisterStatusType = variant { stopped; stopping; running }; +type CanisterSummary = record { + status : opt CanisterStatusResultV2; + canister_id : opt principal; +}; +type GetSnsCanistersSummaryRequest = record { }; +type GetSnsCanistersSummaryResponse = record { + root : opt CanisterSummary; + swap : opt CanisterSummary; + ledger : opt CanisterSummary; + index : opt CanisterSummary; + governance : opt CanisterSummary; + archives : vec CanisterSummary; +}; +service : { + get_sns_canisters_summary : (GetSnsCanistersSummaryRequest) -> ( + GetSnsCanistersSummaryResponse, + ); +} \ No newline at end of file diff --git a/backend/external_canisters/sns_root/api/src/lib.rs b/backend/external_canisters/sns_root/api/src/lib.rs new file mode 100644 index 0000000000..3776305784 --- /dev/null +++ b/backend/external_canisters/sns_root/api/src/lib.rs @@ -0,0 +1,3 @@ +mod queries; + +pub use queries::*; diff --git a/backend/external_canisters/sns_root/api/src/main.rs b/backend/external_canisters/sns_root/api/src/main.rs new file mode 100644 index 0000000000..bc9b9895c4 --- /dev/null +++ b/backend/external_canisters/sns_root/api/src/main.rs @@ -0,0 +1,9 @@ +use candid_gen::generate_candid_method; + +#[allow(deprecated)] +fn main() { + generate_candid_method!(sns_root, get_sns_canisters_summary, update); + + candid::export_service!(); + std::print!("{}", __export_service()); +} diff --git a/backend/external_canisters/sns_root/api/src/queries/get_sns_canisters_summary.rs b/backend/external_canisters/sns_root/api/src/queries/get_sns_canisters_summary.rs new file mode 100644 index 0000000000..660e6ec4cd --- /dev/null +++ b/backend/external_canisters/sns_root/api/src/queries/get_sns_canisters_summary.rs @@ -0,0 +1,26 @@ +use candid::{CandidType, Nat, Principal}; +use serde::Deserialize; +use types::Empty; + +pub type Args = Empty; + +#[derive(CandidType, Deserialize, Debug)] +pub struct Response { + pub root: Option, + pub governance: Option, + pub ledger: Option, + pub swap: Option, + pub archives: Vec, + pub index: Option, +} + +#[derive(CandidType, Deserialize, Debug)] +pub struct CanisterSummary { + pub canister_id: Option, + pub status: Option, +} + +#[derive(CandidType, Deserialize, Debug)] +pub struct CanisterStatusResult { + pub cycles: Nat, +} diff --git a/backend/external_canisters/sns_root/api/src/queries/mod.rs b/backend/external_canisters/sns_root/api/src/queries/mod.rs new file mode 100644 index 0000000000..41d9574879 --- /dev/null +++ b/backend/external_canisters/sns_root/api/src/queries/mod.rs @@ -0,0 +1 @@ +pub mod get_sns_canisters_summary; diff --git a/backend/external_canisters/sns_root/c2c_client/Cargo.toml b/backend/external_canisters/sns_root/c2c_client/Cargo.toml new file mode 100644 index 0000000000..d47d0ff916 --- /dev/null +++ b/backend/external_canisters/sns_root/c2c_client/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "sns_root_canister_c2c_client" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +candid = { workspace = true } +canister_client = { path = "../../../libraries/canister_client" } +ic-cdk = { workspace = true } +sns_root_canister = { path = "../api" } +types = { path = "../../../libraries/types" } diff --git a/backend/external_canisters/sns_root/c2c_client/src/lib.rs b/backend/external_canisters/sns_root/c2c_client/src/lib.rs new file mode 100644 index 0000000000..27c997def2 --- /dev/null +++ b/backend/external_canisters/sns_root/c2c_client/src/lib.rs @@ -0,0 +1,5 @@ +use canister_client::generate_candid_c2c_call; +use sns_root_canister::*; + +// Queries +generate_candid_c2c_call!(get_sns_canisters_summary); diff --git a/backend/external_canisters/sns_swap/api/can.did b/backend/external_canisters/sns_swap/api/can.did index e6bdd56595..047afee934 100644 --- a/backend/external_canisters/sns_swap/api/can.did +++ b/backend/external_canisters/sns_swap/api/can.did @@ -1,230 +1,9 @@ // Copied from https://github.com/dfinity/ic/blob/master/rs/nns/sns-wasm/canister/sns-wasm.did -type BuyerState = record { icp : opt TransferableAmount }; -type CanisterCallError = record { code : opt int32; description : text }; -type CanisterStatusResultV2 = record { - status : CanisterStatusType; - memory_size : nat; - cycles : nat; - settings : DefiniteCanisterSettingsArgs; - idle_cycles_burned_per_day : nat; - module_hash : opt vec nat8; -}; -type CanisterStatusType = variant { stopped; stopping; running }; -type CfInvestment = record { hotkey_principal : text; nns_neuron_id : nat64 }; -type CfNeuron = record { nns_neuron_id : nat64; amount_icp_e8s : nat64 }; -type CfParticipant = record { - hotkey_principal : text; - cf_neurons : vec CfNeuron; -}; -type Countries = record { iso_codes : vec text }; -type DefiniteCanisterSettingsArgs = record { - freezing_threshold : nat; - controllers : vec principal; - memory_allocation : nat; - compute_allocation : nat; -}; -type DerivedState = record { - sns_tokens_per_icp : float32; - buyer_total_icp_e8s : nat64; - cf_participant_count : opt nat64; - direct_participant_count : opt nat64; - cf_neuron_count : opt nat64; -}; -type DirectInvestment = record { buyer_principal : text }; -type Err = record { description : opt text; error_type : opt int32 }; -type Err_1 = record { error_type : opt int32 }; -type Err_2 = record { - invalid_user_amount : opt InvalidUserAmount; - existing_ticket : opt Ticket; - error_type : int32; -}; -type ErrorRefundIcpRequest = record { source_principal_id : opt principal }; -type ErrorRefundIcpResponse = record { result : opt Result }; -type FailedUpdate = record { - err : opt CanisterCallError; - dapp_canister_id : opt principal; -}; -type FinalizeSwapResponse = record { - set_dapp_controllers_call_result : opt SetDappControllersCallResult; - settle_community_fund_participation_result : opt SettleCommunityFundParticipationResult; - error_message : opt text; - set_mode_call_result : opt SetModeCallResult; - sweep_icp_result : opt SweepResult; - claim_neuron_result : opt SweepResult; - sweep_sns_result : opt SweepResult; -}; -type GetBuyerStateRequest = record { principal_id : opt principal }; -type GetBuyerStateResponse = record { buyer_state : opt BuyerState }; -type GetBuyersTotalResponse = record { buyers_total : nat64 }; -type GetDerivedStateResponse = record { - sns_tokens_per_icp : opt float64; - buyer_total_icp_e8s : opt nat64; - cf_participant_count : opt nat64; - direct_participant_count : opt nat64; - cf_neuron_count : opt nat64; -}; -type GetInitResponse = record { init : opt Init }; type GetLifecycleResponse = record { decentralization_sale_open_timestamp_seconds : opt nat64; lifecycle : opt int32; }; -type GetOpenTicketResponse = record { result : opt Result_1 }; -type GetSaleParametersResponse = record { params : opt Params }; -type GetStateResponse = record { swap : opt Swap; derived : opt DerivedState }; -type GovernanceError = record { error_message : text; error_type : int32 }; -type Icrc1Account = record { owner : opt principal; subaccount : opt vec nat8 }; -type Init = record { - nns_proposal_id : opt nat64; - sns_root_canister_id : text; - min_participant_icp_e8s : opt nat64; - neuron_basket_construction_parameters : opt NeuronBasketConstructionParameters; - fallback_controller_principal_ids : vec text; - max_icp_e8s : opt nat64; - neuron_minimum_stake_e8s : opt nat64; - confirmation_text : opt text; - swap_start_timestamp_seconds : opt nat64; - swap_due_timestamp_seconds : opt nat64; - min_participants : opt nat32; - sns_token_e8s : opt nat64; - nns_governance_canister_id : text; - transaction_fee_e8s : opt nat64; - icp_ledger_canister_id : text; - sns_ledger_canister_id : text; - neurons_fund_participants : opt NeuronsFundParticipants; - should_auto_finalize : opt bool; - max_participant_icp_e8s : opt nat64; - sns_governance_canister_id : text; - restricted_countries : opt Countries; - min_icp_e8s : opt nat64; -}; -type InvalidUserAmount = record { - min_amount_icp_e8s_included : nat64; - max_amount_icp_e8s_included : nat64; -}; -type Investor = variant { - CommunityFund : CfInvestment; - Direct : DirectInvestment; -}; -type ListCommunityFundParticipantsRequest = record { - offset : opt nat64; - limit : opt nat32; -}; -type ListDirectParticipantsRequest = record { - offset : opt nat32; - limit : opt nat32; -}; -type ListDirectParticipantsResponse = record { participants : vec Participant }; -type ListSnsNeuronRecipesRequest = record { - offset : opt nat64; - limit : opt nat32; -}; -type ListSnsNeuronRecipesResponse = record { - sns_neuron_recipes : vec SnsNeuronRecipe; -}; -type NeuronAttributes = record { - dissolve_delay_seconds : nat64; - memo : nat64; - followees : vec NeuronId; -}; -type NeuronBasketConstructionParameters = record { - dissolve_delay_interval_seconds : nat64; - count : nat64; -}; -type NeuronId = record { id : vec nat8 }; -type NeuronsFundParticipants = record { cf_participants : vec CfParticipant }; -type NewSaleTicketRequest = record { - subaccount : opt vec nat8; - amount_icp_e8s : nat64; -}; -type NewSaleTicketResponse = record { result : opt Result_2 }; -type Ok = record { block_height : opt nat64 }; -type Ok_1 = record { ticket : opt Ticket }; -type OpenRequest = record { - cf_participants : vec CfParticipant; - params : opt Params; - open_sns_token_swap_proposal_id : opt nat64; -}; -type Params = record { - min_participant_icp_e8s : nat64; - neuron_basket_construction_parameters : opt NeuronBasketConstructionParameters; - max_icp_e8s : nat64; - swap_due_timestamp_seconds : nat64; - min_participants : nat32; - sns_token_e8s : nat64; - sale_delay_seconds : opt nat64; - max_participant_icp_e8s : nat64; - min_icp_e8s : nat64; -}; -type Participant = record { - participation : opt BuyerState; - participant_id : opt principal; -}; -type Possibility = variant { - Ok : SetDappControllersResponse; - Err : CanisterCallError; -}; -type Possibility_1 = variant { Ok : Response; Err : CanisterCallError }; -type Possibility_2 = variant { Ok : record {}; Err : CanisterCallError }; -type RefreshBuyerTokensRequest = record { - confirmation_text : opt text; - buyer : text; -}; -type RefreshBuyerTokensResponse = record { - icp_accepted_participation_e8s : nat64; - icp_ledger_account_balance_e8s : nat64; -}; -type Response = record { governance_error : opt GovernanceError }; -type Result = variant { Ok : Ok; Err : Err }; -type Result_1 = variant { Ok : Ok_1; Err : Err_1 }; -type Result_2 = variant { Ok : Ok_1; Err : Err_2 }; -type SetDappControllersCallResult = record { possibility : opt Possibility }; -type SetDappControllersResponse = record { failed_updates : vec FailedUpdate }; -type SetModeCallResult = record { possibility : opt Possibility_2 }; -type SettleCommunityFundParticipationResult = record { - possibility : opt Possibility_1; -}; -type SnsNeuronRecipe = record { - sns : opt TransferableAmount; - claimed_status : opt int32; - neuron_attributes : opt NeuronAttributes; - investor : opt Investor; -}; -type Swap = record { - neuron_recipes : vec SnsNeuronRecipe; - next_ticket_id : opt nat64; - decentralization_sale_open_timestamp_seconds : opt nat64; - finalize_swap_in_progress : opt bool; - cf_participants : vec CfParticipant; - init : opt Init; - already_tried_to_auto_finalize : opt bool; - purge_old_tickets_last_completion_timestamp_nanoseconds : opt nat64; - lifecycle : int32; - purge_old_tickets_next_principal : opt vec nat8; - buyers : vec record { text; BuyerState }; - params : opt Params; - open_sns_token_swap_proposal_id : opt nat64; -}; -type SweepResult = record { - failure : nat32; - skipped : nat32; - invalid : nat32; - success : nat32; - global_failures : nat32; -}; -type Ticket = record { - creation_time : nat64; - ticket_id : nat64; - account : opt Icrc1Account; - amount_icp_e8s : nat64; -}; -type TransferableAmount = record { - transfer_fee_paid_e8s : opt nat64; - transfer_start_timestamp_seconds : nat64; - amount_e8s : nat64; - amount_transferred_e8s : opt nat64; - transfer_success_timestamp_seconds : nat64; -}; service : { get_lifecycle : (record {}) -> (GetLifecycleResponse) query; } \ No newline at end of file From e4d82e78ca5519c9f3c9387bcdb809f064ef543c Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Thu, 25 Jan 2024 22:35:31 +0000 Subject: [PATCH 08/19] Update canisters post release (#5269) --- backend/canisters/group_index/CHANGELOG.md | 2 ++ .../group_index/impl/src/model/deleted_communities.rs | 1 - backend/canisters/local_user_index/CHANGELOG.md | 2 ++ backend/canisters/local_user_index/impl/src/lib.rs | 5 ----- backend/canisters/neuron_controller/CHANGELOG.md | 2 ++ backend/canisters/notifications_index/CHANGELOG.md | 2 ++ backend/canisters/proposals_bot/CHANGELOG.md | 2 ++ backend/canisters/storage_bucket/CHANGELOG.md | 2 ++ backend/canisters/storage_index/CHANGELOG.md | 2 ++ backend/canisters/user/CHANGELOG.md | 2 ++ backend/canisters/user_index/CHANGELOG.md | 2 ++ backend/canisters/user_index/impl/src/lib.rs | 6 ------ 12 files changed, 18 insertions(+), 12 deletions(-) diff --git a/backend/canisters/group_index/CHANGELOG.md b/backend/canisters/group_index/CHANGELOG.md index 411d703024..f7df32201c 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.1025](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1025-group_index)] - 2024-01-25 + ### Changed - Simplify timer jobs + make them more efficient ([#5233](https://github.com/open-chat-labs/open-chat/pull/5233)) diff --git a/backend/canisters/group_index/impl/src/model/deleted_communities.rs b/backend/canisters/group_index/impl/src/model/deleted_communities.rs index fd0608fae8..aa19b619f0 100644 --- a/backend/canisters/group_index/impl/src/model/deleted_communities.rs +++ b/backend/canisters/group_index/impl/src/model/deleted_communities.rs @@ -7,7 +7,6 @@ use types::{CommunityId, DeletedCommunityInfo, UserId}; pub struct DeletedCommunities { communities: HashMap, pending_community_deleted_notifications: VecDeque<(CommunityId, UserId)>, - #[serde(default)] failed_notifications: Vec<(CommunityId, UserId)>, } diff --git a/backend/canisters/local_user_index/CHANGELOG.md b/backend/canisters/local_user_index/CHANGELOG.md index 6c54758c0e..9f8d2be7c6 100644 --- a/backend/canisters/local_user_index/CHANGELOG.md +++ b/backend/canisters/local_user_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.1031](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1031-local_user_index)] - 2024-01-25 + ### Added - Implement ability to update user principals ([#5220](https://github.com/open-chat-labs/open-chat/pull/5220)) diff --git a/backend/canisters/local_user_index/impl/src/lib.rs b/backend/canisters/local_user_index/impl/src/lib.rs index 49bbabc4f4..74a0a2b739 100644 --- a/backend/canisters/local_user_index/impl/src/lib.rs +++ b/backend/canisters/local_user_index/impl/src/lib.rs @@ -196,7 +196,6 @@ struct Data { pub user_canister_wasm_for_upgrades: CanisterWasm, pub user_index_canister_id: CanisterId, pub group_index_canister_id: CanisterId, - #[serde(default = "identity_canister_id")] pub identity_canister_id: CanisterId, pub notifications_canister_id: CanisterId, pub proposals_bot_canister_id: CanisterId, @@ -218,10 +217,6 @@ struct Data { pub rng_seed: [u8; 32], } -fn identity_canister_id() -> CanisterId { - CanisterId::from_text("6klfq-niaaa-aaaar-qadbq-cai").unwrap() -} - #[derive(Serialize, Deserialize)] pub struct FailedMessageUsers { pub sender: UserId, diff --git a/backend/canisters/neuron_controller/CHANGELOG.md b/backend/canisters/neuron_controller/CHANGELOG.md index c48b0d91db..28bc11d7e8 100644 --- a/backend/canisters/neuron_controller/CHANGELOG.md +++ b/backend/canisters/neuron_controller/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [unreleased] +## [[2.0.1028](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1028-neuron_controller)] - 2024-01-25 + ### Changed - Add `spawning_neurons` to metrics ([#5206](https://github.com/open-chat-labs/open-chat/pull/5206)) diff --git a/backend/canisters/notifications_index/CHANGELOG.md b/backend/canisters/notifications_index/CHANGELOG.md index 4f64bd7691..b6d0f3e448 100644 --- a/backend/canisters/notifications_index/CHANGELOG.md +++ b/backend/canisters/notifications_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.1026](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1026-notifications_index)] - 2024-01-25 + ### Added - Implement ability to update user principals ([#5220](https://github.com/open-chat-labs/open-chat/pull/5220)) diff --git a/backend/canisters/proposals_bot/CHANGELOG.md b/backend/canisters/proposals_bot/CHANGELOG.md index 7d52a3d079..6cf10774fb 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.1027](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1027-proposals_bot)] - 2024-01-25 + ### Changed - Simplify timer jobs + make them more efficient ([#5233](https://github.com/open-chat-labs/open-chat/pull/5233)) diff --git a/backend/canisters/storage_bucket/CHANGELOG.md b/backend/canisters/storage_bucket/CHANGELOG.md index 5bbf64c481..48a927d0b0 100644 --- a/backend/canisters/storage_bucket/CHANGELOG.md +++ b/backend/canisters/storage_bucket/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [unreleased] +## [[2.0.1030](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1030-storage_bucket)] - 2024-01-25 + ### Changed - Increase StorageBucket size limit to 64GB ([#5249](https://github.com/open-chat-labs/open-chat/pull/5249)) diff --git a/backend/canisters/storage_index/CHANGELOG.md b/backend/canisters/storage_index/CHANGELOG.md index cbea494588..8683f08cdb 100644 --- a/backend/canisters/storage_index/CHANGELOG.md +++ b/backend/canisters/storage_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.1029](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1029-storage_index)] - 2024-01-25 + ### Added - Implement ability to update user principals ([#5220](https://github.com/open-chat-labs/open-chat/pull/5220)) diff --git a/backend/canisters/user/CHANGELOG.md b/backend/canisters/user/CHANGELOG.md index 25436c6b6a..1418905a68 100644 --- a/backend/canisters/user/CHANGELOG.md +++ b/backend/canisters/user/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [unreleased] +## [[2.0.1032](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1032-user)] - 2024-01-25 + ### Added - Implement ability to update user principals ([#5220](https://github.com/open-chat-labs/open-chat/pull/5220)) diff --git a/backend/canisters/user_index/CHANGELOG.md b/backend/canisters/user_index/CHANGELOG.md index eafa30e5f6..7e8fd0db3b 100644 --- a/backend/canisters/user_index/CHANGELOG.md +++ b/backend/canisters/user_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.1024](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1024-user_index)] - 2024-01-25 + ### Added - Implement ability to update user principals ([#5220](https://github.com/open-chat-labs/open-chat/pull/5220)) diff --git a/backend/canisters/user_index/impl/src/lib.rs b/backend/canisters/user_index/impl/src/lib.rs index 0086406d93..65a5c7ff38 100644 --- a/backend/canisters/user_index/impl/src/lib.rs +++ b/backend/canisters/user_index/impl/src/lib.rs @@ -207,7 +207,6 @@ struct Data { pub local_user_index_canister_wasm_for_upgrades: CanisterWasm, pub group_index_canister_id: CanisterId, pub notifications_index_canister_id: CanisterId, - #[serde(default = "identity_canister_id")] pub identity_canister_id: CanisterId, pub proposals_bot_canister_id: CanisterId, pub canisters_requiring_upgrade: CanistersRequiringUpgrade, @@ -244,11 +243,6 @@ struct Data { pub legacy_principals_synced: bool, } -// Post upgrade - remove -fn identity_canister_id() -> CanisterId { - CanisterId::from_text("6klfq-niaaa-aaaar-qadbq-cai").unwrap() -} - impl Data { #[allow(clippy::too_many_arguments)] pub fn new( From d85299c3ce20e06dee2082a49c9c1a1f5def6773 Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Fri, 26 Jan 2024 11:28:37 +0000 Subject: [PATCH 09/19] Automate building of upgrade proposal summaries (#5270) --- .gitignore | 1 + scripts/make_upgrade_canister_proposal.sh | 29 +++++++++++++++++-- scripts/proposals/upgrade_communities.sh | 6 ++-- scripts/proposals/upgrade_cycles_dispenser.sh | 6 ++-- scripts/proposals/upgrade_escrow.sh | 6 ++-- scripts/proposals/upgrade_group_index.sh | 6 ++-- scripts/proposals/upgrade_groups.sh | 6 ++-- scripts/proposals/upgrade_identity.sh | 6 ++-- .../proposals/upgrade_local_group_indexes.sh | 6 ++-- .../proposals/upgrade_local_user_indexes.sh | 6 ++-- scripts/proposals/upgrade_market_maker.sh | 6 ++-- .../proposals/upgrade_neuron_controller.sh | 6 ++-- scripts/proposals/upgrade_notifications.sh | 6 ++-- .../proposals/upgrade_notifications_index.sh | 6 ++-- scripts/proposals/upgrade_online_users.sh | 6 ++-- .../proposals/upgrade_proposal_validation.sh | 6 ++-- scripts/proposals/upgrade_proposals_bot.sh | 6 ++-- scripts/proposals/upgrade_registry.sh | 6 ++-- scripts/proposals/upgrade_storage_buckets.sh | 6 ++-- scripts/proposals/upgrade_storage_index.sh | 6 ++-- scripts/proposals/upgrade_translations.sh | 6 ++-- scripts/proposals/upgrade_user_index.sh | 6 ++-- scripts/proposals/upgrade_users.sh | 6 ++-- scripts/verify-release.sh | 2 +- 24 files changed, 91 insertions(+), 67 deletions(-) diff --git a/.gitignore b/.gitignore index 2b9932e4b8..77ff74ab0c 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ wasms/ **/*.pem **/*.rs.bk pocket-ic* +changelog.md msg.json notes.md notification.did diff --git a/scripts/make_upgrade_canister_proposal.sh b/scripts/make_upgrade_canister_proposal.sh index d1d2fd42b5..7d4534cc4c 100755 --- a/scripts/make_upgrade_canister_proposal.sh +++ b/scripts/make_upgrade_canister_proposal.sh @@ -16,7 +16,7 @@ FUNCTION_ID=$1 CANISTER_NAME=$2 VERSION=$3 TITLE=$4 -SUMMARY=$5 +CHANGELOG=$5 TAG=v$VERSION-$CANISTER_NAME COMMIT_ID=$(git rev-list -n 1 tags/$TAG) || exit 1 @@ -30,10 +30,33 @@ echo "URL: $URL" # Download the canister WASM at the given commit ./scripts/download-canister-wasm.sh $CANISTER_NAME $COMMIT_ID || exit 1 +WASM_FILE=$CANISTER_NAME.wasm.gz +WASM_PATH=$WASM_FOLDER/$WASM_FILE +WASM_HASH=$(sha256sum $WASM_PATH | sed 's/ .*$//') + +SUMMARY="## GitHub commit + +https://github.com/open-chat-labs/open-chat/commit/$COMMIT_ID + +## Changelog + +$CHANGELOG + +## Wasm Verification + +Verify that the hash of the gzipped WASM matches the proposed hash. + +\`\`\` +git fetch +git checkout $COMMIT_ID +./scripts/verify-release.sh $VERSION $WASM_HASH +\`\`\`" + +echo "SUMMARY: +$SUMMARY" + if [ "$FUNCTION_ID" -ge "1000" ] ; then # Setup variables - WASM_FILE=$CANISTER_NAME.wasm.gz - WASM_PATH=$WASM_FOLDER/$WASM_FILE PROPOSAL_BUILDER_FOLDER=$SCRIPT_DIR/../backend/canister_upgrade_proposal_builder PROPOSAL_FILE=proposal.candid PROPOSAL_BUILDER_PATH=$PROPOSAL_BUILDER_FOLDER/$PROPOSAL_FILE diff --git a/scripts/proposals/upgrade_communities.sh b/scripts/proposals/upgrade_communities.sh index a292ae3712..a07f5e25e5 100755 --- a/scripts/proposals/upgrade_communities.sh +++ b/scripts/proposals/upgrade_communities.sh @@ -1,10 +1,10 @@ #!/bin/bash VERSION=$1 -SUMMARY_PATH=$2 +CHANGELOG_PATH=$2 TITLE="Upgrade Community canisters to $VERSION" -SUMMARY=`cat $SUMMARY_PATH` +CHANGELOG=`cat $CHANGELOG_PATH` FUNCTION_ID=2005 CANISTER_NAME=community @@ -14,4 +14,4 @@ SCRIPT_DIR=$(dirname "$SCRIPT") cd $SCRIPT_DIR/.. # Submit the proposal -./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$SUMMARY" +./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$CHANGELOG" diff --git a/scripts/proposals/upgrade_cycles_dispenser.sh b/scripts/proposals/upgrade_cycles_dispenser.sh index 0da5afa23a..2df29e9812 100755 --- a/scripts/proposals/upgrade_cycles_dispenser.sh +++ b/scripts/proposals/upgrade_cycles_dispenser.sh @@ -1,10 +1,10 @@ #!/bin/bash VERSION=$1 -SUMMARY_PATH=$2 +CHANGELOG_PATH=$2 TITLE="Upgrade CyclesDispenser canister to $VERSION" -SUMMARY=`cat $SUMMARY_PATH` +CHANGELOG=`cat $CHANGELOG_PATH` FUNCTION_ID=3 CANISTER_NAME=cycles_dispenser @@ -14,4 +14,4 @@ SCRIPT_DIR=$(dirname "$SCRIPT") cd $SCRIPT_DIR/.. # Submit the proposal -./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$SUMMARY" +./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$CHANGELOG" diff --git a/scripts/proposals/upgrade_escrow.sh b/scripts/proposals/upgrade_escrow.sh index 6342294028..6d13792abc 100755 --- a/scripts/proposals/upgrade_escrow.sh +++ b/scripts/proposals/upgrade_escrow.sh @@ -1,10 +1,10 @@ #!/bin/bash VERSION=$1 -SUMMARY_PATH=$2 +CHANGELOG_PATH=$2 TITLE="Upgrade Escrow canister to $VERSION" -SUMMARY=`cat $SUMMARY_PATH` +CHANGELOG=`cat $CHANGELOG_PATH` FUNCTION_ID=3 CANISTER_NAME=escrow @@ -14,4 +14,4 @@ SCRIPT_DIR=$(dirname "$SCRIPT") cd $SCRIPT_DIR/.. # Submit the proposal -./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$SUMMARY" +./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$CHANGELOG" diff --git a/scripts/proposals/upgrade_group_index.sh b/scripts/proposals/upgrade_group_index.sh index 17f416244d..cf856c4573 100755 --- a/scripts/proposals/upgrade_group_index.sh +++ b/scripts/proposals/upgrade_group_index.sh @@ -1,10 +1,10 @@ #!/bin/bash VERSION=$1 -SUMMARY_PATH=$2 +CHANGELOG_PATH=$2 TITLE="Upgrade GroupIndex canister to $VERSION" -SUMMARY=`cat $SUMMARY_PATH` +CHANGELOG=`cat $CHANGELOG_PATH` FUNCTION_ID=3 CANISTER_NAME=group_index @@ -14,4 +14,4 @@ SCRIPT_DIR=$(dirname "$SCRIPT") cd $SCRIPT_DIR/.. # Submit the proposal -./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$SUMMARY" +./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$CHANGELOG" diff --git a/scripts/proposals/upgrade_groups.sh b/scripts/proposals/upgrade_groups.sh index 6a883f2137..f5f0847e72 100755 --- a/scripts/proposals/upgrade_groups.sh +++ b/scripts/proposals/upgrade_groups.sh @@ -1,10 +1,10 @@ #!/bin/bash VERSION=$1 -SUMMARY_PATH=$2 +CHANGELOG_PATH=$2 TITLE="Upgrade Group canisters to $VERSION" -SUMMARY=`cat $SUMMARY_PATH` +CHANGELOG=`cat $CHANGELOG_PATH` FUNCTION_ID=2001 CANISTER_NAME=group @@ -14,4 +14,4 @@ SCRIPT_DIR=$(dirname "$SCRIPT") cd $SCRIPT_DIR/.. # Submit the proposal -./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$SUMMARY" +./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$CHANGELOG" diff --git a/scripts/proposals/upgrade_identity.sh b/scripts/proposals/upgrade_identity.sh index cb55bfaf61..e0ca932027 100755 --- a/scripts/proposals/upgrade_identity.sh +++ b/scripts/proposals/upgrade_identity.sh @@ -1,10 +1,10 @@ #!/bin/bash VERSION=$1 -SUMMARY_PATH=$2 +CHANGELOG_PATH=$2 TITLE="Upgrade Identity canister to $VERSION" -SUMMARY=`cat $SUMMARY_PATH` +CHANGELOG=`cat $CHANGELOG_PATH` FUNCTION_ID=3 CANISTER_NAME=identity @@ -14,4 +14,4 @@ SCRIPT_DIR=$(dirname "$SCRIPT") cd $SCRIPT_DIR/.. # Submit the proposal -./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$SUMMARY" +./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$CHANGELOG" diff --git a/scripts/proposals/upgrade_local_group_indexes.sh b/scripts/proposals/upgrade_local_group_indexes.sh index 0b5825062b..b5d2158dce 100755 --- a/scripts/proposals/upgrade_local_group_indexes.sh +++ b/scripts/proposals/upgrade_local_group_indexes.sh @@ -1,10 +1,10 @@ #!/bin/bash VERSION=$1 -SUMMARY_PATH=$2 +CHANGELOG_PATH=$2 TITLE="Upgrade LocalGroupIndex canisters to $VERSION" -SUMMARY=`cat $SUMMARY_PATH` +CHANGELOG=`cat $CHANGELOG_PATH` FUNCTION_ID=2000 CANISTER_NAME=local_group_index @@ -14,4 +14,4 @@ SCRIPT_DIR=$(dirname "$SCRIPT") cd $SCRIPT_DIR/.. # Submit the proposal -./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$SUMMARY" +./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$CHANGELOG" diff --git a/scripts/proposals/upgrade_local_user_indexes.sh b/scripts/proposals/upgrade_local_user_indexes.sh index 5c29df0f86..31504084af 100755 --- a/scripts/proposals/upgrade_local_user_indexes.sh +++ b/scripts/proposals/upgrade_local_user_indexes.sh @@ -1,10 +1,10 @@ #!/bin/bash VERSION=$1 -SUMMARY_PATH=$2 +CHANGELOG_PATH=$2 TITLE="Upgrade LocalUserIndex canisters to $VERSION" -SUMMARY=`cat $SUMMARY_PATH` +CHANGELOG=`cat $CHANGELOG_PATH` FUNCTION_ID=1000 CANISTER_NAME=local_user_index @@ -14,4 +14,4 @@ SCRIPT_DIR=$(dirname "$SCRIPT") cd $SCRIPT_DIR/.. # Submit the proposal -./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$SUMMARY" +./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$CHANGELOG" diff --git a/scripts/proposals/upgrade_market_maker.sh b/scripts/proposals/upgrade_market_maker.sh index 9b0034ba12..04307c6e1d 100755 --- a/scripts/proposals/upgrade_market_maker.sh +++ b/scripts/proposals/upgrade_market_maker.sh @@ -1,10 +1,10 @@ #!/bin/bash VERSION=$1 -SUMMARY_PATH=$2 +CHANGELOG_PATH=$2 TITLE="Upgrade MarketMaker canister to $VERSION" -SUMMARY=`cat $SUMMARY_PATH` +CHANGELOG=`cat $CHANGELOG_PATH` FUNCTION_ID=3 CANISTER_NAME=market_maker @@ -14,4 +14,4 @@ SCRIPT_DIR=$(dirname "$SCRIPT") cd $SCRIPT_DIR/.. # Submit the proposal -./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$SUMMARY" +./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$CHANGELOG" diff --git a/scripts/proposals/upgrade_neuron_controller.sh b/scripts/proposals/upgrade_neuron_controller.sh index 3590e501bb..652338e097 100755 --- a/scripts/proposals/upgrade_neuron_controller.sh +++ b/scripts/proposals/upgrade_neuron_controller.sh @@ -1,10 +1,10 @@ #!/bin/bash VERSION=$1 -SUMMARY_PATH=$2 +CHANGELOG_PATH=$2 TITLE="Upgrade NeuronController canister to $VERSION" -SUMMARY=`cat $SUMMARY_PATH` +CHANGELOG=`cat $CHANGELOG_PATH` FUNCTION_ID=3 CANISTER_NAME=neuron_controller @@ -14,4 +14,4 @@ SCRIPT_DIR=$(dirname "$SCRIPT") cd $SCRIPT_DIR/.. # Submit the proposal -./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$SUMMARY" +./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$CHANGELOG" diff --git a/scripts/proposals/upgrade_notifications.sh b/scripts/proposals/upgrade_notifications.sh index b17178c888..d097cf2290 100755 --- a/scripts/proposals/upgrade_notifications.sh +++ b/scripts/proposals/upgrade_notifications.sh @@ -1,10 +1,10 @@ #!/bin/bash VERSION=$1 -SUMMARY_PATH=$2 +CHANGELOG_PATH=$2 TITLE="Upgrade Notifications canisters to $VERSION" -SUMMARY=`cat $SUMMARY_PATH` +CHANGELOG=`cat $CHANGELOG_PATH` FUNCTION_ID=3000 CANISTER_NAME=notifications @@ -14,4 +14,4 @@ SCRIPT_DIR=$(dirname "$SCRIPT") cd $SCRIPT_DIR/.. # Submit the proposal -./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$SUMMARY" +./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$CHANGELOG" diff --git a/scripts/proposals/upgrade_notifications_index.sh b/scripts/proposals/upgrade_notifications_index.sh index eaf0f9acc7..e709e7db26 100755 --- a/scripts/proposals/upgrade_notifications_index.sh +++ b/scripts/proposals/upgrade_notifications_index.sh @@ -1,10 +1,10 @@ #!/bin/bash VERSION=$1 -SUMMARY_PATH=$2 +CHANGELOG_PATH=$2 TITLE="Upgrade NotificationsIndex canister to $VERSION" -SUMMARY=`cat $SUMMARY_PATH` +CHANGELOG=`cat $CHANGELOG_PATH` FUNCTION_ID=3 CANISTER_NAME=notifications_index @@ -14,4 +14,4 @@ SCRIPT_DIR=$(dirname "$SCRIPT") cd $SCRIPT_DIR/.. # Submit the proposal -./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$SUMMARY" +./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$CHANGELOG" diff --git a/scripts/proposals/upgrade_online_users.sh b/scripts/proposals/upgrade_online_users.sh index 0c0426f22c..0055571675 100755 --- a/scripts/proposals/upgrade_online_users.sh +++ b/scripts/proposals/upgrade_online_users.sh @@ -1,10 +1,10 @@ #!/bin/bash VERSION=$1 -SUMMARY_PATH=$2 +CHANGELOG_PATH=$2 TITLE="Upgrade OnlineUsers canister to $VERSION" -SUMMARY=`cat $SUMMARY_PATH` +CHANGELOG=`cat $CHANGELOG_PATH` FUNCTION_ID=3 CANISTER_NAME=online_users @@ -14,4 +14,4 @@ SCRIPT_DIR=$(dirname "$SCRIPT") cd $SCRIPT_DIR/.. # Submit the proposal -./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$SUMMARY" +./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$CHANGELOG" diff --git a/scripts/proposals/upgrade_proposal_validation.sh b/scripts/proposals/upgrade_proposal_validation.sh index be1ececb4c..d0aedaa5c4 100755 --- a/scripts/proposals/upgrade_proposal_validation.sh +++ b/scripts/proposals/upgrade_proposal_validation.sh @@ -1,10 +1,10 @@ #!/bin/bash VERSION=$1 -SUMMARY_PATH=$2 +CHANGELOG_PATH=$2 TITLE="Upgrade ProposalValidation canister to $VERSION" -SUMMARY=`cat $SUMMARY_PATH` +CHANGELOG=`cat $CHANGELOG_PATH` FUNCTION_ID=3 CANISTER_NAME=proposal_validation @@ -14,4 +14,4 @@ SCRIPT_DIR=$(dirname "$SCRIPT") cd $SCRIPT_DIR/.. # Submit the proposal -./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$SUMMARY" +./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$CHANGELOG" diff --git a/scripts/proposals/upgrade_proposals_bot.sh b/scripts/proposals/upgrade_proposals_bot.sh index 745aefcc0b..bd91f2128b 100755 --- a/scripts/proposals/upgrade_proposals_bot.sh +++ b/scripts/proposals/upgrade_proposals_bot.sh @@ -1,10 +1,10 @@ #!/bin/bash VERSION=$1 -SUMMARY_PATH=$2 +CHANGELOG_PATH=$2 TITLE="Upgrade ProposalsBot canister to $VERSION" -SUMMARY=`cat $SUMMARY_PATH` +CHANGELOG=`cat $CHANGELOG_PATH` FUNCTION_ID=3 CANISTER_NAME=proposals_bot @@ -14,4 +14,4 @@ SCRIPT_DIR=$(dirname "$SCRIPT") cd $SCRIPT_DIR/.. # Submit the proposal -./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$SUMMARY" +./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$CHANGELOG" diff --git a/scripts/proposals/upgrade_registry.sh b/scripts/proposals/upgrade_registry.sh index 527eba8131..e90b7a3122 100755 --- a/scripts/proposals/upgrade_registry.sh +++ b/scripts/proposals/upgrade_registry.sh @@ -1,10 +1,10 @@ #!/bin/bash VERSION=$1 -SUMMARY_PATH=$2 +CHANGELOG_PATH=$2 TITLE="Upgrade Registry canister to $VERSION" -SUMMARY=`cat $SUMMARY_PATH` +CHANGELOG=`cat $CHANGELOG_PATH` FUNCTION_ID=3 CANISTER_NAME=registry @@ -14,4 +14,4 @@ SCRIPT_DIR=$(dirname "$SCRIPT") cd $SCRIPT_DIR/.. # Submit the proposal -./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$SUMMARY" +./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$CHANGELOG" diff --git a/scripts/proposals/upgrade_storage_buckets.sh b/scripts/proposals/upgrade_storage_buckets.sh index 0db1837a6b..207f848a61 100755 --- a/scripts/proposals/upgrade_storage_buckets.sh +++ b/scripts/proposals/upgrade_storage_buckets.sh @@ -1,10 +1,10 @@ #!/bin/bash VERSION=$1 -SUMMARY_PATH=$2 +CHANGELOG_PATH=$2 TITLE="Upgrade StorageBucket canisters to $VERSION" -SUMMARY=`cat $SUMMARY_PATH` +CHANGELOG=`cat $CHANGELOG_PATH` FUNCTION_ID=5003 CANISTER_NAME=storage_bucket @@ -14,4 +14,4 @@ SCRIPT_DIR=$(dirname "$SCRIPT") cd $SCRIPT_DIR/.. # Submit the proposal -./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$SUMMARY" +./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$CHANGELOG" diff --git a/scripts/proposals/upgrade_storage_index.sh b/scripts/proposals/upgrade_storage_index.sh index f1500fd8f4..fa9b98df39 100755 --- a/scripts/proposals/upgrade_storage_index.sh +++ b/scripts/proposals/upgrade_storage_index.sh @@ -1,10 +1,10 @@ #!/bin/bash VERSION=$1 -SUMMARY_PATH=$2 +CHANGELOG_PATH=$2 TITLE="Upgrade StorageIndex canister to $VERSION" -SUMMARY=`cat $SUMMARY_PATH` +CHANGELOG=`cat $CHANGELOG_PATH` FUNCTION_ID=3 CANISTER_NAME=storage_index @@ -14,4 +14,4 @@ SCRIPT_DIR=$(dirname "$SCRIPT") cd $SCRIPT_DIR/.. # Submit the proposal -./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$SUMMARY" +./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$CHANGELOG" diff --git a/scripts/proposals/upgrade_translations.sh b/scripts/proposals/upgrade_translations.sh index 81bc90b284..f1ba2ee7d8 100755 --- a/scripts/proposals/upgrade_translations.sh +++ b/scripts/proposals/upgrade_translations.sh @@ -1,10 +1,10 @@ #!/bin/bash VERSION=$1 -SUMMARY_PATH=$2 +CHANGELOG_PATH=$2 TITLE="Upgrade Translations canister to $VERSION" -SUMMARY=`cat $SUMMARY_PATH` +CHANGELOG=`cat $CHANGELOG_PATH` FUNCTION_ID=3 CANISTER_NAME=translations @@ -14,4 +14,4 @@ SCRIPT_DIR=$(dirname "$SCRIPT") cd $SCRIPT_DIR/.. # Submit the proposal -./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$SUMMARY" +./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$CHANGELOG" diff --git a/scripts/proposals/upgrade_user_index.sh b/scripts/proposals/upgrade_user_index.sh index 383ef839c9..fe68e9d621 100755 --- a/scripts/proposals/upgrade_user_index.sh +++ b/scripts/proposals/upgrade_user_index.sh @@ -1,10 +1,10 @@ #!/bin/bash VERSION=$1 -SUMMARY_PATH=$2 +CHANGELOG_PATH=$2 TITLE="Upgrade UserIndex canister to $VERSION" -SUMMARY=`cat $SUMMARY_PATH` +CHANGELOG=`cat $CHANGELOG_PATH` FUNCTION_ID=3 CANISTER_NAME=user_index @@ -14,4 +14,4 @@ SCRIPT_DIR=$(dirname "$SCRIPT") cd $SCRIPT_DIR/.. # Submit the proposal -./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$SUMMARY" +./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$CHANGELOG" diff --git a/scripts/proposals/upgrade_users.sh b/scripts/proposals/upgrade_users.sh index f2567889e7..c907de9fba 100755 --- a/scripts/proposals/upgrade_users.sh +++ b/scripts/proposals/upgrade_users.sh @@ -1,10 +1,10 @@ #!/bin/bash VERSION=$1 -SUMMARY_PATH=$2 +CHANGELOG_PATH=$2 TITLE="Upgrade User canisters to $VERSION" -SUMMARY=`cat $SUMMARY_PATH` +CHANGELOG=`cat $CHANGELOG_PATH` FUNCTION_ID=1001 CANISTER_NAME=user @@ -14,4 +14,4 @@ SCRIPT_DIR=$(dirname "$SCRIPT") cd $SCRIPT_DIR/.. # Submit the proposal -./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$SUMMARY" +./make_upgrade_canister_proposal.sh $FUNCTION_ID $CANISTER_NAME "$VERSION" "$TITLE" "$CHANGELOG" diff --git a/scripts/verify-release.sh b/scripts/verify-release.sh index 29b1e1bbff..f36f17581f 100755 --- a/scripts/verify-release.sh +++ b/scripts/verify-release.sh @@ -22,7 +22,7 @@ rm -rf wasms docker cp $container_id:/build/wasms wasms docker rm --volumes $container_id -WASM_HASH=$(shasum -a 256 "./wasms/${CANISTER_NAME}.wasm.gz" | sed 's/ .*$//') +WASM_HASH=$(sha256sum "./wasms/${CANISTER_NAME}.wasm.gz" | sed 's/ .*$//') if [[ $WASM_HASH == $EXPECTED_WASM_HASH ]] then From 15cbaecbe9a8f2b2b1587612d085c20bc218bfd1 Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Fri, 26 Jan 2024 11:32:25 +0000 Subject: [PATCH 10/19] Upgrade DFX to 0.16.0 (#5268) --- README.md | 4 ++-- dfx.json | 2 +- scripts/proposals/upgrade_asset_canister.sh | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 222489288e..f9c5d8d254 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,9 @@ OpenChat is a fully featured chat application running end-to-end on the Internet ## Prerequisites -#### DFX 0.15.0 +#### DFX 0.16.0 -To install, run `DFX_VERSION=0.15.0 sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"` +To install, run `DFX_VERSION=0.16.0 sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"` #### Rust diff --git a/dfx.json b/dfx.json index 95318bc0df..28f7ea0324 100644 --- a/dfx.json +++ b/dfx.json @@ -1,5 +1,5 @@ { - "dfx": "0.15.2", + "dfx": "0.16.0", "canisters": { "user_index": { "type": "custom", diff --git a/scripts/proposals/upgrade_asset_canister.sh b/scripts/proposals/upgrade_asset_canister.sh index 22efc25ccf..7eb7098962 100755 --- a/scripts/proposals/upgrade_asset_canister.sh +++ b/scripts/proposals/upgrade_asset_canister.sh @@ -5,10 +5,10 @@ SCRIPT=$(readlink -f "$0") SCRIPT_DIR=$(dirname "$SCRIPT") cd $SCRIPT_DIR/../.. -TITLE="Upgrade asset canister to DFX version 0.15.2" -URL="https://github.com/dfinity/sdk/releases/tag/0.15.2" +TITLE="Upgrade asset canister to DFX version 0.16.0" +URL="https://github.com/dfinity/sdk/releases/tag/0.16.0" CANISTER_NAME=website -SUMMARY="This proposal upgrades the asset canister wasm to the version included in DFX 0.15.2" +SUMMARY="This proposal upgrades the asset canister wasm to the version included in DFX 0.16.0" FUNCTION_ID=3 # Set env variables based on .env file From e37fc48f0abf6e84a5de733d62b558a5ff3069cc Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Fri, 26 Jan 2024 11:59:31 +0000 Subject: [PATCH 11/19] Bump `ic-cdk`, `candid` + a few other dependencies (#5271) --- Cargo.lock | 1076 +++++------------ Cargo.toml | 27 +- .../impl/src/jobs/process_pending_actions.rs | 2 +- backend/canister_upgrader/src/lib.rs | 2 +- .../canisters/market_maker/impl/Cargo.toml | 2 +- .../impl/src/updates/stake_nns_neuron.rs | 4 +- .../api/src/notification_candid_gen.rs | 2 +- .../canisters/online_users/impl/Cargo.toml | 2 +- backend/canisters/registry/impl/Cargo.toml | 2 +- .../impl/src/model/reported_messages.rs | 6 +- .../libraries/canister_agent_utils/src/lib.rs | 2 +- .../libraries/canister_api_macros/src/lib.rs | 16 +- backend/libraries/icdex_client/src/lib.rs | 2 +- backend/libraries/sonic_client/src/lib.rs | 2 +- .../notification_pusher/core/src/ic_agent.rs | 2 +- scripts/run-integration-tests.sh | 2 +- 16 files changed, 363 insertions(+), 788 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d003144c93..f77d1ec096 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,37 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "abnf" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33741baa462d86e43fdec5e8ffca7c6ac82847ad06cbfb382c1bdbf527de9e6b" -dependencies = [ - "abnf-core", - "nom", -] - -[[package]] -name = "abnf-core" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c44e09c43ae1c368fb91a03a566472d0087c26cf7e1b9e8e289c14ede681dd7d" -dependencies = [ - "nom", -] - -[[package]] -name = "abnf_to_pest" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "939d59666dd9a7964a3a5312b9d24c9c107630752ee64f2dd5038189a23fe331" -dependencies = [ - "abnf", - "indexmap 1.9.3", - "itertools 0.10.5", - "pretty 0.11.3", -] - [[package]] name = "activity_notification_state" version = "0.1.0" @@ -59,10 +28,11 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aead" -version = "0.4.3" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" dependencies = [ + "crypto-common", "generic-array", ] @@ -73,25 +43,48 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" dependencies = [ "cfg-if", - "cipher", + "cipher 0.3.0", "cpufeatures", "opaque-debug", ] +[[package]] +name = "aes" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" +dependencies = [ + "cfg-if", + "cipher 0.4.4", + "cpufeatures", +] + [[package]] name = "aes-gcm" -version = "0.9.4" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6" +checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" dependencies = [ "aead", - "aes", - "cipher", + "aes 0.8.3", + "cipher 0.4.4", "ctr", "ghash", "subtle", ] +[[package]] +name = "ahash" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "1.1.1" @@ -101,6 +94,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + [[package]] name = "android-tzdata" version = "0.1.1" @@ -116,15 +115,6 @@ dependencies = [ "libc", ] -[[package]] -name = "annotate-snippets" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3b9d411ecbaf79885c6df4d75fff75858d5995ff25385657a28af47e82f9c36" -dependencies = [ - "unicode-width", -] - [[package]] name = "anstream" version = "0.6.4" @@ -179,12 +169,6 @@ version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" -[[package]] -name = "arbitrary" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d098ff73c1ca148721f37baad5ea6a465a13f9573aba8641fbbbae8164a54e" - [[package]] name = "argon2" version = "0.4.1" @@ -202,15 +186,6 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" -[[package]] -name = "ascii-canvas" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6" -dependencies = [ - "term", -] - [[package]] name = "asn1-rs" version = "0.5.2" @@ -711,12 +686,6 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" -[[package]] -name = "beef" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" - [[package]] name = "binread" version = "2.2.0" @@ -764,21 +733,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "bit-set" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" -dependencies = [ - "bit-vec", -] - -[[package]] -name = "bit-vec" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" - [[package]] name = "bitflags" version = "1.3.2" @@ -828,7 +782,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2cb03d1bed155d89dce0f845b7899b18a9a163e148fd004e1c28421a783e2d8e" dependencies = [ "block-padding", - "cipher", + "cipher 0.3.0", ] [[package]] @@ -867,7 +821,7 @@ dependencies = [ "bot_api", "candid", "canister_client", - "ic-cdk 0.11.3", + "ic-cdk", "msgpack", "tracing", "types", @@ -900,9 +854,9 @@ dependencies = [ [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" @@ -920,46 +874,47 @@ dependencies = [ "either", ] +[[package]] +name = "cached" +version = "0.46.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7c8c50262271cdf5abc979a5f76515c234e764fa025d1ba4862c0f0bcda0e95" +dependencies = [ + "ahash", + "hashbrown", + "instant", + "once_cell", + "thiserror", +] + [[package]] name = "candid" -version = "0.9.11" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "465c1ce01d8089ee5b49ba20d3a9da15a28bba64c35cdff2aa256d37e319625d" +checksum = "39be580be172631a35cac2fc6c765f365709de459edb88121b3e7a80cce6c1ec" dependencies = [ "anyhow", - "arbitrary", "binread", "byteorder", "candid_derive", - "codespan-reporting", - "convert_case", - "crc32fast", - "data-encoding", - "fake", "hex", - "lalrpop", - "lalrpop-util", + "ic_principal", "leb128", - "logos", "num-bigint 0.4.4", "num-traits", - "num_enum", "paste", - "pretty 0.12.3", - "rand", + "pretty", "serde", "serde_bytes", - "serde_dhall", - "sha2 0.10.8", "stacker", "thiserror", ] [[package]] name = "candid_derive" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201ea498d901add0822653ac94cb0f8a92f9b1758a5273f4dafbb6673c9a5020" +checksum = "970c220da8aa2fa6f7ef5dbbf3ea5b620a59eb3ac107cfb95ae8c6eebdfb7a08" dependencies = [ "lazy_static", "proc-macro2", @@ -983,7 +938,7 @@ dependencies = [ "dfx-core", "ic-agent", "ic-utils", - "itertools 0.11.0", + "itertools", "slog", "types", ] @@ -1005,7 +960,7 @@ version = "0.1.0" dependencies = [ "candid", "canister_client_macros", - "ic-cdk 0.11.3", + "ic-cdk", "serde", "tracing", ] @@ -1065,7 +1020,7 @@ version = "0.1.0" name = "canister_time" version = "0.1.0" dependencies = [ - "ic0 0.21.1", + "ic0", ] [[package]] @@ -1148,7 +1103,7 @@ version = "0.1.0" dependencies = [ "candid", "ic-ledger-types", - "itertools 0.11.0", + "itertools", "ledger_utils", "msgpack", "rand", @@ -1182,6 +1137,16 @@ dependencies = [ "generic-array", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + [[package]] name = "clap" version = "4.4.8" @@ -1243,16 +1208,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "codespan-reporting" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" -dependencies = [ - "termcolor", - "unicode-width", -] - [[package]] name = "colorchoice" version = "1.0.0" @@ -1277,7 +1232,7 @@ dependencies = [ "candid", "canister_client", "community_canister", - "ic-cdk 0.11.3", + "ic-cdk", "msgpack", "tracing", "types", @@ -1308,15 +1263,15 @@ dependencies = [ "group_index_canister", "group_index_canister_c2c_client", "http_request", - "ic-cdk 0.11.3", - "ic-cdk-macros 0.7.0", + "ic-cdk", + "ic-cdk-macros", "ic-cdk-timers", "ic-ledger-types", "ic-stable-structures", "icrc-ledger-types", "icrc_ledger_canister_c2c_client", "instruction_counts_log", - "itertools 0.11.0", + "itertools", "lazy_static", "ledger_utils", "local_user_index_canister", @@ -1375,15 +1330,6 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" -[[package]] -name = "convert_case" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" -dependencies = [ - "unicode-segmentation", -] - [[package]] name = "core-foundation" version = "0.9.3" @@ -1437,12 +1383,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - [[package]] name = "crypto-bigint" version = "0.4.9" @@ -1474,6 +1414,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core", "typenum", ] @@ -1495,11 +1436,24 @@ checksum = "f3b7eb4404b8195a9abb6356f4ac07d8ba267045c8d6d220ac4dc992e6cc75df" [[package]] name = "ctr" -version = "0.8.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" dependencies = [ - "cipher", + "cipher 0.4.4", +] + +[[package]] +name = "curve25519-dalek-ng" +version = "4.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c359b7249347e46fb28804470d071c921156ad62b3eef5d34e2ba867533dec8" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core", + "subtle-ng", + "zeroize", ] [[package]] @@ -1521,7 +1475,7 @@ dependencies = [ "candid", "canister_client", "cycles_dispenser_canister", - "ic-cdk 0.11.3", + "ic-cdk", "msgpack", "tracing", "types", @@ -1541,8 +1495,8 @@ dependencies = [ "cycles_minting_canister", "cycles_minting_canister_c2c_client", "human_readable", - "ic-cdk 0.11.3", - "ic-cdk-macros 0.7.0", + "ic-cdk", + "ic-cdk-macros", "ic-cdk-timers", "ic-ledger-types", "ic-stable-structures", @@ -1569,7 +1523,7 @@ dependencies = [ "canister_client", "cycles_dispenser_canister", "cycles_dispenser_canister_c2c_client", - "ic-cdk 0.11.3", + "ic-cdk", "ic-cdk-timers", "tracing", "types", @@ -1591,7 +1545,7 @@ dependencies = [ "candid", "canister_client", "cycles_minting_canister", - "ic-cdk 0.11.3", + "ic-cdk", "types", ] @@ -1602,7 +1556,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ "cfg-if", - "hashbrown 0.14.0", + "hashbrown", "lock_api", "once_cell", "parking_lot_core", @@ -1695,7 +1649,7 @@ dependencies = [ [[package]] name = "dfx-core" version = "0.0.1" -source = "git+https://github.com/dfinity/sdk?rev=5f256854b1bdf77f2c83bfb039d68f46b1f791eb#5f256854b1bdf77f2c83bfb039d68f46b1f791eb" +source = "git+https://github.com/hpeebles/dfinity-sdk?rev=d39dde0611fda8f30a6796b40b1dbb13a0541597#d39dde0611fda8f30a6796b40b1dbb13a0541597" dependencies = [ "aes-gcm", "argon2", @@ -1706,6 +1660,7 @@ dependencies = [ "clap", "dialoguer", "directories-next", + "dunce", "flate2", "hex", "humantime-serde", @@ -1731,60 +1686,19 @@ dependencies = [ "url", ] -[[package]] -name = "dhall" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9093ee48621ca9db16cd4948c7acf24a8ecc9af41cc9e226e39ea719df06d8b5" -dependencies = [ - "abnf_to_pest", - "annotate-snippets", - "elsa", - "hex", - "home", - "itertools 0.9.0", - "lazy_static", - "once_cell", - "percent-encoding", - "pest", - "pest_consume", - "pest_generator", - "quote", - "serde", - "serde_cbor", - "sha2 0.9.9", - "url", -] - -[[package]] -name = "dhall_proc_macros" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df7c81d16870879ef530b07cef32bc6088f98937ab4168106cc8e382a05146bf" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "dialoguer" -version = "0.10.4" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59c6f2989294b9a498d3ad5491a79c6deb604617378e1cdc4bfc1c1361fe2f87" +checksum = "658bce805d770f407bc62102fca7c2c64ceef2fbcb2b8bd19d2765ce093980de" dependencies = [ "console", "shell-words", "tempfile", + "thiserror", "zeroize", ] -[[package]] -name = "diff" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" - [[package]] name = "digest" version = "0.9.0" @@ -1816,16 +1730,6 @@ dependencies = [ "dirs-sys-next", ] -[[package]] -name = "dirs-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" -dependencies = [ - "cfg-if", - "dirs-sys-next", -] - [[package]] name = "dirs-sys-next" version = "0.1.2" @@ -1848,18 +1752,18 @@ dependencies = [ "syn 2.0.39", ] -[[package]] -name = "doc-comment" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" - [[package]] name = "dotenv" version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" +[[package]] +name = "dunce" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" + [[package]] name = "dyn-clone" version = "1.0.14" @@ -1931,6 +1835,21 @@ dependencies = [ "getrandom", ] +[[package]] +name = "ed25519-consensus" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c8465edc8ee7436ffea81d21a019b16676ee3db267aa8d5a8d729581ecf998b" +dependencies = [ + "curve25519-dalek-ng", + "hex", + "rand_core", + "serde", + "sha2 0.9.9", + "thiserror", + "zeroize", +] + [[package]] name = "either" version = "1.9.0" @@ -1979,24 +1898,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "elsa" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "714f766f3556b44e7e4776ad133fcc3445a489517c25c704ace411bb14790194" -dependencies = [ - "stable_deref_trait", -] - -[[package]] -name = "ena" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c533630cf40e9caa44bd91aadc88a75d75a4c3a12b4cfde353cbed41daa1e1f1" -dependencies = [ - "log", -] - [[package]] name = "encode_unicode" version = "0.3.6" @@ -2079,7 +1980,7 @@ dependencies = [ "candid", "canister_client", "escrow_canister", - "ic-cdk 0.11.3", + "ic-cdk", "msgpack", "tracing", "types", @@ -2098,8 +1999,8 @@ dependencies = [ "canister_tracing_macros", "escrow_canister", "http_request", - "ic-cdk 0.11.3", - "ic-cdk-macros 0.7.0", + "ic-cdk", + "ic-cdk-macros", "ic-cdk-timers", "ic-stable-structures", "icrc-ledger-types", @@ -2142,16 +2043,6 @@ dependencies = [ "pin-project-lite", ] -[[package]] -name = "fake" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9af7b0c58ac9d03169e27f080616ce9f64004edca3d2ef4147a811c21b23b319" -dependencies = [ - "rand", - "unidecode", -] - [[package]] name = "fastrand" version = "1.9.0" @@ -2205,7 +2096,7 @@ version = "0.1.0" dependencies = [ "canister_client", "futures", - "ic-cdk 0.11.3", + "ic-cdk", "ic-cdk-timers", "serde", "serde_bytes", @@ -2214,12 +2105,6 @@ dependencies = [ "utils", ] -[[package]] -name = "fixedbitset" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" - [[package]] name = "flate2" version = "1.0.27" @@ -2405,9 +2290,9 @@ dependencies = [ [[package]] name = "ghash" -version = "0.4.4" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" +checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" dependencies = [ "opaque-debug", "polyval", @@ -2460,7 +2345,7 @@ dependencies = [ "candid", "canister_client", "group_canister", - "ic-cdk 0.11.3", + "ic-cdk", "msgpack", "tracing", "types", @@ -2500,8 +2385,8 @@ dependencies = [ "group_index_canister", "group_index_canister_c2c_client", "http_request", - "ic-cdk 0.11.3", - "ic-cdk-macros 0.7.0", + "ic-cdk", + "ic-cdk-macros", "ic-cdk-timers", "ic-ledger-types", "ic-stable-structures", @@ -2509,7 +2394,7 @@ dependencies = [ "icrc-ledger-types", "icrc_ledger_canister_c2c_client", "instruction_counts_log", - "itertools 0.11.0", + "itertools", "ledger_utils", "local_user_index_canister", "local_user_index_canister_c2c_client", @@ -2577,7 +2462,7 @@ version = "0.1.0" dependencies = [ "canister_client", "group_index_canister", - "ic-cdk 0.11.3", + "ic-cdk", "msgpack", "tracing", "types", @@ -2613,8 +2498,8 @@ dependencies = [ "group_index_canister", "http_request", "human_readable", - "ic-cdk 0.11.3", - "ic-cdk-macros 0.7.0", + "ic-cdk", + "ic-cdk-macros", "ic-cdk-timers", "ic-stable-structures", "local_group_index_canister", @@ -2659,8 +2544,8 @@ dependencies = [ "group_canister_c2c_client", "group_prize_bot", "http_request", - "ic-cdk 0.11.3", - "ic-cdk-macros 0.7.0", + "ic-cdk", + "ic-cdk-macros", "ic-cdk-timers", "ic-ledger-types", "ic-stable-structures", @@ -2697,7 +2582,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 2.0.0", + "indexmap", "slab", "tokio", "tokio-util", @@ -2710,17 +2595,15 @@ version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - [[package]] name = "hashbrown" version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +dependencies = [ + "ahash", + "allocator-api2", +] [[package]] name = "heck" @@ -2805,15 +2688,6 @@ dependencies = [ "digest 0.10.7", ] -[[package]] -name = "home" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" -dependencies = [ - "windows-sys 0.48.0", -] - [[package]] name = "http" version = "0.2.9" @@ -2975,12 +2849,14 @@ dependencies = [ [[package]] name = "ic-agent" -version = "0.29.0" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7be96efa1a9a680072c1faa0ce4538f31080b72e8e3ad91e9bf90db0256281" +checksum = "410a8c1bdd647dfc43978497e8f794378a18eeb3ec7c768b92c3885c999e1d1b" dependencies = [ "backoff", + "cached", "candid", + "ed25519-consensus", "futures-util", "hex", "http", @@ -2993,6 +2869,7 @@ dependencies = [ "pem 2.0.1", "pkcs8 0.10.2", "rand", + "rangemap", "reqwest", "ring 0.16.20", "rustls-webpki", @@ -3011,48 +2888,21 @@ dependencies = [ [[package]] name = "ic-cdk" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d4c0b932bf454d5d60e61e13c3c944972fcfd74dc82b9ed5c8b0a75979cf50" -dependencies = [ - "candid", - "ic-cdk-macros 0.7.0", - "ic0 0.18.12", - "serde", - "serde_bytes", -] - -[[package]] -name = "ic-cdk" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c126ac20219abff15c3441282e9da6aa7244319d5a4a42c7260667237e790712" +checksum = "e4ec8231f413b8a4d74b99d7df26d6e917d6528a6245abde27f251210dcf9b72" dependencies = [ "candid", - "ic-cdk-macros 0.8.1", - "ic0 0.21.1", + "ic-cdk-macros", + "ic0", "serde", "serde_bytes", ] [[package]] name = "ic-cdk-macros" -version = "0.7.0" -source = "git+https://github.com/hpeebles/cdk-rs?rev=cc49cf7e3e2f10a12182149b0964372a04c09f08#cc49cf7e3e2f10a12182149b0964372a04c09f08" -dependencies = [ - "candid", - "proc-macro2", - "quote", - "serde", - "serde_tokenstream 0.1.7", - "syn 1.0.109", -] - -[[package]] -name = "ic-cdk-macros" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6295fd7389c198a97dd99b28b846e18487d99303077102d817eebbf6a924cd" +version = "0.8.4" +source = "git+https://github.com/hpeebles/cdk-rs?rev=1833cb37ecfd6154cc9cc55b5de76329114e8c5f#1833cb37ecfd6154cc9cc55b5de76329114e8c5f" dependencies = [ "candid", "proc-macro2", @@ -3064,13 +2914,13 @@ dependencies = [ [[package]] name = "ic-cdk-timers" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96fa62243d3a412ceae88d6ad213614769e8b0bbcaeb98abb2e7985074257356" +checksum = "8c43b9706fef3ad10c4192a14801d16bd9539068239f0f06f257857441364329" dependencies = [ "futures", - "ic-cdk 0.11.3", - "ic0 0.21.1", + "ic-cdk", + "ic0", "serde", "serde_bytes", "slotmap", @@ -3078,9 +2928,9 @@ dependencies = [ [[package]] name = "ic-certification" -version = "1.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a59dc342d11b2067e19d0f146bdec3674de921303ffc762f114d201ebbe0e68a" +checksum = "b79fd38f674173bd0af3c80b9dab6fedd3391b81a2fc0f87a2e393fb723fe13b" dependencies = [ "hex", "serde", @@ -3090,9 +2940,9 @@ dependencies = [ [[package]] name = "ic-identity-hsm" -version = "0.29.0" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "591a2d8f1f9d48cdd855a063b2d5b986cee37dd9795ba2a18d3dba1378532c8c" +checksum = "478f1fb56cdda5959ac4a685dbe74c56f25226212defb34ab5cf136f4b919344" dependencies = [ "hex", "ic-agent", @@ -3104,14 +2954,14 @@ dependencies = [ [[package]] name = "ic-ledger-types" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f018f5ed6f4a51618b58b415cbecc08dd79a357a2df2e2661be2aa5ffb86630" +checksum = "b1fea91d351eca80ffa8427e77df3210e37d292c6c75afbe1ca5e6437418e022" dependencies = [ "candid", "crc32fast", "hex", - "ic-cdk 0.11.3", + "ic-cdk", "serde", "serde_bytes", "sha2 0.10.8", @@ -3119,17 +2969,17 @@ dependencies = [ [[package]] name = "ic-stable-structures" -version = "0.6.0" -source = "git+https://github.com/hpeebles/stable-structures?rev=937aac129d0eba11fc8aef719a1da20b269b83c6#937aac129d0eba11fc8aef719a1da20b269b83c6" +version = "0.6.3" +source = "git+https://github.com/hpeebles/stable-structures?rev=c90b987741a7454b10e306df55e2dde82d1694cf#c90b987741a7454b10e306df55e2dde82d1694cf" dependencies = [ - "candid", + "ic_principal", ] [[package]] name = "ic-transport-types" -version = "0.29.0" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c97e3c1de364b46489da5ccdfd90a57c70a51b5d9a05a5a4d8945c67b6bdcc2" +checksum = "2cb030f03ef8332fbf8eda6bb25e80d8354d2bef88b27e671b3c167d9ee8e7a7" dependencies = [ "candid", "hex", @@ -3144,17 +2994,19 @@ dependencies = [ [[package]] name = "ic-utils" -version = "0.29.0" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c8887499adc4b7485ec7b70c22aa3d8d2d8a7a0cf1a59803e36590925984097" +checksum = "2921308283f89a431872ba63f5ece9ffe6eadf7bc4cc5d12239eae146c7db8f0" dependencies = [ "async-trait", "candid", + "futures-util", "ic-agent", "once_cell", "semver", "serde", "serde_bytes", + "sha2 0.10.8", "strum", "strum_macros", "thiserror", @@ -3175,15 +3027,22 @@ dependencies = [ [[package]] name = "ic0" -version = "0.18.12" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16efdbe5d9b0ea368da50aedbf7640a054139569236f1a5249deb5fd9af5a5d5" +checksum = "a54b5297861c651551676e8c43df805dad175cc33bc97dbd992edbbb85dcbcdf" [[package]] -name = "ic0" -version = "0.21.1" +name = "ic_principal" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a54b5297861c651551676e8c43df805dad175cc33bc97dbd992edbbb85dcbcdf" +checksum = "1762deb6f7c8d8c2bdee4b6c5a47b60195b74e9b5280faa5ba29692f8e17429c" +dependencies = [ + "crc32fast", + "data-encoding", + "serde", + "sha2 0.10.8", + "thiserror", +] [[package]] name = "icdex_canister" @@ -3201,7 +3060,7 @@ version = "0.1.0" dependencies = [ "candid", "canister_client", - "ic-cdk 0.11.3", + "ic-cdk", "icdex_canister", "types", ] @@ -3212,7 +3071,7 @@ version = "0.1.0" dependencies = [ "candid", "hex", - "ic-cdk 0.11.3", + "ic-cdk", "icdex_canister", "icdex_canister_c2c_client", "icrc-ledger-types", @@ -3245,8 +3104,8 @@ dependencies = [ "canister_state_macros", "canister_tracing_macros", "http_request", - "ic-cdk 0.11.3", - "ic-cdk-macros 0.7.0", + "ic-cdk", + "ic-cdk-macros", "ic-cdk-timers", "ic-ledger-types", "ic-stable-structures", @@ -3284,7 +3143,7 @@ version = "0.1.0" dependencies = [ "candid", "canister_client", - "ic-cdk 0.11.3", + "ic-cdk", "icp_ledger_canister", "types", ] @@ -3294,7 +3153,7 @@ name = "icpswap_client" version = "0.1.0" dependencies = [ "candid", - "ic-cdk 0.11.3", + "ic-cdk", "icpswap_swap_pool_canister", "icpswap_swap_pool_canister_c2c_client", "icrc-ledger-types", @@ -3318,16 +3177,16 @@ version = "0.1.0" dependencies = [ "candid", "canister_client", - "ic-cdk 0.11.3", + "ic-cdk", "icpswap_swap_pool_canister", "types", ] [[package]] name = "icrc-ledger-types" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dafdc6d688022822cda32f534ea13bb0b72b5f1a82235fbb4bc24250b1d8418b" +checksum = "804c892bf95652101660a25cea10f059f73eb8973f6b04e0349758fda1190447" dependencies = [ "base32", "candid", @@ -3357,7 +3216,7 @@ version = "0.1.0" dependencies = [ "candid", "canister_client", - "ic-cdk 0.11.3", + "ic-cdk", "icrc_ledger_canister", "types", ] @@ -3378,7 +3237,7 @@ version = "0.1.0" dependencies = [ "candid", "canister_client", - "ic-cdk 0.11.3", + "ic-cdk", "identity_canister", "tracing", "types", @@ -3394,8 +3253,8 @@ dependencies = [ "canister_state_macros", "canister_tracing_macros", "http_request", - "ic-cdk 0.11.3", - "ic-cdk-macros 0.7.0", + "ic-cdk", + "ic-cdk-macros", "ic-cdk-timers", "ic-stable-structures", "identity_canister", @@ -3431,22 +3290,21 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.3" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" dependencies = [ - "autocfg", - "hashbrown 0.12.3", + "equivalent", + "hashbrown", ] [[package]] -name = "indexmap" -version = "2.0.0" +name = "inout" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" dependencies = [ - "equivalent", - "hashbrown 0.14.0", + "generic-array", ] [[package]] @@ -3478,12 +3336,12 @@ dependencies = [ "escrow_canister", "group_canister", "group_index_canister", - "ic-cdk 0.11.3", + "ic-cdk", "ic-ledger-types", "icrc-ledger-types", "icrc_ledger_canister", "identity_canister", - "itertools 0.11.0", + "itertools", "lazy_static", "ledger_utils", "local_user_index_canister", @@ -3525,35 +3383,6 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" -[[package]] -name = "is-terminal" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" -dependencies = [ - "hermit-abi", - "rustix 0.38.14", - "windows-sys 0.48.0", -] - -[[package]] -name = "itertools" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" -dependencies = [ - "either", -] - -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.11.0" @@ -3652,38 +3481,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "lalrpop" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da4081d44f4611b66c6dd725e6de3169f9f63905421e8626fcb86b6a898998b8" -dependencies = [ - "ascii-canvas", - "bit-set", - "diff", - "ena", - "is-terminal", - "itertools 0.10.5", - "lalrpop-util", - "petgraph", - "pico-args", - "regex", - "regex-syntax 0.7.5", - "string_cache", - "term", - "tiny-keccak", - "unicode-xid", -] - -[[package]] -name = "lalrpop-util" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f35c735096c0293d313e8f2a641627472b83d01b937177fe76e5e2708d31e0d" -dependencies = [ - "regex", -] - [[package]] name = "lazy_static" version = "1.4.0" @@ -3776,7 +3573,7 @@ name = "local_group_index_canister_c2c_client" version = "0.1.0" dependencies = [ "canister_client", - "ic-cdk 0.11.3", + "ic-cdk", "local_group_index_canister", "msgpack", "tracing", @@ -3796,8 +3593,8 @@ dependencies = [ "futures", "group_canister", "http_request", - "ic-cdk 0.11.3", - "ic-cdk-macros 0.7.0", + "ic-cdk", + "ic-cdk-macros", "ic-cdk-timers", "ic-ledger-types", "ic-stable-structures", @@ -3836,7 +3633,7 @@ version = "0.1.0" dependencies = [ "candid", "canister_client", - "ic-cdk 0.11.3", + "ic-cdk", "local_user_index_canister", "msgpack", "tracing", @@ -3859,14 +3656,14 @@ dependencies = [ "group_canister", "group_canister_c2c_client", "http_request", - "ic-cdk 0.11.3", - "ic-cdk-macros 0.7.0", + "ic-cdk", + "ic-cdk-macros", "ic-cdk-timers", "ic-ledger-types", "ic-stable-structures", "icrc-ledger-types", "icrc_ledger_canister_c2c_client", - "itertools 0.11.0", + "itertools", "ledger_utils", "local_user_index_canister", "msgpack", @@ -3903,38 +3700,6 @@ version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" -[[package]] -name = "logos" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c000ca4d908ff18ac99b93a062cb8958d331c3220719c52e77cb19cc6ac5d2c1" -dependencies = [ - "logos-derive", -] - -[[package]] -name = "logos-codegen" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc487311295e0002e452025d6b580b77bb17286de87b57138f3b5db711cded68" -dependencies = [ - "beef", - "fnv", - "proc-macro2", - "quote", - "regex-syntax 0.6.29", - "syn 2.0.39", -] - -[[package]] -name = "logos-derive" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbfc0d229f1f42d790440136d941afd806bc9e949e2bcb8faa813b0f00d1267e" -dependencies = [ - "logos-codegen", -] - [[package]] name = "market_maker_canister" version = "0.1.0" @@ -3969,14 +3734,14 @@ dependencies = [ "futures", "hex", "http_request", - "ic-cdk 0.11.3", - "ic-cdk-macros 0.7.0", + "ic-cdk", + "ic-cdk-macros", "ic-cdk-timers", "ic-stable-structures", "icdex_client", "icrc-ledger-types", "icrc_ledger_canister_c2c_client", - "itertools 0.11.0", + "itertools", "market_maker_canister", "msgpack", "rand", @@ -4071,7 +3836,7 @@ version = "0.1.0" dependencies = [ "candid", "canister_client", - "ic-cdk 0.11.3", + "ic-cdk", "modclub_canister", "types", ] @@ -4137,8 +3902,8 @@ dependencies = [ "hex", "http_request", "human_readable", - "ic-cdk 0.11.3", - "ic-cdk-macros 0.7.0", + "ic-cdk", + "ic-cdk-macros", "ic-cdk-timers", "ic-ledger-types", "ic-stable-structures", @@ -4162,12 +3927,6 @@ dependencies = [ "utils", ] -[[package]] -name = "new_debug_unreachable" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" - [[package]] name = "nix" version = "0.22.3" @@ -4198,7 +3957,7 @@ version = "0.1.0" dependencies = [ "candid", "canister_client", - "ic-cdk 0.11.3", + "ic-cdk", "nns_governance_canister", "types", ] @@ -4289,7 +4048,7 @@ name = "notifications_canister_c2c_client" version = "0.1.0" dependencies = [ "canister_client", - "ic-cdk 0.11.3", + "ic-cdk", "msgpack", "notifications_canister", "tracing", @@ -4318,8 +4077,8 @@ dependencies = [ "canister_state_macros", "canister_tracing_macros", "http_request", - "ic-cdk 0.11.3", - "ic-cdk-macros 0.7.0", + "ic-cdk", + "ic-cdk-macros", "ic-cdk-timers", "ic-stable-structures", "msgpack", @@ -4351,7 +4110,7 @@ name = "notifications_index_canister_c2c_client" version = "0.1.0" dependencies = [ "canister_client", - "ic-cdk 0.11.3", + "ic-cdk", "msgpack", "notifications_index_canister", "tracing", @@ -4381,8 +4140,8 @@ dependencies = [ "futures", "http_request", "human_readable", - "ic-cdk 0.11.3", - "ic-cdk-macros 0.7.0", + "ic-cdk", + "ic-cdk-macros", "ic-cdk-timers", "ic-stable-structures", "msgpack", @@ -4526,27 +4285,6 @@ dependencies = [ "libc", ] -[[package]] -name = "num_enum" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" -dependencies = [ - "num_enum_derive", -] - -[[package]] -name = "num_enum_derive" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" -dependencies = [ - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn 2.0.39", -] - [[package]] name = "object" version = "0.32.1" @@ -4601,8 +4339,8 @@ dependencies = [ "canister_state_macros", "canister_tracing_macros", "http_request", - "ic-cdk 0.11.3", - "ic-cdk-macros 0.7.0", + "ic-cdk", + "ic-cdk-macros", "ic-cdk-timers", "ic-stable-structures", "online_users_canister", @@ -4831,98 +4569,6 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" -[[package]] -name = "pest" -version = "2.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7a4d085fd991ac8d5b05a147b437791b4260b76326baf0fc60cf7c9c27ecd33" -dependencies = [ - "memchr", - "thiserror", - "ucd-trie", -] - -[[package]] -name = "pest_consume" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79447402d15d18e7142e14c72f2e63fa3d155be1bc5b70b3ccbb610ac55f536b" -dependencies = [ - "pest", - "pest_consume_macros", - "pest_derive", -] - -[[package]] -name = "pest_consume_macros" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d8630a7a899cb344ec1c16ba0a6b24240029af34bdc0a21f84e411d7f793f29" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "pest_derive" -version = "2.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bee7be22ce7918f641a33f08e3f43388c7656772244e2bbb2477f44cc9021a" -dependencies = [ - "pest", - "pest_generator", -] - -[[package]] -name = "pest_generator" -version = "2.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1511785c5e98d79a05e8a6bc34b4ac2168a0e3e92161862030ad84daa223141" -dependencies = [ - "pest", - "pest_meta", - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "pest_meta" -version = "2.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42f0394d3123e33353ca5e1e89092e533d2cc490389f2bd6131c43c634ebc5f" -dependencies = [ - "once_cell", - "pest", - "sha2 0.10.8", -] - -[[package]] -name = "petgraph" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" -dependencies = [ - "fixedbitset", - "indexmap 2.0.0", -] - -[[package]] -name = "phf_shared" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" -dependencies = [ - "siphasher", -] - -[[package]] -name = "pico-args" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" - [[package]] name = "pin-project-lite" version = "0.2.13" @@ -4986,15 +4632,15 @@ checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "pocket-ic" version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce4c698117a4cc5fce56a909db4fce965003f041c1bf916b7cd8a6757b017586" +source = "git+https://github.com/dfinity/ic?rev=a7862784e8da4a97a1d608fd5b3db365de41a2d7#a7862784e8da4a97a1d608fd5b3db365de41a2d7" dependencies = [ "async-trait", "base64 0.13.1", "candid", "hex", - "ic-cdk 0.10.0", + "ic-cdk", "reqwest", + "schemars", "serde", "serde_bytes", "serde_json", @@ -5021,9 +4667,9 @@ dependencies = [ [[package]] name = "polyval" -version = "0.5.3" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" +checksum = "d52cff9d1d4dee5fe6d03729099f4a310a41179e0a10dbf542039873f2e826fb" dependencies = [ "cfg-if", "cpufeatures", @@ -5043,24 +4689,6 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" -[[package]] -name = "precomputed-hash" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" - -[[package]] -name = "pretty" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83f3aa1e3ca87d3b124db7461265ac176b40c277f37e503eaa29c9c75c037846" -dependencies = [ - "arrayvec", - "log", - "typed-arena", - "unicode-segmentation", -] - [[package]] name = "pretty" version = "0.12.3" @@ -5147,8 +4775,8 @@ dependencies = [ "candid", "canister_api_macros", "human_readable", - "ic-cdk 0.11.3", - "ic-cdk-macros 0.7.0", + "ic-cdk", + "ic-cdk-macros", "proposal_validation_canister", ] @@ -5170,7 +4798,7 @@ name = "proposals_bot_canister_c2c_client" version = "0.1.0" dependencies = [ "canister_client", - "ic-cdk 0.11.3", + "ic-cdk", "msgpack", "proposals_bot_canister", "tracing", @@ -5198,13 +4826,13 @@ dependencies = [ "hex", "http_request", "human_readable", - "ic-cdk 0.11.3", - "ic-cdk-macros 0.7.0", + "ic-cdk", + "ic-cdk-macros", "ic-cdk-timers", "ic-stable-structures", "icrc-ledger-types", "icrc_ledger_canister_c2c_client", - "itertools 0.11.0", + "itertools", "ledger_utils", "msgpack", "nns_governance_canister", @@ -5294,6 +4922,12 @@ dependencies = [ "smallvec", ] +[[package]] +name = "rangemap" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "977b1e897f9d764566891689e642653e5ed90c6895106acd005eb4c1d0203991" + [[package]] name = "redox_syscall" version = "0.2.16" @@ -5389,7 +5023,7 @@ name = "registry_canister_c2c_client" version = "0.1.0" dependencies = [ "canister_client", - "ic-cdk 0.11.3", + "ic-cdk", "msgpack", "registry_canister", "tracing", @@ -5419,8 +5053,8 @@ dependencies = [ "futures", "http_request", "human_readable", - "ic-cdk 0.11.3", - "ic-cdk-macros 0.7.0", + "ic-cdk", + "ic-cdk-macros", "ic-cdk-timers", "ic-stable-structures", "icrc-ledger-types", @@ -5722,7 +5356,7 @@ name = "satoshi_dice_canister_c2c_client" version = "0.1.0" dependencies = [ "canister_client", - "ic-cdk 0.11.3", + "ic-cdk", "msgpack", "satoshi_dice_canister", "tracing", @@ -5740,8 +5374,8 @@ dependencies = [ "canister_tracing_macros", "futures", "http_request", - "ic-cdk 0.11.3", - "ic-cdk-macros 0.7.0", + "ic-cdk", + "ic-cdk-macros", "ic-cdk-timers", "ic-ledger-types", "ic-stable-structures", @@ -5775,9 +5409,9 @@ dependencies = [ [[package]] name = "schemars" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f7b0ce13155372a76ee2e1c5ffba1fe61ede73fbea5630d61eee6fac4929c0c" +checksum = "45a28f4c49489add4ce10783f7911893516f15afe45d015608d41faca6bc4d29" dependencies = [ "dyn-clone", "schemars_derive", @@ -5787,9 +5421,9 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e85e2a16b12bdb763244c69ab79363d71db2b4b918a2def53f80b02e0574b13c" +checksum = "c767fd6fa65d9ccf9cf026122c1b555f2ef9a4f0cea69da4d7dbc3e258d30967" dependencies = [ "proc-macro2", "quote", @@ -5871,7 +5505,7 @@ version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1da5c423b8783185fd3fecd1c8796c267d2c089d894ce5a93c280a5d3f780a2" dependencies = [ - "aes", + "aes 0.7.5", "block-modes", "hkdf 0.11.0", "lazy_static", @@ -5967,19 +5601,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "serde_dhall" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c01a6b1d6f9f33bb1ad5652249e938297e43a1f43418236f7b72e64837e347" -dependencies = [ - "dhall", - "dhall_proc_macros", - "doc-comment", - "serde", - "url", -] - [[package]] name = "serde_json" version = "1.0.108" @@ -6167,12 +5788,6 @@ dependencies = [ "time", ] -[[package]] -name = "siphasher" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" - [[package]] name = "slab" version = "0.4.9" @@ -6225,8 +5840,8 @@ dependencies = [ "canister_state_macros", "canister_tracing_macros", "http_request", - "ic-cdk 0.11.3", - "ic-cdk-macros 0.7.0", + "ic-cdk", + "ic-cdk-macros", "ic-cdk-timers", "ic-stable-structures", "msgpack", @@ -6262,7 +5877,7 @@ version = "0.1.0" dependencies = [ "candid", "canister_client", - "ic-cdk 0.11.3", + "ic-cdk", "sns_governance_canister", "types", ] @@ -6283,7 +5898,7 @@ version = "0.1.0" dependencies = [ "candid", "canister_client", - "ic-cdk 0.11.3", + "ic-cdk", "sns_root_canister", "types", ] @@ -6304,7 +5919,7 @@ version = "0.1.0" dependencies = [ "candid", "canister_client", - "ic-cdk 0.11.3", + "ic-cdk", "sns_swap_canister", "types", ] @@ -6325,7 +5940,7 @@ version = "0.1.0" dependencies = [ "candid", "canister_client", - "ic-cdk 0.11.3", + "ic-cdk", "sns_wasm_canister", "types", ] @@ -6366,7 +5981,7 @@ version = "0.1.0" dependencies = [ "candid", "canister_client", - "ic-cdk 0.11.3", + "ic-cdk", "sonic_canister", "types", ] @@ -6376,7 +5991,7 @@ name = "sonic_client" version = "0.1.0" dependencies = [ "candid", - "ic-cdk 0.11.3", + "ic-cdk", "icrc-ledger-types", "ledger_utils", "serde", @@ -6418,17 +6033,11 @@ dependencies = [ "der 0.7.8", ] -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - [[package]] name = "stable_memory" version = "0.1.0" dependencies = [ - "ic-cdk 0.11.3", + "ic-cdk", "ic-stable-structures", ] @@ -6468,7 +6077,7 @@ version = "0.1.0" dependencies = [ "candid", "canister_client", - "ic-cdk 0.11.3", + "ic-cdk", "storage_bucket_canister", "tracing", "types", @@ -6483,8 +6092,8 @@ dependencies = [ "canister_state_macros", "canister_tracing_macros", "http_request", - "ic-cdk 0.11.3", - "ic-cdk-macros 0.7.0", + "ic-cdk", + "ic-cdk-macros", "ic-cdk-timers", "ic-stable-structures", "num-traits", @@ -6506,7 +6115,7 @@ name = "storage_bucket_client" version = "0.1.0" dependencies = [ "futures", - "ic-cdk 0.11.3", + "ic-cdk", "storage_bucket_canister", "storage_bucket_canister_c2c_client", "types", @@ -6530,7 +6139,7 @@ version = "0.1.0" dependencies = [ "candid", "canister_client", - "ic-cdk 0.11.3", + "ic-cdk", "storage_index_canister", "tracing", "types", @@ -6560,8 +6169,8 @@ dependencies = [ "futures", "http_request", "human_readable", - "ic-cdk 0.11.3", - "ic-cdk-macros 0.7.0", + "ic-cdk", + "ic-cdk-macros", "ic-cdk-timers", "ic-stable-structures", "msgpack", @@ -6577,19 +6186,6 @@ dependencies = [ "utils", ] -[[package]] -name = "string_cache" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" -dependencies = [ - "new_debug_unreachable", - "once_cell", - "parking_lot", - "phf_shared", - "precomputed-hash", -] - [[package]] name = "strsim" version = "0.10.0" @@ -6621,6 +6217,12 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +[[package]] +name = "subtle-ng" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "734676eb262c623cec13c3155096e08d1f8f29adce39ba17948b18dad1e54142" + [[package]] name = "syn" version = "1.0.109" @@ -6700,26 +6302,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "term" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" -dependencies = [ - "dirs-next", - "rustversion", - "winapi", -] - -[[package]] -name = "termcolor" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" -dependencies = [ - "winapi-util", -] - [[package]] name = "test-case" version = "3.2.1" @@ -6833,15 +6415,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - [[package]] name = "tinyvec" version = "1.6.0" @@ -6942,7 +6515,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.0.0", + "indexmap", "toml_datetime", "winnow", ] @@ -7058,8 +6631,8 @@ dependencies = [ "canister_state_macros", "canister_tracing_macros", "http_request", - "ic-cdk 0.11.3", - "ic-cdk-macros 0.7.0", + "ic-cdk", + "ic-cdk-macros", "ic-cdk-timers", "ic-stable-structures", "rand", @@ -7104,12 +6677,6 @@ dependencies = [ "serde_bytes", ] -[[package]] -name = "ucd-trie" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" - [[package]] name = "unicase" version = "2.7.0" @@ -7140,12 +6707,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-segmentation" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" - [[package]] name = "unicode-width" version = "0.1.11" @@ -7158,19 +6719,13 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" -[[package]] -name = "unidecode" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "402bb19d8e03f1d1a7450e2bd613980869438e0666331be3e073089124aa1adc" - [[package]] name = "universal-hash" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" dependencies = [ - "generic-array", + "crypto-common", "subtle", ] @@ -7224,7 +6779,7 @@ version = "0.1.0" dependencies = [ "candid", "canister_client", - "ic-cdk 0.11.3", + "ic-cdk", "msgpack", "tracing", "types", @@ -7268,8 +6823,8 @@ dependencies = [ "group_index_canister", "group_index_canister_c2c_client", "http_request", - "ic-cdk 0.11.3", - "ic-cdk-macros 0.7.0", + "ic-cdk", + "ic-cdk-macros", "ic-cdk-timers", "ic-ledger-types", "ic-stable-structures", @@ -7277,7 +6832,7 @@ dependencies = [ "icrc-ledger-types", "icrc_ledger_canister", "icrc_ledger_canister_c2c_client", - "itertools 0.11.0", + "itertools", "ledger_utils", "local_user_index_canister", "local_user_index_canister_c2c_client", @@ -7328,7 +6883,7 @@ version = "0.1.0" dependencies = [ "candid", "canister_client", - "ic-cdk 0.11.3", + "ic-cdk", "msgpack", "tracing", "types", @@ -7366,8 +6921,8 @@ dependencies = [ "group_canister_c2c_client", "http_request", "human_readable", - "ic-cdk 0.11.3", - "ic-cdk-macros 0.7.0", + "ic-cdk", + "ic-cdk-macros", "ic-cdk-timers", "ic-ledger-types", "ic-stable-structures", @@ -7375,7 +6930,7 @@ dependencies = [ "icrc_ledger_canister_c2c_client", "identity_canister", "identity_canister_c2c_client", - "itertools 0.11.0", + "itertools", "ledger_utils", "local_user_index_canister", "local_user_index_canister_c2c_client", @@ -7425,9 +6980,9 @@ dependencies = [ "canister_client", "cycles_dispenser_client", "getrandom", - "ic-cdk 0.11.3", + "ic-cdk", "ic-cdk-timers", - "itertools 0.11.0", + "itertools", "msgpack", "rand", "serde", @@ -7621,15 +7176,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" -dependencies = [ - "winapi", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -7863,6 +7409,26 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "zerocopy" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + [[package]] name = "zeroize" version = "1.6.0" diff --git a/Cargo.toml b/Cargo.toml index 6f6996fd69..6e419762d5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -151,24 +151,24 @@ aws-sdk-dynamodb = "0.35.0" aws-types = "0.57.1" base64 = "0.21.5" bitflags = { version = "2.4.1", features = ["serde"] } -candid = "0.9.11" +candid = "0.10.2" ciborium = "0.2.1" clap = "4.4.8" -dfx-core = { git = "https://github.com/dfinity/sdk", rev = "5f256854b1bdf77f2c83bfb039d68f46b1f791eb" } +dfx-core = { git = "https://github.com/hpeebles/dfinity-sdk", rev = "d39dde0611fda8f30a6796b40b1dbb13a0541597" } dirs = "5.0.1" dotenv = "0.15.0" futures = "0.3.29" getrandom = { version = "0.2.11", features = ["custom"] } hex = "0.4.3" -ic-agent = "0.29.0" -ic-cdk = "0.11.3" -ic-cdk-macros = "0.7.0" -ic-cdk-timers = "0.5.1" -ic-ledger-types = "0.8.0" -ic-stable-structures = "0.6.0" -ic-transport-types = "0.29.0" -ic-utils = "0.29.0" -icrc-ledger-types = "0.1.4" +ic-agent = "0.32.0" +ic-cdk = "=0.12.0" +ic-cdk-macros = "0.8.4" +ic-cdk-timers = "0.6.0" +ic-ledger-types = "0.9.0" +ic-stable-structures = "0.6.2" +ic-transport-types = "0.32.0" +ic-utils = "0.32.0" +icrc-ledger-types = "0.1.5" ic0 = "0.21.1" itertools = "0.11.0" lazy_static = "1.4.0" @@ -212,5 +212,6 @@ codegen-units = 1 debug = false [patch.crates-io] -ic-cdk-macros = { git = "https://github.com/hpeebles/cdk-rs", rev = "cc49cf7e3e2f10a12182149b0964372a04c09f08" } -ic-stable-structures = { git = "https://github.com/hpeebles/stable-structures", rev = "937aac129d0eba11fc8aef719a1da20b269b83c6" } +ic-cdk-macros = { git = "https://github.com/hpeebles/cdk-rs", rev = "1833cb37ecfd6154cc9cc55b5de76329114e8c5f" } +ic-stable-structures = { git = "https://github.com/hpeebles/stable-structures", rev = "c90b987741a7454b10e306df55e2dde82d1694cf" } +pocket-ic = { git = "https://github.com/dfinity/ic", rev = "a7862784e8da4a97a1d608fd5b3db365de41a2d7" } \ No newline at end of file diff --git a/backend/bots/examples/satoshi_dice/impl/src/jobs/process_pending_actions.rs b/backend/bots/examples/satoshi_dice/impl/src/jobs/process_pending_actions.rs index 4518362f40..e2634cf9d2 100644 --- a/backend/bots/examples/satoshi_dice/impl/src/jobs/process_pending_actions.rs +++ b/backend/bots/examples/satoshi_dice/impl/src/jobs/process_pending_actions.rs @@ -88,7 +88,7 @@ async fn process_action(action: Action) { let args = TransferArg { from_subaccount: None, to: Account::from(Principal::from(user_id)), - fee: Some(10.into()), + fee: Some(10u32.into()), created_at_time: Some(now_nanos), memo: None, amount: amount.into(), diff --git a/backend/canister_upgrader/src/lib.rs b/backend/canister_upgrader/src/lib.rs index 9f49e31635..9301c18a62 100644 --- a/backend/canister_upgrader/src/lib.rs +++ b/backend/canister_upgrader/src/lib.rs @@ -508,7 +508,7 @@ async fn upgrade_wasm( println!("Upgrading wasm for canister {canister_id}"); match management_canister .install_code(canister_id, wasm_bytes) - .with_mode(InstallMode::Upgrade) + .with_mode(InstallMode::Upgrade { skip_pre_upgrade: false }) .with_arg(args) .call_and_wait() .await diff --git a/backend/canisters/market_maker/impl/Cargo.toml b/backend/canisters/market_maker/impl/Cargo.toml index 2fad6a8655..5c9a096890 100644 --- a/backend/canisters/market_maker/impl/Cargo.toml +++ b/backend/canisters/market_maker/impl/Cargo.toml @@ -22,7 +22,7 @@ http_request = { path = "../../../libraries/http_request" } ic-cdk = { workspace = true } ic-cdk-macros = { workspace = true } ic-cdk-timers = { workspace = true } -ic-stable-structures = { workspace = true, features = ["candid"] } +ic-stable-structures = { workspace = true } icdex_client = { path = "../../../libraries/icdex_client" } icrc_ledger_canister_c2c_client = { path = "../../../external_canisters/icrc_ledger/c2c_client" } icrc-ledger-types = { workspace = true } diff --git a/backend/canisters/neuron_controller/impl/src/updates/stake_nns_neuron.rs b/backend/canisters/neuron_controller/impl/src/updates/stake_nns_neuron.rs index 1449922fd2..ffada9b2a9 100644 --- a/backend/canisters/neuron_controller/impl/src/updates/stake_nns_neuron.rs +++ b/backend/canisters/neuron_controller/impl/src/updates/stake_nns_neuron.rs @@ -36,10 +36,10 @@ async fn stake_nns_neuron(_args: Args) -> Response { owner: nns_governance_canister_id, subaccount: Some(subaccount), }, - fee: Some(10_000.into()), + fee: Some(10_000u32.into()), created_at_time: None, memo: Some(nonce.into()), - amount: 100_000_000.into(), // 1 ICP + amount: 100_000_000u32.into(), // 1 ICP }, ) .await diff --git a/backend/canisters/notifications/api/src/notification_candid_gen.rs b/backend/canisters/notifications/api/src/notification_candid_gen.rs index db5312cc82..9bc58f3ad5 100644 --- a/backend/canisters/notifications/api/src/notification_candid_gen.rs +++ b/backend/canisters/notifications/api/src/notification_candid_gen.rs @@ -16,6 +16,6 @@ fn main() { crypto_transfer: None, }); let candid_type = candid::types::internal::get_type(&ignored); - let candid = candid::bindings::candid::pp_ty(&candid_type); + let candid = candid::pretty::candid::pp_ty(&candid_type); std::print!("type Notification = {}", candid.pretty(120)); } diff --git a/backend/canisters/online_users/impl/Cargo.toml b/backend/canisters/online_users/impl/Cargo.toml index 07025d2a90..b4039124c7 100644 --- a/backend/canisters/online_users/impl/Cargo.toml +++ b/backend/canisters/online_users/impl/Cargo.toml @@ -18,7 +18,7 @@ http_request = { path = "../../../libraries/http_request" } ic-cdk = { workspace = true } ic-cdk-macros = { workspace = true } ic-cdk-timers = { workspace = true } -ic-stable-structures = { workspace = true, features = ["candid"] } +ic-stable-structures = { workspace = true } rand = { workspace = true } serde = { workspace = true } serializer = { path = "../../../libraries/serializer" } diff --git a/backend/canisters/registry/impl/Cargo.toml b/backend/canisters/registry/impl/Cargo.toml index 38b11c81b3..811265b83e 100644 --- a/backend/canisters/registry/impl/Cargo.toml +++ b/backend/canisters/registry/impl/Cargo.toml @@ -21,7 +21,7 @@ human_readable = { path = "../../../libraries/human_readable" } ic-cdk = { workspace = true } ic-cdk-macros = { workspace = true } ic-cdk-timers = { workspace = true } -ic-stable-structures = { workspace = true, features = ["candid"] } +ic-stable-structures = { workspace = true } icrc_ledger_canister = { path = "../../../external_canisters/icrc_ledger/api" } icrc_ledger_canister_c2c_client = { path = "../../../external_canisters/icrc_ledger/c2c_client" } icrc-ledger-types = { workspace = true } diff --git a/backend/canisters/user_index/impl/src/model/reported_messages.rs b/backend/canisters/user_index/impl/src/model/reported_messages.rs index 4ff17963e6..ea94b5f525 100644 --- a/backend/canisters/user_index/impl/src/model/reported_messages.rs +++ b/backend/canisters/user_index/impl/src/model/reported_messages.rs @@ -326,13 +326,13 @@ mod tests { fn dummy_outcome() -> ContentResult { ContentResult { - approvedCount: 0.into(), - rejectedCount: 3.into(), + approvedCount: 0u32.into(), + rejectedCount: 3u32.into(), sourceId: "0".to_string(), status: ContentStatus::rejected, violatedRules: vec![modclub_canister::subscribe::ViolatedRules { id: "4bkt6-4aaaa-aaaaf-aaaiq-cai-rule-1".to_string(), - rejectionCount: 3.into(), + rejectionCount: 3u32.into(), }], } } diff --git a/backend/libraries/canister_agent_utils/src/lib.rs b/backend/libraries/canister_agent_utils/src/lib.rs index f3e924d57a..0cb3b8d007 100644 --- a/backend/libraries/canister_agent_utils/src/lib.rs +++ b/backend/libraries/canister_agent_utils/src/lib.rs @@ -1,5 +1,5 @@ use candid::{CandidType, Principal}; -use ic_agent::agent::http_transport::ReqwestHttpReplicaV2Transport; +use ic_agent::agent::http_transport::reqwest_transport::ReqwestHttpReplicaV2Transport; use ic_agent::{Agent, Identity}; use ic_utils::interfaces::ManagementCanister; use itertools::Itertools; diff --git a/backend/libraries/canister_api_macros/src/lib.rs b/backend/libraries/canister_api_macros/src/lib.rs index 6ce8e03fc7..b37092711b 100644 --- a/backend/libraries/canister_api_macros/src/lib.rs +++ b/backend/libraries/canister_api_macros/src/lib.rs @@ -71,12 +71,21 @@ fn canister_api_method(method_type: MethodType, attr: TokenStream, item: TokenSt let deserializer = quote! { deserializer = #deserializer_name }; let candid = if include_candid { - quote! { #[ic_cdk_macros::#method_type(name = #name, #guard #manual_reply)] } + quote! { + #[ic_cdk_macros::#method_type(name = #name, #guard #manual_reply)] + #item + } } else { quote! {} }; - let msgpack = - quote! { #[ic_cdk_macros::#method_type(name = #msgpack_name, #guard #manual_reply #serializer #deserializer)] }; + + let mut msgpack_item = item.clone(); + msgpack_item.sig.ident = Ident::new(&msgpack_name, Span::call_site()); + + let msgpack = quote! { + #[ic_cdk_macros::#method_type(name = #msgpack_name, #guard #manual_reply #serializer #deserializer)] + #msgpack_item + }; TokenStream::from(quote! { use msgpack::serialize_then_unwrap as #serializer_ident; @@ -84,7 +93,6 @@ fn canister_api_method(method_type: MethodType, attr: TokenStream, item: TokenSt #candid #msgpack - #item }) } diff --git a/backend/libraries/icdex_client/src/lib.rs b/backend/libraries/icdex_client/src/lib.rs index ebcc9a92b0..6d328989ea 100644 --- a/backend/libraries/icdex_client/src/lib.rs +++ b/backend/libraries/icdex_client/src/lib.rs @@ -111,7 +111,7 @@ impl ICDexClient { .map_err(|t| (RejectionCode::Unknown, format!("{t:?}")))?; let quantity = match order.order_type { - OrderType::Bid => OrderQuantity::Buy(order.amount.into(), 0.into()), + OrderType::Bid => OrderQuantity::Buy(order.amount.into(), 0u32.into()), OrderType::Ask => OrderQuantity::Sell(order.amount.into()), }; // Convert the price per whole into the price per `smallest_order_size` diff --git a/backend/libraries/sonic_client/src/lib.rs b/backend/libraries/sonic_client/src/lib.rs index a4cbbe587c..1284fc54d2 100644 --- a/backend/libraries/sonic_client/src/lib.rs +++ b/backend/libraries/sonic_client/src/lib.rs @@ -57,7 +57,7 @@ impl SonicClient { pub async fn swap(&self, amount: u128) -> CallResult { let args = ( Nat::from(amount), - Nat::from(0), + Nat::from(0u32), vec![self.input_token().ledger.to_string(), self.output_token().ledger.to_string()], self.this_canister_id, Int::from(u64::MAX), diff --git a/backend/notification_pusher/core/src/ic_agent.rs b/backend/notification_pusher/core/src/ic_agent.rs index 36a3a93345..909cc2b44a 100644 --- a/backend/notification_pusher/core/src/ic_agent.rs +++ b/backend/notification_pusher/core/src/ic_agent.rs @@ -1,4 +1,4 @@ -use ic_agent::agent::http_transport::ReqwestHttpReplicaV2Transport; +use ic_agent::agent::http_transport::reqwest_transport::ReqwestHttpReplicaV2Transport; use ic_agent::identity::BasicIdentity; use ic_agent::{Agent, Identity}; use notifications_canister::{latest_notification_index, notifications, remove_notifications}; diff --git a/scripts/run-integration-tests.sh b/scripts/run-integration-tests.sh index 43e7afa158..6267d9968b 100755 --- a/scripts/run-integration-tests.sh +++ b/scripts/run-integration-tests.sh @@ -29,7 +29,7 @@ fi cd backend/integration_tests echo "PocketIC download starting" -curl -sO https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/binaries/x86_64-$PLATFORM/pocket-ic.gz || exit 1 +curl -sO https://download.dfinity.systems/ic/a7862784e8da4a97a1d608fd5b3db365de41a2d7/binaries/x86_64-$PLATFORM/pocket-ic.gz || exit 1 gzip -df pocket-ic.gz chmod +x pocket-ic echo "PocketIC download completed" From 91d17317473e7be92fadcd17b2799db433688611 Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Fri, 26 Jan 2024 14:10:54 +0000 Subject: [PATCH 12/19] Remove patch which is no longer needed (#5272) --- Cargo.lock | 5 +++-- Cargo.toml | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f77d1ec096..ab21f2f475 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2969,8 +2969,9 @@ dependencies = [ [[package]] name = "ic-stable-structures" -version = "0.6.3" -source = "git+https://github.com/hpeebles/stable-structures?rev=c90b987741a7454b10e306df55e2dde82d1694cf#c90b987741a7454b10e306df55e2dde82d1694cf" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "774d7d26420c095f2b5f0f71f7b2ff4a5b58b87e0959dccc78b3d513a7db5112" dependencies = [ "ic_principal", ] diff --git a/Cargo.toml b/Cargo.toml index 6e419762d5..a5909547bc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -213,5 +213,4 @@ debug = false [patch.crates-io] ic-cdk-macros = { git = "https://github.com/hpeebles/cdk-rs", rev = "1833cb37ecfd6154cc9cc55b5de76329114e8c5f" } -ic-stable-structures = { git = "https://github.com/hpeebles/stable-structures", rev = "c90b987741a7454b10e306df55e2dde82d1694cf" } pocket-ic = { git = "https://github.com/dfinity/ic", rev = "a7862784e8da4a97a1d608fd5b3db365de41a2d7" } \ No newline at end of file From 25cdfd6aea80bb2022aae1f605f6da9fc4930af8 Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Fri, 26 Jan 2024 15:41:11 +0000 Subject: [PATCH 13/19] Implement `migrate_legacy_principal` (#5274) --- Cargo.lock | 18 +++ Cargo.toml | 1 + backend/canisters/identity/CHANGELOG.md | 1 + ...incipal.rs => migrate_legacy_principal.rs} | 12 +- .../canisters/identity/api/src/updates/mod.rs | 2 +- backend/canisters/identity/impl/Cargo.toml | 2 + backend/canisters/identity/impl/src/guards.rs | 8 -- backend/canisters/identity/impl/src/lib.rs | 42 +++++-- .../identity/impl/src/lifecycle/mod.rs | 16 +++ .../canisters/identity/impl/src/model/mod.rs | 1 + .../canisters/identity/impl/src/model/salt.rs | 22 ++++ .../impl/src/model/user_principals.rs | 10 +- ...k_principal.rs => check_auth_principal.rs} | 6 +- .../identity/impl/src/queries/mod.rs | 2 +- .../src/updates/migrate_legacy_principal.rs | 72 ++++++++++++ .../identity/impl/src/updates/mod.rs | 2 +- .../impl/src/updates/update_user_principal.rs | 25 ----- .../integration_tests/src/client/identity.rs | 25 ++++- .../src/client/local_user_index.rs | 3 +- .../integration_tests/src/identity_tests.rs | 67 ++++++++++- backend/integration_tests/src/lib.rs | 2 +- .../src/update_user_principal_tests.rs | 105 ------------------ changelog.md | 0 23 files changed, 279 insertions(+), 165 deletions(-) rename backend/canisters/identity/api/src/updates/{update_user_principal.rs => migrate_legacy_principal.rs} (61%) create mode 100644 backend/canisters/identity/impl/src/model/salt.rs rename backend/canisters/identity/impl/src/queries/{check_principal.rs => check_auth_principal.rs} (73%) create mode 100644 backend/canisters/identity/impl/src/updates/migrate_legacy_principal.rs delete mode 100644 backend/canisters/identity/impl/src/updates/update_user_principal.rs delete mode 100644 backend/integration_tests/src/update_user_principal_tests.rs create mode 100644 changelog.md diff --git a/Cargo.lock b/Cargo.lock index ab21f2f475..1e05b629c5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1012,6 +1012,22 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "canister_sig_util" +version = "0.1.0" +source = "git+https://github.com/dfinity/internet-identity?rev=f46da3bfefff638a844117606a4dea70b2dd4405#f46da3bfefff638a844117606a4dea70b2dd4405" +dependencies = [ + "candid", + "hex", + "ic-cdk", + "ic-certification", + "lazy_static", + "serde", + "serde_bytes", + "serde_cbor", + "sha2 0.10.8", +] + [[package]] name = "canister_state_macros" version = "0.1.0" @@ -3251,6 +3267,7 @@ dependencies = [ "candid", "canister_api_macros", "canister_logger", + "canister_sig_util", "canister_state_macros", "canister_tracing_macros", "http_request", @@ -3262,6 +3279,7 @@ dependencies = [ "rand", "serde", "serializer", + "sha256", "stable_memory", "tracing", "types", diff --git a/Cargo.toml b/Cargo.toml index a5909547bc..ea3e11a865 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -152,6 +152,7 @@ aws-types = "0.57.1" base64 = "0.21.5" bitflags = { version = "2.4.1", features = ["serde"] } candid = "0.10.2" +canister_sig_util = { git = "https://github.com/dfinity/internet-identity", rev = "f46da3bfefff638a844117606a4dea70b2dd4405" } ciborium = "0.2.1" clap = "4.4.8" dfx-core = { git = "https://github.com/hpeebles/dfinity-sdk", rev = "d39dde0611fda8f30a6796b40b1dbb13a0541597" } diff --git a/backend/canisters/identity/CHANGELOG.md b/backend/canisters/identity/CHANGELOG.md index 1a92155768..65437e80b0 100644 --- a/backend/canisters/identity/CHANGELOG.md +++ b/backend/canisters/identity/CHANGELOG.md @@ -9,3 +9,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Implement ability to update user principals ([#5220](https://github.com/open-chat-labs/open-chat/pull/5220)) - Sync user principals from the UserIndex canister ([#5264](https://github.com/open-chat-labs/open-chat/pull/5264)) +- Implement `migrate_legacy_principal` ([#5274](https://github.com/open-chat-labs/open-chat/pull/5274)) diff --git a/backend/canisters/identity/api/src/updates/update_user_principal.rs b/backend/canisters/identity/api/src/updates/migrate_legacy_principal.rs similarity index 61% rename from backend/canisters/identity/api/src/updates/update_user_principal.rs rename to backend/canisters/identity/api/src/updates/migrate_legacy_principal.rs index dfe93e49fd..0e905500de 100644 --- a/backend/canisters/identity/api/src/updates/update_user_principal.rs +++ b/backend/canisters/identity/api/src/updates/migrate_legacy_principal.rs @@ -3,12 +3,18 @@ use serde::{Deserialize, Serialize}; #[derive(CandidType, Serialize, Deserialize, Debug)] pub struct Args { - pub old_principal: Principal, - pub new_principal: Principal, + pub public_key: Vec, } #[derive(CandidType, Serialize, Deserialize, Debug)] pub enum Response { - Success, + Success(SuccessResult), + AlreadyMigrated, + NotFound, InternalError(String), } + +#[derive(CandidType, Serialize, Deserialize, Debug)] +pub struct SuccessResult { + pub new_principal: Principal, +} diff --git a/backend/canisters/identity/api/src/updates/mod.rs b/backend/canisters/identity/api/src/updates/mod.rs index 06fb45e737..748ee687f1 100644 --- a/backend/canisters/identity/api/src/updates/mod.rs +++ b/backend/canisters/identity/api/src/updates/mod.rs @@ -1,2 +1,2 @@ pub mod c2c_sync_legacy_user_principals; -pub mod update_user_principal; +pub mod migrate_legacy_principal; diff --git a/backend/canisters/identity/impl/Cargo.toml b/backend/canisters/identity/impl/Cargo.toml index 646fdf71c4..d5b0e73922 100644 --- a/backend/canisters/identity/impl/Cargo.toml +++ b/backend/canisters/identity/impl/Cargo.toml @@ -13,6 +13,7 @@ crate-type = ["cdylib"] candid = { workspace = true } canister_api_macros = { path = "../../../libraries/canister_api_macros" } canister_logger = { path = "../../../libraries/canister_logger" } +canister_sig_util = { workspace = true } canister_state_macros = { path = "../../../libraries/canister_state_macros" } canister_tracing_macros = { path = "../../../libraries/canister_tracing_macros" } http_request = { path = "../../../libraries/http_request" } @@ -24,6 +25,7 @@ identity_canister = { path = "../api" } rand = { workspace = true } serde = { workspace = true } serializer = { path = "../../../libraries/serializer" } +sha256 = { path = "../../../libraries/sha256" } stable_memory = { path = "../../../libraries/stable_memory" } tracing = { workspace = true } types = { path = "../../../libraries/types" } diff --git a/backend/canisters/identity/impl/src/guards.rs b/backend/canisters/identity/impl/src/guards.rs index e20cc3210f..b0ca3eacb8 100644 --- a/backend/canisters/identity/impl/src/guards.rs +++ b/backend/canisters/identity/impl/src/guards.rs @@ -7,11 +7,3 @@ pub fn caller_is_user_index_canister() -> Result<(), String> { Err("Caller is not the user_index canister".to_owned()) } } - -pub fn caller_is_governance_principal() -> Result<(), String> { - if read_state(|state| state.is_caller_governance_principal()) { - Ok(()) - } else { - Err("Caller is not a governance principal".to_owned()) - } -} diff --git a/backend/canisters/identity/impl/src/lib.rs b/backend/canisters/identity/impl/src/lib.rs index 886ea1f752..4758473fb3 100644 --- a/backend/canisters/identity/impl/src/lib.rs +++ b/backend/canisters/identity/impl/src/lib.rs @@ -1,7 +1,10 @@ +use crate::model::salt::Salt; use crate::model::user_principals::UserPrincipals; use candid::Principal; +use canister_sig_util::CanisterSigPublicKey; use canister_state_macros::canister_state; use serde::{Deserialize, Serialize}; +use sha256::sha256; use std::cell::RefCell; use std::collections::HashSet; use types::{BuildVersion, CanisterId, Cycles, TimestampMillis, Timestamped}; @@ -35,9 +38,12 @@ impl RuntimeState { self.data.user_index_canister_id == caller } - pub fn is_caller_governance_principal(&self) -> bool { - let caller = self.env.caller(); - self.data.governance_principals.contains(&caller) + pub fn get_principal(&self, index: u32) -> Principal { + let canister_id = self.env.canister_id(); + let salt = self.data.salt.get(); + let seed = calculate_seed(index, salt); + let public_key = CanisterSigPublicKey::new(canister_id, seed.to_vec()).to_der(); + Principal::self_authenticating(public_key) } pub fn metrics(&self) -> Metrics { @@ -57,13 +63,15 @@ impl RuntimeState { #[derive(Serialize, Deserialize)] struct Data { - pub governance_principals: HashSet, - pub user_index_canister_id: CanisterId, - pub cycles_dispenser_canister_id: CanisterId, - pub user_principals: UserPrincipals, - pub legacy_principals: HashSet, - pub rng_seed: [u8; 32], - pub test_mode: bool, + governance_principals: HashSet, + user_index_canister_id: CanisterId, + cycles_dispenser_canister_id: CanisterId, + user_principals: UserPrincipals, + legacy_principals: HashSet, + #[serde(default)] + salt: Salt, + rng_seed: [u8; 32], + test_mode: bool, } impl Data { @@ -79,12 +87,26 @@ impl Data { cycles_dispenser_canister_id, user_principals: UserPrincipals::default(), legacy_principals: HashSet::default(), + salt: Salt::default(), rng_seed: [0; 32], test_mode, } } } +fn calculate_seed(index: u32, salt: [u8; 32]) -> [u8; 32] { + let mut bytes: Vec = vec![]; + bytes.push(salt.len() as u8); + bytes.extend_from_slice(&salt); + + let index_str = index.to_string(); + let index_bytes = index_str.bytes(); + bytes.push(index_bytes.len() as u8); + bytes.extend(index_bytes); + + sha256(&bytes) +} + #[derive(Serialize, Debug)] pub struct Metrics { pub now: TimestampMillis, diff --git a/backend/canisters/identity/impl/src/lifecycle/mod.rs b/backend/canisters/identity/impl/src/lifecycle/mod.rs index aaf9b1d99f..164f80a230 100644 --- a/backend/canisters/identity/impl/src/lifecycle/mod.rs +++ b/backend/canisters/identity/impl/src/lifecycle/mod.rs @@ -18,6 +18,10 @@ fn init_env(rng_seed: [u8; 32]) -> Box { } fn init_state(env: Box, data: Data, wasm_version: BuildVersion) { + if !data.salt.is_initialized() { + ic_cdk_timers::set_timer(Duration::ZERO, generate_salt); + } + let now = env.now(); let state = RuntimeState::new(env, data); @@ -25,6 +29,18 @@ fn init_state(env: Box, data: Data, wasm_version: BuildVersion) WASM_VERSION.set(Timestamped::new(wasm_version, now)); } +fn generate_salt() { + ic_cdk::spawn(generate_salt_inner()); + + async fn generate_salt_inner() { + let seed = get_random_seed().await; + mutate_state(|state| { + state.data.salt.set(seed); + }); + trace!("Successfully generated salt"); + } +} + fn reseed_rng() { ic_cdk::spawn(reseed_rng_inner()); diff --git a/backend/canisters/identity/impl/src/model/mod.rs b/backend/canisters/identity/impl/src/model/mod.rs index e40db65223..eb46bd847e 100644 --- a/backend/canisters/identity/impl/src/model/mod.rs +++ b/backend/canisters/identity/impl/src/model/mod.rs @@ -1 +1,2 @@ +pub mod salt; pub mod user_principals; diff --git a/backend/canisters/identity/impl/src/model/salt.rs b/backend/canisters/identity/impl/src/model/salt.rs new file mode 100644 index 0000000000..129b08e553 --- /dev/null +++ b/backend/canisters/identity/impl/src/model/salt.rs @@ -0,0 +1,22 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Serialize, Deserialize, Default)] +pub struct Salt { + salt: [u8; 32], +} + +impl Salt { + pub fn get(&self) -> [u8; 32] { + assert!(self.is_initialized()); + self.salt + } + + pub fn set(&mut self, salt: [u8; 32]) { + assert!(!self.is_initialized()); + self.salt = salt; + } + + pub fn is_initialized(&self) -> bool { + self.salt != [0; 32] + } +} diff --git a/backend/canisters/identity/impl/src/model/user_principals.rs b/backend/canisters/identity/impl/src/model/user_principals.rs index ecfc1168fd..e2370feb58 100644 --- a/backend/canisters/identity/impl/src/model/user_principals.rs +++ b/backend/canisters/identity/impl/src/model/user_principals.rs @@ -1,7 +1,6 @@ use candid::Principal; use serde::{Deserialize, Serialize}; use std::collections::HashMap; -use std::ops::Index; #[derive(Serialize, Deserialize, Default)] pub struct UserPrincipals { @@ -17,9 +16,8 @@ pub struct UserPrincipal { } impl UserPrincipals { - #[allow(dead_code)] pub fn push(&mut self, index: u32, principal: Principal, auth_principal: Principal) { - assert_eq!(self.user_principals.len(), index as usize); + assert_eq!(self.user_principals.len() as u32, index); assert!(!self.auth_principal_to_index.contains_key(&auth_principal)); self.user_principals.push(UserPrincipal { @@ -30,9 +28,13 @@ impl UserPrincipals { self.auth_principal_to_index.insert(auth_principal, index); } + pub fn next_index(&self) -> u32 { + self.user_principals.len() as u32 + } + pub fn get_by_auth_principal(&self, auth_principal: &Principal) -> Option<&UserPrincipal> { self.auth_principal_to_index .get(auth_principal) - .map(|id| self.user_principals.index(*id as usize)) + .and_then(|id| self.user_principals.get(*id as usize)) } } diff --git a/backend/canisters/identity/impl/src/queries/check_principal.rs b/backend/canisters/identity/impl/src/queries/check_auth_principal.rs similarity index 73% rename from backend/canisters/identity/impl/src/queries/check_principal.rs rename to backend/canisters/identity/impl/src/queries/check_auth_principal.rs index b92c82c563..7cb0ac2d49 100644 --- a/backend/canisters/identity/impl/src/queries/check_principal.rs +++ b/backend/canisters/identity/impl/src/queries/check_auth_principal.rs @@ -10,10 +10,10 @@ fn check_auth_principal() -> Response { fn check_auth_principal_impl(state: &RuntimeState) -> Response { let caller = state.env.caller(); - if state.data.user_principals.get_by_auth_principal(&caller).is_some() { - Success - } else if state.data.legacy_principals.contains(&caller) { + if state.data.legacy_principals.contains(&caller) { Legacy + } else if state.data.user_principals.get_by_auth_principal(&caller).is_some() { + Success } else { NotFound } diff --git a/backend/canisters/identity/impl/src/queries/mod.rs b/backend/canisters/identity/impl/src/queries/mod.rs index 1b7f5e66a9..dfb2d63925 100644 --- a/backend/canisters/identity/impl/src/queries/mod.rs +++ b/backend/canisters/identity/impl/src/queries/mod.rs @@ -1,2 +1,2 @@ -mod check_principal; +mod check_auth_principal; mod http_request; diff --git a/backend/canisters/identity/impl/src/updates/migrate_legacy_principal.rs b/backend/canisters/identity/impl/src/updates/migrate_legacy_principal.rs new file mode 100644 index 0000000000..2b69b3636b --- /dev/null +++ b/backend/canisters/identity/impl/src/updates/migrate_legacy_principal.rs @@ -0,0 +1,72 @@ +use crate::{mutate_state, RuntimeState}; +use candid::Principal; +use canister_tracing_macros::trace; +use ic_cdk_macros::update; +use identity_canister::migrate_legacy_principal::{Response::*, *}; +use types::CanisterId; + +#[update] +#[trace] +async fn migrate_legacy_principal(args: Args) -> Response { + let PrepareResult { + caller, + new_principal, + user_index_canister_id, + } = match mutate_state(|state| prepare(args, state)) { + Ok(ok) => ok, + Err(response) => return response, + }; + + match user_index_canister_c2c_client::c2c_update_user_principal( + user_index_canister_id, + &user_index_canister::c2c_update_user_principal::Args { + old_principal: caller, + new_principal, + }, + ) + .await + { + Ok(_) => { + mutate_state(|state| state.data.legacy_principals.remove(&caller)); + Success(SuccessResult { new_principal }) + } + Err(error) => InternalError(format!("{error:?}")), + } +} + +struct PrepareResult { + caller: Principal, + new_principal: Principal, + user_index_canister_id: CanisterId, +} + +fn prepare(args: Args, state: &mut RuntimeState) -> Result { + let caller = state.env.caller(); + validate_public_key(caller, &args.public_key); + + if state.data.legacy_principals.contains(&caller) { + let new_principal = if let Some(user) = state.data.user_principals.get_by_auth_principal(&caller) { + user.principal + } else { + let index = state.data.user_principals.next_index(); + let principal = state.get_principal(index); + state.data.user_principals.push(index, principal, caller); + principal + }; + + Ok(PrepareResult { + caller, + new_principal, + user_index_canister_id: state.data.user_index_canister_id, + }) + } else if state.data.user_principals.get_by_auth_principal(&caller).is_some() { + Err(AlreadyMigrated) + } else { + Err(NotFound) + } +} + +fn validate_public_key(caller: Principal, public_key: &[u8]) { + let expected_caller = Principal::self_authenticating(public_key); + assert_eq!(caller, expected_caller); +} diff --git a/backend/canisters/identity/impl/src/updates/mod.rs b/backend/canisters/identity/impl/src/updates/mod.rs index 4c28921801..785939c287 100644 --- a/backend/canisters/identity/impl/src/updates/mod.rs +++ b/backend/canisters/identity/impl/src/updates/mod.rs @@ -1,2 +1,2 @@ mod c2c_sync_legacy_user_principals; -mod update_user_principal; +mod migrate_legacy_principal; diff --git a/backend/canisters/identity/impl/src/updates/update_user_principal.rs b/backend/canisters/identity/impl/src/updates/update_user_principal.rs deleted file mode 100644 index 0b9a7dd8fd..0000000000 --- a/backend/canisters/identity/impl/src/updates/update_user_principal.rs +++ /dev/null @@ -1,25 +0,0 @@ -use crate::guards::caller_is_governance_principal; -use crate::read_state; -use canister_tracing_macros::trace; -use ic_cdk_macros::update; -use identity_canister::update_user_principal::{Response::*, *}; - -#[update(guard = "caller_is_governance_principal")] -#[trace] -async fn update_user_principal(args: Args) -> Response { - let user_index_canister_id = read_state(|state| state.data.user_index_canister_id); - - match user_index_canister_c2c_client::c2c_update_user_principal( - user_index_canister_id, - &user_index_canister::c2c_update_user_principal::Args { - old_principal: args.old_principal, - new_principal: args.new_principal, - }, - ) - .await - { - Ok(user_index_canister::c2c_update_user_principal::Response::Success) => Success, - Ok(user_index_canister::c2c_update_user_principal::Response::InternalError(error)) => InternalError(error), - Err(error) => InternalError(format!("{error:?}")), - } -} diff --git a/backend/integration_tests/src/client/identity.rs b/backend/integration_tests/src/client/identity.rs index 38a42a928b..05df549f55 100644 --- a/backend/integration_tests/src/client/identity.rs +++ b/backend/integration_tests/src/client/identity.rs @@ -5,4 +5,27 @@ use identity_canister::*; generate_query_call!(check_auth_principal); // Updates -generate_update_call!(update_user_principal); +generate_update_call!(migrate_legacy_principal); + +pub mod happy_path { + use crate::User; + use candid::Principal; + use pocket_ic::PocketIc; + use types::CanisterId; + + pub fn migrate_legacy_principal(env: &mut PocketIc, user: &User, identity_canister_id: CanisterId) -> Principal { + let response = super::migrate_legacy_principal( + env, + user.principal, + identity_canister_id, + &identity_canister::migrate_legacy_principal::Args { + public_key: user.public_key.clone(), + }, + ); + + match response { + identity_canister::migrate_legacy_principal::Response::Success(result) => result.new_principal, + response => panic!("'migrate_legacy_principal' error: {response:?}"), + } + } +} diff --git a/backend/integration_tests/src/client/local_user_index.rs b/backend/integration_tests/src/client/local_user_index.rs index e21b4dc75d..31a73b2760 100644 --- a/backend/integration_tests/src/client/local_user_index.rs +++ b/backend/integration_tests/src/client/local_user_index.rs @@ -37,7 +37,7 @@ pub mod happy_path { &local_user_index_canister::register_user::Args { username: principal_to_username(principal), referral_code, - public_key, + public_key: public_key.clone(), }, ); @@ -47,6 +47,7 @@ pub mod happy_path { local_user_index_canister::register_user::Response::Success(res) => User { principal, user_id: res.user_id, + public_key, }, response => panic!("'register_user' error: {response:?}"), } diff --git a/backend/integration_tests/src/identity_tests.rs b/backend/integration_tests/src/identity_tests.rs index 2b6c89f460..7b8759f704 100644 --- a/backend/integration_tests/src/identity_tests.rs +++ b/backend/integration_tests/src/identity_tests.rs @@ -1,5 +1,6 @@ use crate::env::ENV; -use crate::rng::random_principal; +use crate::rng::{random_principal, random_string}; +use crate::utils::tick_many; use crate::{client, TestEnv}; use std::ops::Deref; use types::Empty; @@ -23,6 +24,70 @@ fn new_users_synced_to_identity_canister() { } } +#[test] +fn migrate_principal_updates_principal_in_all_canisters() { + let mut wrapper = ENV.deref().get(); + let TestEnv { + env, + canister_ids, + controller, + .. + } = wrapper.env(); + + let mut user = client::register_diamond_user(env, canister_ids, *controller); + + let group_id = client::user::happy_path::create_group(env, &user, &random_string(), false, true); + let community_id = client::user::happy_path::create_community(env, &user, &random_string(), false, vec![random_string()]); + + client::notifications_index::happy_path::push_subscription( + env, + user.principal, + canister_ids.notifications_index, + "auth", + "p256dh", + "endpoint", + ); + let file_bytes = random_string().into_bytes(); + let allocated_bucket_response = + client::storage_index::happy_path::allocated_bucket(env, user.principal, canister_ids.storage_index, &file_bytes); + + client::storage_bucket::happy_path::upload_file( + env, + user.principal, + allocated_bucket_response.canister_id, + allocated_bucket_response.file_id, + file_bytes, + None, + ); + + let new_principal = client::identity::happy_path::migrate_legacy_principal(env, &user, canister_ids.identity); + + user.principal = new_principal; + + tick_many(env, 5); + + client::user_index::happy_path::current_user(env, user.principal, canister_ids.user_index); + client::user::happy_path::initial_state(env, &user); + client::group::happy_path::summary(env, &user, group_id); + client::community::happy_path::summary(env, &user, community_id); + client::notifications_index::happy_path::subscription_exists( + env, + new_principal, + canister_ids.notifications_index, + "p256dh", + ); + client::storage_index::happy_path::user(env, new_principal, canister_ids.storage_index); + assert!( + client::storage_bucket::happy_path::file_info( + env, + new_principal, + allocated_bucket_response.canister_id, + allocated_bucket_response.file_id + ) + .is_owner + ); +} + #[test] fn unknown_principal_returns_not_found() { let mut wrapper = ENV.deref().get(); diff --git a/backend/integration_tests/src/lib.rs b/backend/integration_tests/src/lib.rs index 597434f4d3..63ee965a67 100644 --- a/backend/integration_tests/src/lib.rs +++ b/backend/integration_tests/src/lib.rs @@ -43,7 +43,6 @@ mod suspend_user_tests; mod tip_message_tests; mod update_group_tests; mod update_profile_tests; -mod update_user_principal_tests; mod utils; mod wasms; @@ -57,6 +56,7 @@ pub struct TestEnv { pub struct User { pub principal: Principal, pub user_id: UserId, + pub public_key: Vec, } impl User { diff --git a/backend/integration_tests/src/update_user_principal_tests.rs b/backend/integration_tests/src/update_user_principal_tests.rs deleted file mode 100644 index 18543cbd25..0000000000 --- a/backend/integration_tests/src/update_user_principal_tests.rs +++ /dev/null @@ -1,105 +0,0 @@ -use crate::env::ENV; -use crate::rng::{random_string, random_user_principal}; -use crate::utils::tick_many; -use crate::{client, CanisterIds, TestEnv, User}; -use candid::Principal; -use pocket_ic::PocketIc; -use std::ops::Deref; -use types::{ChatId, CommunityId}; - -#[test] -fn principal_update_propagates_to_all_relevant_canisters() { - let mut wrapper = ENV.deref().get(); - let TestEnv { - env, - canister_ids, - controller, - .. - } = wrapper.env(); - - let TestData { - mut user, - group_id, - community_id, - } = init_test_data(env, canister_ids, *controller); - - let file_bytes = random_string().into_bytes(); - let allocated_bucket_response = - client::storage_index::happy_path::allocated_bucket(env, user.principal, canister_ids.storage_index, &file_bytes); - - client::storage_bucket::happy_path::upload_file( - env, - user.principal, - allocated_bucket_response.canister_id, - allocated_bucket_response.file_id, - file_bytes, - None, - ); - - let (new_principal, _) = random_user_principal(); - - client::identity::update_user_principal( - env, - *controller, - canister_ids.identity, - &identity_canister::update_user_principal::Args { - old_principal: user.principal, - new_principal, - }, - ); - - user.principal = new_principal; - - tick_many(env, 5); - - client::user_index::happy_path::current_user(env, user.principal, canister_ids.user_index); - client::user::happy_path::initial_state(env, &user); - client::group::happy_path::summary(env, &user, group_id); - client::community::happy_path::summary(env, &user, community_id); - client::notifications_index::happy_path::subscription_exists( - env, - new_principal, - canister_ids.notifications_index, - "p256dh", - ); - client::storage_index::happy_path::user(env, new_principal, canister_ids.storage_index); - assert!( - client::storage_bucket::happy_path::file_info( - env, - new_principal, - allocated_bucket_response.canister_id, - allocated_bucket_response.file_id - ) - .is_owner - ); -} - -fn init_test_data(env: &mut PocketIc, canister_ids: &CanisterIds, controller: Principal) -> TestData { - let user = client::register_diamond_user(env, canister_ids, controller); - - let group_id = client::user::happy_path::create_group(env, &user, &random_string(), false, true); - let community_id = client::user::happy_path::create_community(env, &user, &random_string(), false, vec![random_string()]); - - client::notifications_index::happy_path::push_subscription( - env, - user.principal, - canister_ids.notifications_index, - "auth", - "p256dh", - "endpoint", - ); - - env.tick(); - - TestData { - user, - group_id, - community_id, - } -} - -struct TestData { - user: User, - group_id: ChatId, - community_id: CommunityId, -} diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000000..e69de29bb2 From 01ac43d252254d4dc99f8528e99102d886822a18 Mon Sep 17 00:00:00 2001 From: Matt Grogan Date: Fri, 26 Jan 2024 15:48:37 +0000 Subject: [PATCH 14/19] Improve layout of p2pSwap messages (#5273) --- .../src/components/home/ChatMessage.svelte | 8 +++---- .../src/components/home/P2PSwapContent.svelte | 9 ++++---- .../src/components/icons/SpinningToken.svelte | 22 ++++++++++++++----- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/frontend/app/src/components/home/ChatMessage.svelte b/frontend/app/src/components/home/ChatMessage.svelte index 57a0f40aa6..b453e1e567 100644 --- a/frontend/app/src/components/home/ChatMessage.svelte +++ b/frontend/app/src/components/home/ChatMessage.svelte @@ -133,7 +133,7 @@ $: msgUrl = `${routeForMessage($chatListScope.kind, { chatId }, msg.messageIndex)}?open=true`; $: isProposal = msg.content.kind === "proposal_content"; $: isPrize = msg.content.kind === "prize_content"; - $: isPrizeWinner = msg.content.kind === "prize_winner_content"; + $: isP2PSwap = msg.content.kind === "p2p_swap_content"; $: isMemeFighter = msg.content.kind === "meme_fighter_content"; $: inert = msg.content.kind === "deleted_content" || @@ -481,7 +481,7 @@ class:readByMe class:crypto class:failed - class:prizeWinner={isPrizeWinner} + class:p2pSwap={isP2PSwap} class:proposal={isProposal && !inert} class:thread={inThread} class:rtl={$rtlStore}> @@ -939,8 +939,8 @@ background-color: var(--error); } - &.prizeWinner { - // background-color: var(--prize); + &.p2pSwap { + width: 350px; } } diff --git a/frontend/app/src/components/home/P2PSwapContent.svelte b/frontend/app/src/components/home/P2PSwapContent.svelte index 3daf2ac472..4fd41e8cf3 100644 --- a/frontend/app/src/components/home/P2PSwapContent.svelte +++ b/frontend/app/src/components/home/P2PSwapContent.svelte @@ -208,14 +208,14 @@ {/if}
- +
{fromAmount} {content.token0.symbol}
- +
{toAmount} {content.token1.symbol}
@@ -309,19 +309,19 @@ display: flex; flex-direction: row; justify-content: space-between; - align-items: center; margin-top: $sp3; width: 100%; } .amount { @include font(bold, normal, fs-80); + text-align: center; } .swap-icon { height: 2.5em; position: relative; - top: -10px; + top: calc(2.5rem - 12px); } .coin { @@ -329,5 +329,6 @@ flex-direction: column; gap: $sp2; align-items: center; + flex: 1; } diff --git a/frontend/app/src/components/icons/SpinningToken.svelte b/frontend/app/src/components/icons/SpinningToken.svelte index 257b2b8e27..080ce97289 100644 --- a/frontend/app/src/components/icons/SpinningToken.svelte +++ b/frontend/app/src/components/icons/SpinningToken.svelte @@ -1,16 +1,28 @@ -
+
From d948c0b464776fe4d00b3199928cd74bd275380e Mon Sep 17 00:00:00 2001 From: Matt Grogan Date: Fri, 26 Jan 2024 17:24:23 +0000 Subject: [PATCH 15/19] Fix p2p swap builder (#5275) --- frontend/app/src/components/home/P2PSwapContentBuilder.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/app/src/components/home/P2PSwapContentBuilder.svelte b/frontend/app/src/components/home/P2PSwapContentBuilder.svelte index 39d9a6edff..62022c847d 100644 --- a/frontend/app/src/components/home/P2PSwapContentBuilder.svelte +++ b/frontend/app/src/components/home/P2PSwapContentBuilder.svelte @@ -184,7 +184,7 @@
From e03bb5c420147ed08fc050d747fbda0dd438f620 Mon Sep 17 00:00:00 2001 From: Matt Grogan Date: Fri, 26 Jan 2024 17:44:23 +0000 Subject: [PATCH 16/19] Stop UI breaking (#5276) --- frontend/app/src/components/home/TokenInput.svelte | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/frontend/app/src/components/home/TokenInput.svelte b/frontend/app/src/components/home/TokenInput.svelte index e5984ad183..2db612115a 100644 --- a/frontend/app/src/components/home/TokenInput.svelte +++ b/frontend/app/src/components/home/TokenInput.svelte @@ -23,8 +23,8 @@ $: cryptoLookup = client.cryptoLookup; $: tokenDetails = $cryptoLookup[ledger]; - $: symbol = tokenDetails.symbol; - $: tokenDecimals = tokenDetails.decimals; + $: symbol = tokenDetails?.symbol; + $: tokenDecimals = tokenDetails?.decimals; onMount(() => { if (amount > BigInt(0)) { @@ -79,11 +79,11 @@
-{#if maxAmount !== undefined} -
- -
-{/if} + {#if maxAmount !== undefined} +
+ +
+ {/if}
{#if transferFees !== undefined} From 4430548233672bf22d5e6881fa2413ca0cfdad88 Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Fri, 26 Jan 2024 19:35:31 +0000 Subject: [PATCH 17/19] Deploy test ledger when setting up environment locally (#5278) --- dfx.json | 6 ++++++ scripts/deploy-local.sh | 2 ++ scripts/deploy-test-ledger.sh | 37 +++++++++++++++++++++++++++++++++++ scripts/mint-test-tokens.sh | 12 ++++++++++++ 4 files changed, 57 insertions(+) create mode 100755 scripts/deploy-test-ledger.sh create mode 100755 scripts/mint-test-tokens.sh diff --git a/dfx.json b/dfx.json index 28f7ea0324..73b1fedf44 100644 --- a/dfx.json +++ b/dfx.json @@ -151,6 +151,12 @@ "candid": "sns/candid/sns_swap.did", "type": "custom", "wasm": "" + }, + "test_ledger": { + "build": "", + "candid": "", + "type": "custom", + "wasm": "./wasms/icrc_ledger.wasm.gz" } }, "networks": { diff --git a/scripts/deploy-local.sh b/scripts/deploy-local.sh index 939156e14f..f5c43fdc97 100755 --- a/scripts/deploy-local.sh +++ b/scripts/deploy-local.sh @@ -52,3 +52,5 @@ dfx --identity $IDENTITY canister create --no-wallet --with-cycles 1000000000000 $NNS_SNS_WASM_CANISTER_ID \ $NNS_INDEX_CANISTER_ID \ true \ + +./scripts/deploy-test-ledger.sh $IDENTITY diff --git a/scripts/deploy-test-ledger.sh b/scripts/deploy-test-ledger.sh new file mode 100755 index 0000000000..cb8cfe6499 --- /dev/null +++ b/scripts/deploy-test-ledger.sh @@ -0,0 +1,37 @@ +IDENTITY=${1:-default} + +SCRIPT=$(readlink -f "$0") +SCRIPT_DIR=$(dirname "$SCRIPT") +cd $SCRIPT_DIR/.. + +PRINCIPAL=$(dfx --identity $IDENTITY identity get-principal) + +./scripts/download-nns-canister-wasm.sh icrc_ledger ic-icrc1-ledger +dfx --identity $IDENTITY canister create --no-wallet --with-cycles 100000000000000 test_ledger +dfx --identity $IDENTITY canister install test_ledger --wasm ./wasms/icrc_ledger.wasm.gz --argument "(variant { Init = record { + minting_account = record { owner = principal \"$PRINCIPAL\" }; + transfer_fee = 10000:nat64; + decimals = 8:nat8; + token_symbol = \"TEST\"; + token_name = \"Test\"; + metadata = vec { }; + initial_balances = vec {}; + archive_options = record { + num_blocks_to_archive = 1000:nat64; + trigger_threshold = 1000:nat64; + controller_id = principal \"$PRINCIPAL\"; + }; +}})" + +LEDGER_CANISTER_ID=$(dfx canister id test_ledger) + +dfx --identity $IDENTITY canister call registry add_token "(record { + ledger_canister_id = principal \"$LEDGER_CANISTER_ID\"; + token_standard = variant { icrc1 }; + info_url = \"https://dashboard.internetcomputer.org/sns/3e3x2-xyaaa-aaaaq-aaalq-cai\"; + how_to_buy_url = \"https://dashboard.internetcomputer.org/sns/3e3x2-xyaaa-aaaaq-aaalq-cai\"; + transaction_url_format = \"https://dashboard.internetcomputer.org/sns/3e3x2-xyaaa-aaaaq-aaalq-cai/transactions/{transaction_index}\"; + logo = \"data:image/png;base64,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\" +})" + +./scripts/mint-test-tokens.sh "dfdal-2uaaa-aaaaa-qaama-cai" $IDENTITY diff --git a/scripts/mint-test-tokens.sh b/scripts/mint-test-tokens.sh new file mode 100755 index 0000000000..0fe1c39c65 --- /dev/null +++ b/scripts/mint-test-tokens.sh @@ -0,0 +1,12 @@ +RECIPIENT=$1 +IDENTITY=${2:-default} +AMOUNT=${3:-100000000000} + +SCRIPT=$(readlink -f "$0") +SCRIPT_DIR=$(dirname "$SCRIPT") +cd $SCRIPT_DIR/.. + +dfx --identity $IDENTITY canister call test_ledger icrc1_transfer "(record { + to = record { owner = principal \"$RECIPIENT\" }; + amount = $AMOUNT:nat; +})" \ No newline at end of file From abe1b9693619d160ed8d3dbed9d85ce4bf9df464 Mon Sep 17 00:00:00 2001 From: Matt Grogan Date: Fri, 26 Jan 2024 21:18:51 +0000 Subject: [PATCH 18/19] Fix p2pSwap permissions (#5279) --- .../src/components/home/GroupPermissionsEditor.svelte | 10 ++++++++++ frontend/app/src/components/home/Home.svelte | 5 ++++- frontend/app/src/i18n/cn.json | 6 ++++-- frontend/app/src/i18n/de.json | 6 ++++-- frontend/app/src/i18n/en.json | 6 ++++-- frontend/app/src/i18n/es.json | 6 ++++-- frontend/app/src/i18n/fr.json | 6 ++++-- frontend/app/src/i18n/hi.json | 6 ++++-- frontend/app/src/i18n/it.json | 6 ++++-- frontend/app/src/i18n/iw.json | 6 ++++-- frontend/app/src/i18n/jp.json | 6 ++++-- frontend/app/src/i18n/ru.json | 6 ++++-- frontend/app/src/i18n/vi.json | 6 ++++-- .../openchat-agent/src/services/common/chatMappers.ts | 1 + frontend/openchat-client/src/utils/chat.ts | 1 + 15 files changed, 60 insertions(+), 23 deletions(-) diff --git a/frontend/app/src/components/home/GroupPermissionsEditor.svelte b/frontend/app/src/components/home/GroupPermissionsEditor.svelte index 5cacbd7a41..fc8d0ecd9b 100644 --- a/frontend/app/src/components/home/GroupPermissionsEditor.svelte +++ b/frontend/app/src/components/home/GroupPermissionsEditor.svelte @@ -127,6 +127,11 @@ defaultRole={permissions.messagePermissions.default} label={i18nKey("permissions.messagePermissions.memeFighter")} bind:rolePermission={permissions.messagePermissions.memeFighter} /> + {:else if selectedTab === 2} + {/if} {/if}
diff --git a/frontend/app/src/components/home/Home.svelte b/frontend/app/src/components/home/Home.svelte index 67e797168a..c6a4a7573b 100644 --- a/frontend/app/src/components/home/Home.svelte +++ b/frontend/app/src/components/home/Home.svelte @@ -936,7 +936,10 @@ inviteUsers: "admin", mentionAllMembers: "member", reactToMessages: "member", - messagePermissions: { default: "member" }, + messagePermissions: { + default: "member", + p2pSwap: "none", + }, threadPermissions: undefined, }, rules: { ...defaultChatRules(level), newVersion: false }, diff --git a/frontend/app/src/i18n/cn.json b/frontend/app/src/i18n/cn.json index 6f0a4b3b29..2ef557603a 100644 --- a/frontend/app/src/i18n/cn.json +++ b/frontend/app/src/i18n/cn.json @@ -366,7 +366,8 @@ "crypto": "发送加密消息", "giphy": "发送 giphy 消息", "prize": "发送有奖短信", - "memeFighter": "发送 Meme Fighter 消息" + "memeFighter": "发送 Meme Fighter 消息", + "p2pSwap": "发送P2P交换消息" }, "threadPermissions": { "default": "默认在线程中发送消息", @@ -379,7 +380,8 @@ "crypto": "在线程中发送加密消息", "giphy": "在线程中发送 giphy 消息", "prize": "在话题中发送有奖信息", - "memeFighter": "在线程中发送 Meme Fighter 消息" + "memeFighter": "在线程中发送 Meme Fighter 消息", + "p2pSwap": "在线程中发送 P2P 交换消息" } }, "rules": { diff --git a/frontend/app/src/i18n/de.json b/frontend/app/src/i18n/de.json index 1997a0108a..c85ca47693 100644 --- a/frontend/app/src/i18n/de.json +++ b/frontend/app/src/i18n/de.json @@ -369,7 +369,8 @@ "crypto": "Krypto-Nachrichten senden", "giphy": "Senden Sie Giphy-Nachrichten", "prize": "Senden Sie Preisnachrichten", - "memeFighter": "Senden Sie Meme Fighter-Nachrichten" + "memeFighter": "Senden Sie Meme Fighter-Nachrichten", + "p2pSwap": "Senden Sie P2P-Swap-Nachrichten" }, "threadPermissions": { "default": "Senden Sie Nachrichten standardmäßig in Threads", @@ -382,7 +383,8 @@ "crypto": "Senden Sie Kryptonachrichten in Threads", "giphy": "Senden Sie Giphy-Nachrichten in Threads", "prize": "Versenden Sie Preisnachrichten in Threads", - "memeFighter": "Senden Sie Meme Fighter-Nachrichten in Threads" + "memeFighter": "Senden Sie Meme Fighter-Nachrichten in Threads", + "p2pSwap": "Senden Sie P2P-Swap-Nachrichten in Threads" } }, "rules": { diff --git a/frontend/app/src/i18n/en.json b/frontend/app/src/i18n/en.json index 2fd44b0d62..62d9cf8bc0 100644 --- a/frontend/app/src/i18n/en.json +++ b/frontend/app/src/i18n/en.json @@ -453,7 +453,8 @@ "crypto": "send crypto messages", "giphy": "send giphy messages", "prize": "send prize mssages", - "memeFighter": "send Meme Fighter messages" + "memeFighter": "send Meme Fighter messages", + "p2pSwap": "send P2P swap messages" }, "threadPermissions": { "default": "send messages in threads by default", @@ -466,7 +467,8 @@ "crypto": "send crypto messages in threads", "giphy": "send giphy messages in threads", "prize": "send prize mssages in threads", - "memeFighter": "send Meme Fighter messages in threads" + "memeFighter": "send Meme Fighter messages in threads", + "p2pSwap": "send P2P swap messages in threads" } }, "level": { diff --git a/frontend/app/src/i18n/es.json b/frontend/app/src/i18n/es.json index 5e3ba1fd82..de6c1d9b8f 100644 --- a/frontend/app/src/i18n/es.json +++ b/frontend/app/src/i18n/es.json @@ -368,7 +368,8 @@ "crypto": "enviar mensajes criptográficos", "giphy": "enviar mensajes giphy", "prize": "enviar mensajes de premio", - "memeFighter": "enviar mensajes de Meme Fighter" + "memeFighter": "enviar mensajes de Meme Fighter", + "p2pSwap": "enviar mensajes de intercambio P2P" }, "threadPermissions": { "default": "enviar mensajes en hilos de forma predeterminada", @@ -381,7 +382,8 @@ "crypto": "enviar mensajes criptográficos en hilos", "giphy": "enviar mensajes giphy en hilos", "prize": "enviar mensajes de premio en hilos", - "memeFighter": "enviar mensajes de Meme Fighter en hilos" + "memeFighter": "enviar mensajes de Meme Fighter en hilos", + "p2pSwap": "enviar mensajes de intercambio P2P en hilos" } }, "rules": { diff --git a/frontend/app/src/i18n/fr.json b/frontend/app/src/i18n/fr.json index c661e4095f..e40440fb10 100644 --- a/frontend/app/src/i18n/fr.json +++ b/frontend/app/src/i18n/fr.json @@ -366,7 +366,8 @@ "crypto": "envoyer des messages cryptographiques", "giphy": "envoyer des messages giphy", "prize": "envoyer des messages de récompense", - "memeFighter": "envoyer des messages à Meme Fighter" + "memeFighter": "envoyer des messages à Meme Fighter", + "p2pSwap": "envoyer des messages d'échange P2P" }, "threadPermissions": { "default": "envoyer des messages dans les fils de discussion par défaut", @@ -379,7 +380,8 @@ "crypto": "envoyer des messages cryptographiques dans les fils de discussion", "giphy": "envoyer des messages Giphy dans les discussions", "prize": "envoyer des messages de récompense dans les discussions", - "memeFighter": "envoyer des messages Meme Fighter dans les discussions" + "memeFighter": "envoyer des messages Meme Fighter dans les discussions", + "p2pSwap": "envoyer des messages d'échange P2P dans les fils de discussion" } }, "rules": { diff --git a/frontend/app/src/i18n/hi.json b/frontend/app/src/i18n/hi.json index 2d1ca16a64..ef631c0a84 100644 --- a/frontend/app/src/i18n/hi.json +++ b/frontend/app/src/i18n/hi.json @@ -453,7 +453,8 @@ "crypto": "क्रिप्टो संदेश भेजें", "giphy": "जिप्पी संदेश भेजें", "prize": "पुरस्कार संदेश भेजें", - "memeFighter": "मेमे फाइटर संदेश भेजें" + "memeFighter": "मेमे फाइटर संदेश भेजें", + "p2pSwap": "पी2पी स्वैप संदेश भेजें" }, "threadPermissions": { "default": "डिफ़ॉल्ट रूप से थ्रेड में संदेश भेजें", @@ -466,7 +467,8 @@ "crypto": "थ्रेड्स में क्रिप्टो संदेश भेजें", "giphy": "थ्रेड्स में giphy संदेश भेजें", "prize": "थ्रेड में पुरस्कार संदेश भेजें", - "memeFighter": "मेमे फाइटर संदेश थ्रेड में भेजें" + "memeFighter": "मेमे फाइटर संदेश थ्रेड में भेजें", + "p2pSwap": "थ्रेड में पी2पी स्वैप संदेश भेजें" } }, "level": { diff --git a/frontend/app/src/i18n/it.json b/frontend/app/src/i18n/it.json index c305f1a17d..707f2d4ed3 100644 --- a/frontend/app/src/i18n/it.json +++ b/frontend/app/src/i18n/it.json @@ -367,7 +367,8 @@ "crypto": "inviare messaggi crittografati", "giphy": "inviare messaggi giphy", "prize": "inviare messaggi premio", - "memeFighter": "inviare messaggi di Meme Fighter" + "memeFighter": "inviare messaggi di Meme Fighter", + "p2pSwap": "inviare messaggi di scambio P2P" }, "threadPermissions": { "default": "invia messaggi nei thread per impostazione predefinita", @@ -380,7 +381,8 @@ "crypto": "inviare messaggi crittografati nei thread", "giphy": "inviare messaggi giphy nei thread", "prize": "inviare messaggi premio nei thread", - "memeFighter": "inviare messaggi di Meme Fighter nei thread" + "memeFighter": "inviare messaggi di Meme Fighter nei thread", + "p2pSwap": "inviare messaggi di scambio P2P nei thread" } }, "rules": { diff --git a/frontend/app/src/i18n/iw.json b/frontend/app/src/i18n/iw.json index 2a46c4de6c..045e3fab8d 100644 --- a/frontend/app/src/i18n/iw.json +++ b/frontend/app/src/i18n/iw.json @@ -375,7 +375,8 @@ "crypto": "לשלוח הודעות קריפטו", "giphy": "לשלוח הודעות giphy", "prize": "לשלוח הודעות פרס", - "memeFighter": "לשלוח הודעות Meme Fighter" + "memeFighter": "לשלוח הודעות Meme Fighter", + "p2pSwap": "לשלוח הודעות חילופי P2P" }, "threadPermissions": { "default": "לשלוח הודעות בשרשורים כברירת מחדל", @@ -388,7 +389,8 @@ "crypto": "לשלוח הודעות קריפטו בשרשורים", "giphy": "לשלוח הודעות giphy בשרשורים", "prize": "שלח הודעות פרס בשרשורים", - "memeFighter": "שלח הודעות Meme Fighter בשרשורים" + "memeFighter": "שלח הודעות Meme Fighter בשרשורים", + "p2pSwap": "לשלוח הודעות חילופי P2P בשרשורים" } }, "rules": { diff --git a/frontend/app/src/i18n/jp.json b/frontend/app/src/i18n/jp.json index 8e438dcf52..91a3a127a7 100644 --- a/frontend/app/src/i18n/jp.json +++ b/frontend/app/src/i18n/jp.json @@ -367,7 +367,8 @@ "crypto": "暗号メッセージを送信する", "giphy": "giphy メッセージを送信する", "prize": "賞品メッセージを送信する", - "memeFighter": "ミームファイターメッセージを送信する" + "memeFighter": "ミームファイターメッセージを送信する", + "p2pSwap": "P2P スワップ メッセージを送信する" }, "threadPermissions": { "default": "デフォルトでメッセージをスレッドに送信する", @@ -380,7 +381,8 @@ "crypto": "スレッドで暗号メッセージを送信する", "giphy": "スレッドで giphy メッセージを送信する", "prize": "スレッドで賞品メッセージを送信する", - "memeFighter": "ミームファイターのメッセージをスレッドに送信する" + "memeFighter": "ミームファイターのメッセージをスレッドに送信する", + "p2pSwap": "P2P スワップ メッセージをスレッドで送信する" } }, "rules": { diff --git a/frontend/app/src/i18n/ru.json b/frontend/app/src/i18n/ru.json index 273e17a4d6..cd2165a4b8 100644 --- a/frontend/app/src/i18n/ru.json +++ b/frontend/app/src/i18n/ru.json @@ -367,7 +367,8 @@ "crypto": "отправлять криптосообщения", "giphy": "отправлять гифные сообщения", "prize": "отправлять сообщения о призах", - "memeFighter": "отправлять сообщения Meme Fighter" + "memeFighter": "отправлять сообщения Meme Fighter", + "p2pSwap": "отправлять сообщения обмена P2P" }, "threadPermissions": { "default": "отправлять сообщения в темах по умолчанию", @@ -380,7 +381,8 @@ "crypto": "отправлять криптосообщения в темах", "giphy": "отправлять сообщения Giphy в темах", "prize": "отправлять сообщения о призах в темы", - "memeFighter": "отправлять сообщения Meme Fighter в тредах" + "memeFighter": "отправлять сообщения Meme Fighter в тредах", + "p2pSwap": "отправлять сообщения обмена P2P в темах" } }, "rules": { diff --git a/frontend/app/src/i18n/vi.json b/frontend/app/src/i18n/vi.json index 611e96a1f8..04cd5dbf54 100644 --- a/frontend/app/src/i18n/vi.json +++ b/frontend/app/src/i18n/vi.json @@ -368,7 +368,8 @@ "crypto": "gửi tin nhắn mật mã", "giphy": "gửi tin nhắn giphy", "prize": "gửi tin nhắn trúng thưởng", - "memeFighter": "gửi tin nhắn Meme Fighter" + "memeFighter": "gửi tin nhắn Meme Fighter", + "p2pSwap": "gửi tin nhắn trao đổi P2P" }, "threadPermissions": { "default": "gửi tin nhắn theo chủ đề theo mặc định", @@ -381,7 +382,8 @@ "crypto": "gửi tin nhắn mật mã trong chuỗi", "giphy": "gửi tin nhắn giphy trong chủ đề", "prize": "gửi tin nhắn giải thưởng trong chủ đề", - "memeFighter": "gửi tin nhắn Meme Fighter trong chủ đề" + "memeFighter": "gửi tin nhắn Meme Fighter trong chủ đề", + "p2pSwap": "gửi tin nhắn trao đổi P2P trong chủ đề" } }, "rules": { diff --git a/frontend/openchat-agent/src/services/common/chatMappers.ts b/frontend/openchat-agent/src/services/common/chatMappers.ts index aa5fb604ac..82dc65d198 100644 --- a/frontend/openchat-agent/src/services/common/chatMappers.ts +++ b/frontend/openchat-agent/src/services/common/chatMappers.ts @@ -963,6 +963,7 @@ function messagePermissions(candid: ApiMessagePermissions): MessagePermissions { crypto: optional(candid.crypto, permissionRole), giphy: optional(candid.giphy, permissionRole), prize: optional(candid.prize, permissionRole), + p2pSwap: optional(candid.p2p_swap, permissionRole), memeFighter: mf !== undefined ? permissionRole(mf) : undefined, }; } diff --git a/frontend/openchat-client/src/utils/chat.ts b/frontend/openchat-client/src/utils/chat.ts index 440509d405..8954b52a58 100644 --- a/frontend/openchat-client/src/utils/chat.ts +++ b/frontend/openchat-client/src/utils/chat.ts @@ -553,6 +553,7 @@ function mergeMessagePermissions( giphy: applyOptionUpdate(current.giphy, updated.giphy), prize: applyOptionUpdate(current.prize, updated.prize), memeFighter: applyOptionUpdate(current.memeFighter, updated.memeFighter), + p2pSwap: applyOptionUpdate(current.p2pSwap, updated.p2pSwap), }; } From f7b19a86fe5d89f20aa8ee79e505d0439bce29af Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Sat, 27 Jan 2024 20:11:17 +0000 Subject: [PATCH 19/19] Hack to cater for SNEED's unique handling of transfer fees (#5280) --- backend/canisters/community/CHANGELOG.md | 4 ++++ backend/canisters/escrow/CHANGELOG.md | 1 + backend/canisters/group/CHANGELOG.md | 4 ++++ backend/canisters/user/CHANGELOG.md | 4 ++++ .../icrc_ledger/c2c_client/src/lib.rs | 16 +++++++++++++++- 5 files changed, 28 insertions(+), 1 deletion(-) diff --git a/backend/canisters/community/CHANGELOG.md b/backend/canisters/community/CHANGELOG.md index 019c173ece..2e18ad7dd4 100644 --- a/backend/canisters/community/CHANGELOG.md +++ b/backend/canisters/community/CHANGELOG.md @@ -9,6 +9,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Implement ability to update user principals ([#5220](https://github.com/open-chat-labs/open-chat/pull/5220)) +### Changed + +- Hack to cater for SNEED's unique handling of transfer fees ([#5280](https://github.com/open-chat-labs/open-chat/pull/5280)) + ## [[2.0.1021](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1021-community)] - 2024-01-24 ### Changed diff --git a/backend/canisters/escrow/CHANGELOG.md b/backend/canisters/escrow/CHANGELOG.md index d19796d3ef..12797532d3 100644 --- a/backend/canisters/escrow/CHANGELOG.md +++ b/backend/canisters/escrow/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed - Avoid usages of `make_c2c_call` and use macro instead ([#5252](https://github.com/open-chat-labs/open-chat/pull/5252)) +- Hack to cater for SNEED's unique handling of transfer fees ([#5280](https://github.com/open-chat-labs/open-chat/pull/5280)) ## [[2.0.1020](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1020-escrow)] - 2024-01-24 diff --git a/backend/canisters/group/CHANGELOG.md b/backend/canisters/group/CHANGELOG.md index 1f330f0dbc..7035ce5d34 100644 --- a/backend/canisters/group/CHANGELOG.md +++ b/backend/canisters/group/CHANGELOG.md @@ -9,6 +9,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Implement ability to update user principals ([#5220](https://github.com/open-chat-labs/open-chat/pull/5220)) +### Changed + +- Hack to cater for SNEED's unique handling of transfer fees ([#5280](https://github.com/open-chat-labs/open-chat/pull/5280)) + ## [[2.0.1022](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1022-group)] - 2024-01-24 ### Changed diff --git a/backend/canisters/user/CHANGELOG.md b/backend/canisters/user/CHANGELOG.md index 1418905a68..984e9c50d8 100644 --- a/backend/canisters/user/CHANGELOG.md +++ b/backend/canisters/user/CHANGELOG.md @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [unreleased] +### Changed + +- Hack to cater for SNEED's unique handling of transfer fees ([#5280](https://github.com/open-chat-labs/open-chat/pull/5280)) + ## [[2.0.1032](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1032-user)] - 2024-01-25 ### Added diff --git a/backend/external_canisters/icrc_ledger/c2c_client/src/lib.rs b/backend/external_canisters/icrc_ledger/c2c_client/src/lib.rs index 939e714374..f589a2304b 100644 --- a/backend/external_canisters/icrc_ledger/c2c_client/src/lib.rs +++ b/backend/external_canisters/icrc_ledger/c2c_client/src/lib.rs @@ -11,6 +11,20 @@ generate_candid_c2c_call_no_args!(icrc1_supported_standards); generate_candid_c2c_call_no_args!(icrc1_symbol); // Updates -generate_candid_c2c_call!(icrc1_transfer); generate_candid_c2c_call!(icrc2_approve); generate_candid_c2c_call!(icrc2_transfer_from); + +pub async fn icrc1_transfer( + canister_id: ::types::CanisterId, + args: &icrc1_transfer::Args, +) -> ::ic_cdk::api::call::CallResult { + let method_name = "icrc1_transfer"; + let mut args = args.clone(); + if canister_id == ::types::CanisterId::from_text("r7cp6-6aaaa-aaaag-qco5q-cai").unwrap() { + args.amount += ::candid::Nat::from(100000000u32); + } + canister_client::make_c2c_call(canister_id, method_name, &args, ::candid::encode_one, |r| { + ::candid::decode_one(r) + }) + .await +}