Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix: Lock SNS version #2587

Merged
merged 7 commits into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dfx/src/commands/nns/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,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_COMMIT").unwrap_or_else(|_| replica_rev().to_string());

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,5 +1,6 @@
//! Code for the command line `dfx sns import`
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 @@ -28,10 +29,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_COMMIT").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
8 changes: 4 additions & 4 deletions src/dfx/src/lib/nns/install_nns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,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_COMMIT").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