Skip to content

Commit

Permalink
fix!: change type of skip_pre_upgrade (#516)
Browse files Browse the repository at this point in the history
  • Loading branch information
sesi200 authored Feb 20, 2024
1 parent f216c74 commit f5ce76b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Changed the return type of `stored_chunks` to a struct.
* Added a prime256v1-based `Identity` impl to complement the ed25519 and secp256k1 `Identity` impls.
* Added serde and candid serialization traits to the `Status` type.
* Changed the type of `InstallMode.skip_pre_upgrade` from `bool` to `Option<bool>` to match the interface specification.

## [0.32.0] - 2024-01-18

Expand Down
6 changes: 3 additions & 3 deletions ic-utils/src/interfaces/management_canister/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub struct CanisterSettings {
pub controllers: Option<Vec<Principal>>,
/// The allocation percentage (between 0 and 100 inclusive) for *guaranteed* compute capacity.
///
/// The settings update will be rejected if the IC can't commit to allocating this much compupte capacity.
/// The settings update will be rejected if the IC can't commit to allocating this much compute capacity.
///
/// If unspecified and a canister is being created with these settings, defaults to 0, i.e. best-effort.
pub compute_allocation: Option<Nat>,
Expand Down Expand Up @@ -392,7 +392,7 @@ pub enum InstallMode {
#[serde(rename = "upgrade")]
Upgrade {
/// If true, skip a canister's `#[pre_upgrade]` function.
skip_pre_upgrade: bool,
skip_pre_upgrade: Option<bool>,
},
}

Expand All @@ -419,7 +419,7 @@ impl FromStr for InstallMode {
"install" => Ok(InstallMode::Install),
"reinstall" => Ok(InstallMode::Reinstall),
"upgrade" => Ok(InstallMode::Upgrade {
skip_pre_upgrade: false,
skip_pre_upgrade: Some(false),
}),
&_ => Err(format!("Invalid install mode: {}", s)),
}
Expand Down
6 changes: 3 additions & 3 deletions ref-tests/tests/ic-ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ mod management_canister {
// Upgrade should succeed.
ic00.install_code(&canister_id, &canister_wasm)
.with_mode(InstallMode::Upgrade {
skip_pre_upgrade: false,
skip_pre_upgrade: None,
})
.call_and_wait()
.await?;
Expand All @@ -171,7 +171,7 @@ mod management_canister {
let result = other_ic00
.install_code(&canister_id, &canister_wasm)
.with_mode(InstallMode::Upgrade {
skip_pre_upgrade: false,
skip_pre_upgrade: None,
})
.call_and_wait()
.await;
Expand Down Expand Up @@ -486,7 +486,7 @@ mod management_canister {
// Upgrade should succeed
ic00.install_code(&canister_id, &canister_wasm)
.with_mode(InstallMode::Upgrade {
skip_pre_upgrade: false,
skip_pre_upgrade: None,
})
.call_and_wait()
.await?;
Expand Down

0 comments on commit f5ce76b

Please sign in to comment.