Skip to content

Commit

Permalink
fix: --no-asset-upgrade hangs forever (#4089)
Browse files Browse the repository at this point in the history
  • Loading branch information
sesi200 committed Feb 4, 2025
1 parent 85e9b9f commit b2169f6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 33 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# UNRELEASED

### fix: `dfx canister install` and `dfx deploy` with `--no-asset-upgrade` no longer hang indefinitely when wasm is not up to date

# 0.25.0

### fix: correctly detects hyphenated Rust bin crates
Expand Down
3 changes: 2 additions & 1 deletion e2e/tests-dfx/install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,11 @@ teardown() {
@test "--no-asset-upgrade skips asset upgrade" {
dfx_start
use_asset_wasm 0.12.1
dfx deploy
assert_command dfx deploy
assert_command dfx canister info e2e_project_frontend
assert_contains db07e7e24f6f8ddf53c33a610713259a7c1eb71c270b819ebd311e2d223267f0
use_default_asset_wasm
assert_command dfx build e2e_project_frontend # otherwise the new wasm is not picked up
assert_command dfx canister install e2e_project_frontend --mode upgrade --no-asset-upgrade
assert_command dfx canister info e2e_project_frontend
assert_contains db07e7e24f6f8ddf53c33a610713259a7c1eb71c270b819ebd311e2d223267f0
Expand Down
40 changes: 8 additions & 32 deletions src/dfx/src/lib/operations/canister/install_canister.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,33 +79,10 @@ pub async fn install_canister(
read_module_metadata(agent, canister_id, "enhanced-orthogonal-persistence")
.await
.map(|_| WasmMemoryPersistence::Keep);
// let mode = if let InstallModeHint::Auto(options) = mode_hint {
// if installed_module_hash.is_some() {
// InstallMode::Upgrade(Some(CanisterUpgradeOptions {
// wasm_memory_persistence,
// skip_pre_upgrade: None,
// }))
// } else {
// InstallMode::Install
// }
// } else {
// InstallMode::Install
// };
let mode = mode_hint.to_install_mode(
installed_module_hash.is_some(),
wasm_memory_persistence_embedded,
);

// let mode = mode.unwrap_or_else(|| {
// if installed_module_hash.is_some() {
// InstallMode::Upgrade(Some(CanisterUpgradeOptions {
// wasm_memory_persistence,
// skip_pre_upgrade: None,
// }))
// } else {
// InstallMode::Install
// }
// });
let mode_str = install_mode_to_prompt(&mode);
let canister_name = canister_info.get_name();
info!(
Expand Down Expand Up @@ -242,17 +219,16 @@ The command line value will be used.",
)
.await?;
}
wait_for_module_hash(
env,
agent,
canister_id,
installed_module_hash.as_deref(),
&new_hash,
)
.await?;
}

wait_for_module_hash(
env,
agent,
canister_id,
installed_module_hash.as_deref(),
&new_hash,
)
.await?;

if canister_info.is_assets() {
if let Some(canister_timeout) = canister_id_store.get_timestamp(canister_info.get_name()) {
// playground installed the code, so playground has to authorize call_sender to upload files
Expand Down

0 comments on commit b2169f6

Please sign in to comment.