Skip to content

Commit 91318ff

Browse files
committed
Merge branch 'NNS1-1972' into 'master'
NNS1-1972: Basic implementation of add/remove root as controller to canister Adds a new sub-command for adding/removing NNS root as co-controller of one or more canisters. It is called like ``` sns prepare-canisters --network ic add-nns-root <CANISTER_ID> <CANISTER_ID2> sns prepare-canisters --network ic remove-nns-root <CANISTER_ID> <CANISTER_ID2> ``` The updated help text: ``` sns-cli 1.0.0 Initialize, deploy and interact with an SNS. USAGE: sns <SUBCOMMAND> OPTIONS: -h, --help Print help information -V, --version Print version information SUBCOMMANDS: account-balance Display the balance of a given account add-sns-wasm-for-tests Add a wasms for one of the SNS canisters, skipping the NNS proposal, for tests deploy Deploy an sns through the sns-wasms canister deploy-skipping-sns-wasms-for-tests Deploy an sns directly to a subnet, skipping the sns-wasms canister. For use in tests only deploy-testflight Deploy an sns directly to a subnet, skipping the sns-wasms canister. The SNS canisters remain controlled by the developer after deployment. For use in tests only help Print this message or the help of the given subcommand(s) init-config-file Manage the config file where the initial sns parameters are set prepare-canisters Make changes to canisters you own to prepare for SNS Decentralization ``` Sub help text: ``` sns-prepare-canisters Make changes to canisters you own to prepare for SNS Decentralization USAGE: sns prepare-canisters [OPTIONS] <SUBCOMMAND> OPTIONS: -h, --help Print help information --network <NETWORK> The network to deploy to. This can be "local", "ic", or the URL of an IC network [default: local] SUBCOMMANDS: add-nns-root Add NNS Root as a controller of one or more canisters help Print this message or the help of the given subcommand(s) remove-nns-root Remove NNS Root as a controller of one or more canisters ``` Command helps: ``` USAGE: sns prepare-canisters add-nns-root <CANISTER>... USAGE: sns prepare-canisters remove-nns-root <CANISTER>... ``` See merge request dfinity-lab/public/ic!12600
2 parents 17451e9 + 0ad4347 commit 91318ff

File tree

5 files changed

+557
-504
lines changed

5 files changed

+557
-504
lines changed

rs/sns/cli/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ rust_binary(
7272
aliases = ALIASES,
7373
proc_macro_deps = MACRO_DEPENDENCIES,
7474
version = "1.0.0",
75-
deps = DEPENDENCIES,
75+
deps = DEPENDENCIES + [":cli"],
7676
)
7777

7878
rust_test(
7979
name = "sns_test",
8080
srcs = glob(["src/**"]),
8181
aliases = ALIASES,
82-
crate_root = "src/main.rs",
82+
crate_root = "src/lib.rs",
8383
data = [
8484
"example_sns_init_v2.yaml",
8585
"test.png",

rs/sns/cli/src/deploy.rs

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,30 @@
11
//! Contains the logic for deploying SNS canisters
22
3-
use candid::parser::value::IDLValue;
4-
use candid::Decode;
5-
use candid::Encode;
6-
use ic_base_types::{CanisterId, PrincipalId};
7-
use ic_nns_constants::ROOT_CANISTER_ID as NNS_ROOT_CANISTER_ID;
8-
use ic_nns_constants::SNS_WASM_CANISTER_ID;
9-
use ic_sns_governance::pb::v1::ListNeuronsResponse;
10-
use ic_sns_init::pb::v1::SnsInitPayload;
11-
use ic_sns_init::{SnsCanisterIds, SnsCanisterInitPayloads};
12-
use ic_sns_root::pb::v1::ListSnsCanistersResponse;
13-
use ic_sns_wasm::pb::v1::DeployNewSnsRequest;
14-
use ic_sns_wasm::pb::v1::DeployNewSnsResponse;
15-
use ic_sns_wasm::pb::v1::SnsCanisterIds as SnsWSnsCanisterIds;
16-
use serde_json::json;
17-
use serde_json::Value as JsonValue;
18-
use std::fs::{create_dir_all, OpenOptions};
19-
use std::io::{BufWriter, Read, Seek, SeekFrom, Write};
20-
use std::path::{Path, PathBuf};
21-
use std::str::FromStr;
22-
use tempfile::NamedTempFile;
23-
24-
use anyhow::anyhow;
253
#[cfg(test)]
264
use std::io::BufReader;
5+
use std::{
6+
fs::{create_dir_all, OpenOptions},
7+
io::{BufWriter, Read, Seek, SeekFrom, Write},
8+
path::{Path, PathBuf},
9+
str::FromStr,
10+
};
11+
12+
use anyhow::anyhow;
13+
use candid::{parser::value::IDLValue, Decode, Encode};
14+
use serde_json::{json, Value as JsonValue};
15+
use tempfile::NamedTempFile;
2716

2817
use crate::{
2918
call_dfx, call_dfx_or_panic, get_identity, hex_encode_candid, DeployArgs, DeployTestflightArgs,
3019
};
20+
use ic_base_types::{CanisterId, PrincipalId};
21+
use ic_nns_constants::{ROOT_CANISTER_ID as NNS_ROOT_CANISTER_ID, SNS_WASM_CANISTER_ID};
22+
use ic_sns_governance::pb::v1::ListNeuronsResponse;
23+
use ic_sns_init::{pb::v1::SnsInitPayload, SnsCanisterIds, SnsCanisterInitPayloads};
24+
use ic_sns_root::pb::v1::ListSnsCanistersResponse;
25+
use ic_sns_wasm::pb::v1::{
26+
DeployNewSnsRequest, DeployNewSnsResponse, SnsCanisterIds as SnsWSnsCanisterIds,
27+
};
3128

3229
/// If SNS canisters have already been created, return their canister IDs, else create the
3330
/// SNS canisters and return their canister IDs.

0 commit comments

Comments
 (0)