Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
22 changes: 22 additions & 0 deletions apps/wallet/src/generated/station/station.did
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,15 @@ type CanisterInstallMode = variant {
upgrade;
};

// WASM memory persistence setting passed to `install_code` when the install
// mode is `upgrade`. `keep` is required for Motoko canisters that use
// Enhanced Orthogonal Persistence; the IC defaults to `replace` (clearing
// main memory) otherwise.
type WasmMemoryPersistence = variant {
keep;
replace;
};

type SystemUpgradeTarget = variant {
UpgradeStation;
UpgradeUpgrader;
Expand Down Expand Up @@ -666,6 +675,13 @@ type ChangeExternalCanisterOperationInput = record {
module_extra_chunks : opt WasmModuleExtraChunks;
// The initial argument passed to the new wasm module.
arg : opt blob;
// WASM memory persistence setting. Only applicable when `mode` is `upgrade`.
// Required as `keep` for upgrading Motoko canisters that use Enhanced
// Orthogonal Persistence; otherwise the IC clears their main memory.
wasm_memory_persistence : opt WasmMemoryPersistence;
// If `true`, the `pre_upgrade` hook is skipped. Only applicable when `mode`
// is `upgrade`.
skip_pre_upgrade : opt bool;
};

type ChangeExternalCanisterOperation = record {
Expand All @@ -677,6 +693,12 @@ type ChangeExternalCanisterOperation = record {
module_checksum : Sha256Hash;
// The checksum of the arg blob.
arg_checksum : opt Sha256Hash;
// WASM memory persistence setting recorded for this upgrade, if any.
// Only meaningful when `mode` is `upgrade`.
wasm_memory_persistence : opt WasmMemoryPersistence;
// Whether the `pre_upgrade` hook was skipped. Only meaningful when `mode`
// is `upgrade`.
skip_pre_upgrade : opt bool;
};

type SubnetFilter = record {
Expand Down
30 changes: 30 additions & 0 deletions apps/wallet/src/generated/station/station.did.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,14 @@ export interface CanisterExecutionAndValidationMethodPair {
export type CanisterInstallMode = { 'reinstall' : null } |
{ 'upgrade' : null } |
{ 'install' : null };
/**
* WASM memory persistence setting passed to `install_code` when the install
* mode is `upgrade`. `keep` is required for Motoko canisters that use
* Enhanced Orthogonal Persistence; the IC defaults to `replace` (clearing
* main memory) otherwise.
*/
export type WasmMemoryPersistence = { 'keep' : null } |
{ 'replace' : null };
export interface CanisterMethod {
/**
* The canister to call.
Expand Down Expand Up @@ -836,6 +844,16 @@ export interface ChangeExternalCanisterOperation {
* The checksum of the arg blob.
*/
'arg_checksum' : [] | [Sha256Hash],
/**
* WASM memory persistence setting recorded for this upgrade, if any.
* Only meaningful when `mode` is `upgrade`.
*/
'wasm_memory_persistence' : [] | [WasmMemoryPersistence],
/**
* Whether the `pre_upgrade` hook was skipped. Only meaningful when `mode`
* is `upgrade`.
*/
'skip_pre_upgrade' : [] | [boolean],
}
export interface ChangeExternalCanisterOperationInput {
/**
Expand All @@ -858,6 +876,18 @@ export interface ChangeExternalCanisterOperationInput {
* The wasm module to install.
*/
'module' : Uint8Array | number[],
/**
* WASM memory persistence setting. Only applicable when `mode` is
* `upgrade`. Required as `keep` for upgrading Motoko canisters that use
* Enhanced Orthogonal Persistence; otherwise the IC clears their main
* memory.
*/
'wasm_memory_persistence' : [] | [WasmMemoryPersistence],
/**
* If `true`, the `pre_upgrade` hook is skipped. Only applicable when
* `mode` is `upgrade`.
*/
'skip_pre_upgrade' : [] | [boolean],
}
/**
* Type for instructions to update the address book entry's metadata.
Expand Down
8 changes: 8 additions & 0 deletions apps/wallet/src/generated/station/station.did.js
Original file line number Diff line number Diff line change
Expand Up @@ -454,12 +454,18 @@ export const idlFactory = ({ IDL }) => {
'upgrade' : IDL.Null,
'install' : IDL.Null,
});
const WasmMemoryPersistence = IDL.Variant({
'keep' : IDL.Null,
'replace' : IDL.Null,
});
const Sha256Hash = IDL.Text;
const ChangeExternalCanisterOperation = IDL.Record({
'mode' : CanisterInstallMode,
'canister_id' : IDL.Principal,
'module_checksum' : Sha256Hash,
'arg_checksum' : IDL.Opt(Sha256Hash),
'wasm_memory_persistence' : IDL.Opt(WasmMemoryPersistence),
'skip_pre_upgrade' : IDL.Opt(IDL.Bool),
});
const CycleObtainStrategyInput = IDL.Variant({
'Disabled' : IDL.Null,
Expand Down Expand Up @@ -975,6 +981,8 @@ export const idlFactory = ({ IDL }) => {
'mode' : CanisterInstallMode,
'canister_id' : IDL.Principal,
'module' : IDL.Vec(IDL.Nat8),
'wasm_memory_persistence' : IDL.Opt(WasmMemoryPersistence),
'skip_pre_upgrade' : IDL.Opt(IDL.Bool),
});
const SetDisasterRecoveryOperationInput = IDL.Record({
'committee' : IDL.Opt(DisasterRecoveryCommittee),
Expand Down
22 changes: 22 additions & 0 deletions core/station/api/spec.did
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,15 @@ type CanisterInstallMode = variant {
upgrade;
};

// WASM memory persistence setting passed to `install_code` when the install
// mode is `upgrade`. `keep` is required for Motoko canisters that use
// Enhanced Orthogonal Persistence; the IC defaults to `replace` (clearing
// main memory) otherwise.
type WasmMemoryPersistence = variant {
keep;
replace;
};

type SystemUpgradeTarget = variant {
UpgradeStation;
UpgradeUpgrader;
Expand Down Expand Up @@ -666,6 +675,13 @@ type ChangeExternalCanisterOperationInput = record {
module_extra_chunks : opt WasmModuleExtraChunks;
// The initial argument passed to the new wasm module.
arg : opt blob;
// WASM memory persistence setting. Only applicable when `mode` is `upgrade`.
// Required as `keep` for upgrading Motoko canisters that use Enhanced
// Orthogonal Persistence; otherwise the IC clears their main memory.
wasm_memory_persistence : opt WasmMemoryPersistence;
// If `true`, the `pre_upgrade` hook is skipped. Only applicable when `mode`
// is `upgrade`.
skip_pre_upgrade : opt bool;
Comment thread
aterga marked this conversation as resolved.
Outdated
};

type ChangeExternalCanisterOperation = record {
Expand All @@ -677,6 +693,12 @@ type ChangeExternalCanisterOperation = record {
module_checksum : Sha256Hash;
// The checksum of the arg blob.
arg_checksum : opt Sha256Hash;
// WASM memory persistence setting recorded for this upgrade, if any.
// Only meaningful when `mode` is `upgrade`.
wasm_memory_persistence : opt WasmMemoryPersistence;
// Whether the `pre_upgrade` hook was skipped. Only meaningful when `mode`
// is `upgrade`.
skip_pre_upgrade : opt bool;
};

type SubnetFilter = record {
Expand Down
8 changes: 8 additions & 0 deletions core/station/api/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ pub enum CanisterInstallMode {
Upgrade = 3,
}

#[derive(CandidType, serde::Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq)]
pub enum WasmMemoryPersistence {
#[serde(rename = "keep")]
Keep,
#[serde(rename = "replace")]
Replace,
}

#[derive(CandidType, serde::Serialize, Deserialize, Debug, Clone)]
pub struct Snapshot {
pub snapshot_id: String,
Expand Down
11 changes: 10 additions & 1 deletion core/station/api/src/external_canister.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
AllowDTO, CanisterInstallMode, ChangeMetadataDTO, CycleObtainStrategyInput, MetadataDTO,
PaginationInput, RequestPolicyRuleDTO, Sha256HashDTO, SortDirection, TimestampRfc3339, UuidDTO,
ValidationMethodResourceTargetDTO,
ValidationMethodResourceTargetDTO, WasmMemoryPersistence,
};
use candid::{CandidType, Deserialize, Nat, Principal};
use orbit_essentials::cmc::SubnetSelection;
Expand Down Expand Up @@ -131,6 +131,13 @@ pub struct ChangeExternalCanisterOperationInput {
pub module_extra_chunks: Option<WasmModuleExtraChunks>,
#[serde(deserialize_with = "orbit_essentials::deserialize::deserialize_option_blob")]
pub arg: Option<Vec<u8>>,
/// WASM memory persistence setting. Only applicable when `mode` is `upgrade`.
/// Required as `keep` for upgrading Motoko canisters that use Enhanced
/// Orthogonal Persistence; otherwise the IC clears their main memory.
pub wasm_memory_persistence: Option<WasmMemoryPersistence>,
/// If `true`, the `pre_upgrade` hook is skipped. Only applicable when
/// `mode` is `upgrade`.
pub skip_pre_upgrade: Option<bool>,
}

#[derive(CandidType, serde::Serialize, Deserialize, Debug, Clone)]
Expand All @@ -139,6 +146,8 @@ pub struct ChangeExternalCanisterOperationDTO {
pub mode: CanisterInstallMode,
pub module_checksum: Sha256HashDTO,
pub arg_checksum: Option<Sha256HashDTO>,
pub wasm_memory_persistence: Option<WasmMemoryPersistence>,
pub skip_pre_upgrade: Option<bool>,
}

#[derive(CandidType, serde::Serialize, Deserialize, Debug, Clone)]
Expand Down
Loading
Loading