Skip to content

Commit

Permalink
Merge canister creation fixes from hotfix branch into master.
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-wong-dfinity-org committed May 15, 2024
1 parent 2416a3a commit c6d2e72
Show file tree
Hide file tree
Showing 7 changed files with 483 additions and 72 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions rs/nervous_system/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use core::{
ops::{Add, AddAssign, Div, Mul, Sub},
};
use dfn_core::api::time_nanos;
use ic_base_types::CanisterId;
use ic_canister_log::{export, GlobalBuffer, LogBuffer, LogEntry};
use ic_canisters_http_types::{HttpRequest, HttpResponse, HttpResponseBuilder};
use ic_ledger_core::tokens::{CheckedAdd, CheckedSub};
Expand Down Expand Up @@ -50,6 +51,9 @@ lazy_static! {
.collect::<Vec<u64>>()
})
.collect();

pub static ref NNS_DAPP_BACKEND_CANISTER_ID: CanisterId =
CanisterId::from_str("qoctq-giaaa-aaaaa-aaaea-cai").unwrap();
}

// 10^8
Expand Down
1 change: 1 addition & 0 deletions rs/nns/cmc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package(default_visibility = ["//visibility:public"])
DEPENDENCIES = [
"//rs/crypto/getrandom_for_wasm",
"//rs/crypto/tree_hash",
"//rs/nervous_system/common",
"//rs/nervous_system/governance",
"//rs/nns/common",
"//rs/nns/constants",
Expand Down
1 change: 1 addition & 0 deletions rs/nns/cmc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ ic-crypto-tree-hash = { path = "../../crypto/tree_hash" }
ic-management-canister-types = { path = "../../types/management_canister_types" }
ic-ledger-core = { path = "../../rosetta-api/ledger_core" }
ic-metrics-encoder = "1"
ic-nervous-system-common = { path = "../../nervous_system/common" }
ic-nervous-system-common-build-metadata = { path = "../../nervous_system/common/build_metadata" }
ic-nervous-system-governance = { path = "../../nervous_system/governance" }
ic-nns-common = { path = "../../nns/common" }
Expand Down
14 changes: 14 additions & 0 deletions rs/nns/cmc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,22 @@ pub struct NotifyTopUp {
#[derive(Deserialize, CandidType, Clone, Debug, PartialEq, Eq)]
pub struct NotifyCreateCanister {
pub block_index: BlockIndex,

/// If this not set to the caller's PrincipalId, notify_create_canister
/// returns Err.
///
/// Thus, notify_create_canister cannot be called on behalf of another
/// principal. This might be surprising, but it is intentional.
///
/// If controllers is not set in settings, controllers will be just
/// [controller]. (Without this "default" behavior, the controller of the
/// canister would be the Cycles Minting Canister itself.)
pub controller: PrincipalId,

#[deprecated(note = "use subnet_selection instead")]
pub subnet_type: Option<String>,
pub subnet_selection: Option<SubnetSelection>,

pub settings: Option<CanisterSettingsArgs>,
}

Expand Down Expand Up @@ -136,6 +148,8 @@ pub enum NotifyErrorCode {
RefundFailed = 3,
/// The subnet selection parameters are set in an invalid way.
BadSubnetSelection = 4,
/// The caller is not allowed to perform the operation.
Unauthorized = 5,
}

impl NotifyError {
Expand Down
Loading

0 comments on commit c6d2e72

Please sign in to comment.