Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dfx/src/commands/nns/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub async fn exec(env: &dyn Environment, opts: ImportOpts) -> DfxResult {
let mut config = config.as_ref().clone();

let network_mappings = get_network_mappings(&opts.network_mapping)?;
let ic_commit = replica_rev();
let ic_commit = std::env::var("DFX_IC_REF").unwrap_or_else(|_| replica_rev().to_string());
Comment thread
bitdivine marked this conversation as resolved.
Outdated

let dfx_url_str = {
let ic_project = std::env::var("DFX_IC_SRC").unwrap_or_else(|_| {
Expand Down
6 changes: 5 additions & 1 deletion src/dfx/src/commands/sns/import.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::lib::error::DfxResult;
use crate::lib::info::replica_rev;
use crate::lib::project::import::import_canister_definitions;
use crate::lib::project::network_mappings::get_network_mappings;
use crate::Environment;
Expand Down Expand Up @@ -26,10 +27,13 @@ pub fn exec(env: &dyn Environment, opts: SnsImportOpts) -> DfxResult {
let network_mappings = get_network_mappings(&opts.network_mapping)?;

let runtime = Runtime::new().expect("Unable to create a runtime");
let ic_commit = std::env::var("DFX_IC_REF").unwrap_or_else(|_| replica_rev().to_string());
let their_dfx_json_location =
format!("https://raw.githubusercontent.com/dfinity/ic/{ic_commit}/rs/sns/cli/dfx.json");
runtime.block_on(import_canister_definitions(
env.get_logger(),
&mut config,
"https://raw.githubusercontent.com/dfinity/ic/master/rs/sns/cli/dfx.json",
&their_dfx_json_location,
None,
None,
&network_mappings,
Expand Down
11 changes: 7 additions & 4 deletions src/dfx/src/lib/nns/install_nns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ async fn get_subnet_id(agent: &Agent) -> anyhow::Result<Principal> {
/// The NNS canisters use the very first few canister IDs; they must be available.
#[context("Failed to verify that the network is empty; dfx nns install must be run just after dfx start --clean")]
async fn verify_nns_canister_ids_are_available(agent: &Agent) -> anyhow::Result<()> {
/// Checks that the canister is unused on the given network.
///
/// The network is queried directly; local state such as canister_ids.json has no effect on this function.
async fn verify_canister_id_is_available(
agent: &Agent,
canister_id: &str,
Expand Down Expand Up @@ -415,24 +418,24 @@ pub async fn download_ic_repo_wasm(
/// Downloads all the core NNS wasms, excluding only the front-end wasms II and NNS-dapp.
#[context("Failed to download NNS wasm files.")]
pub async fn download_nns_wasms(env: &dyn Environment) -> anyhow::Result<()> {
let ic_commit = replica_rev();
let ic_commit = std::env::var("DFX_IC_REF").unwrap_or_else(|_| replica_rev().to_string());
let wasm_dir = &nns_wasm_dir(env);
for IcNnsInitCanister {
wasm_name,
test_wasm_name,
..
} in NNS_CORE
{
download_ic_repo_wasm(wasm_name, ic_commit, wasm_dir).await?;
download_ic_repo_wasm(wasm_name, &ic_commit, wasm_dir).await?;
if let Some(test_wasm_name) = test_wasm_name {
download_ic_repo_wasm(test_wasm_name, ic_commit, wasm_dir).await?;
download_ic_repo_wasm(test_wasm_name, &ic_commit, wasm_dir).await?;
}
}
try_join_all(
SNS_CANISTERS
.iter()
.map(|SnsCanisterInstallation { wasm_name, .. }| {
download_ic_repo_wasm(wasm_name, ic_commit, wasm_dir)
download_ic_repo_wasm(wasm_name, &ic_commit, wasm_dir)
}),
)
.await?;
Expand Down