Skip to content

Commit

Permalink
Merge branch 'main' into PEN-328-extend-new-asset-dialog-with-known-s…
Browse files Browse the repository at this point in the history
…ns-ck-tokens
  • Loading branch information
olaszakos authored Jan 14, 2025
2 parents 9f4e7f1 + 62b3a59 commit e29355a
Show file tree
Hide file tree
Showing 32 changed files with 1,139 additions and 456 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ wasms/*.wasm.gz
.nx/workspace-data
/artifacts

# The latest memory dump of the station will change every time the tests are run due to
# The latest memory dump of the station and upgrader will change every time the tests are run due to
# the system time added to PocketIC being the current time, making it non deterministic.
tests/integration/assets/station-memory-latest.bin
tests/integration/assets/upgrader-memory-latest.bin
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions core/station/impl/src/models/request_operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ pub enum SystemUpgradeTarget {
pub struct WasmModuleExtraChunks {
pub store_canister: Principal,
pub extra_chunks_key: String,
#[serde(with = "serde_bytes")]
pub wasm_module_hash: Vec<u8>,
}

Expand All @@ -390,15 +391,19 @@ pub struct WasmModuleExtraChunks {
pub struct SystemUpgradeOperationInput {
pub target: SystemUpgradeTarget,
/// The module is only available while the operation is not finalized.
#[serde(with = "serde_bytes")]
pub module: Vec<u8>,
pub module_extra_chunks: Option<WasmModuleExtraChunks>,
#[serde(deserialize_with = "orbit_essentials::deserialize::deserialize_option_blob")]
pub arg: Option<Vec<u8>>,
}

#[storable]
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SystemUpgradeOperation {
#[serde(with = "serde_bytes")]
pub module_checksum: Vec<u8>,
#[serde(deserialize_with = "orbit_essentials::deserialize::deserialize_option_blob")]
pub arg_checksum: Option<Vec<u8>>,
pub input: SystemUpgradeOperationInput,
}
Expand Down Expand Up @@ -450,15 +455,19 @@ pub struct SetDisasterRecoveryOperationInput {
pub struct ChangeExternalCanisterOperationInput {
pub canister_id: Principal,
pub mode: CanisterInstallMode,
#[serde(with = "serde_bytes")]
pub module: Vec<u8>,
pub module_extra_chunks: Option<WasmModuleExtraChunks>,
#[serde(deserialize_with = "orbit_essentials::deserialize::deserialize_option_blob")]
pub arg: Option<Vec<u8>>,
}

#[storable]
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct ChangeExternalCanisterOperation {
#[serde(with = "serde_bytes")]
pub module_checksum: Vec<u8>,
#[serde(deserialize_with = "orbit_essentials::deserialize::deserialize_option_blob")]
pub arg_checksum: Option<Vec<u8>>,
pub input: ChangeExternalCanisterOperationInput,
}
Expand Down Expand Up @@ -761,6 +770,7 @@ impl ModelValidator<ValidationError> for CanisterMethod {
pub struct CallExternalCanisterOperationInput {
pub validation_method: Option<CanisterMethod>,
pub execution_method: CanisterMethod,
#[serde(deserialize_with = "orbit_essentials::deserialize::deserialize_option_blob")]
pub arg: Option<Vec<u8>>,
pub execution_method_cycles: Option<u64>,
}
Expand All @@ -769,22 +779,26 @@ pub struct CallExternalCanisterOperationInput {
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CallExternalCanisterOperation {
pub input: CallExternalCanisterOperationInput,
#[serde(deserialize_with = "orbit_essentials::deserialize::deserialize_option_blob")]
pub arg_checksum: Option<Vec<u8>>,
pub arg_rendering: Option<String>,
#[serde(deserialize_with = "orbit_essentials::deserialize::deserialize_option_blob")]
pub execution_method_reply: Option<Vec<u8>>,
}

#[storable]
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SnapshotExternalCanisterOperationInput {
pub canister_id: Principal,
#[serde(deserialize_with = "orbit_essentials::deserialize::deserialize_option_blob")]
pub replace_snapshot: Option<Vec<u8>>,
pub force: bool,
}

#[storable]
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SnapshotExternalCanisterOperation {
#[serde(deserialize_with = "orbit_essentials::deserialize::deserialize_option_blob")]
pub snapshot_id: Option<Vec<u8>>,
pub input: SnapshotExternalCanisterOperationInput,
}
Expand All @@ -793,6 +807,7 @@ pub struct SnapshotExternalCanisterOperation {
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct RestoreExternalCanisterOperationInput {
pub canister_id: Principal,
#[serde(with = "serde_bytes")]
pub snapshot_id: Vec<u8>,
}

Expand All @@ -805,6 +820,7 @@ pub struct RestoreExternalCanisterOperation {
#[storable]
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub enum PruneExternalCanisterResource {
#[serde(with = "serde_bytes")]
Snapshot(Vec<u8>),
ChunkStore,
State,
Expand Down
1 change: 1 addition & 0 deletions core/station/impl/src/models/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub struct SystemInfo {
/// The upgrader canister id that is allowed to upgrade this canister.
upgrader_canister_id: Option<Principal>,
/// The upgrader canister wasm module.
#[serde(deserialize_with = "orbit_essentials::deserialize::deserialize_option_blob")]
upgrader_wasm_module: Option<Vec<u8>>,
/// The disaster recovery committee user group id.
disaster_recovery_committee: Option<DisasterRecoveryCommittee>,
Expand Down
20 changes: 10 additions & 10 deletions core/upgrader/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub enum TriggerUpgradeError {
UnexpectedError(String),
}

#[derive(Clone, Debug, CandidType, Deserialize)]
#[derive(Clone, Debug, CandidType, Deserialize, PartialEq, Eq)]
pub struct AdminUser {
/// The user ID.
pub id: UuidDTO,
Expand All @@ -35,15 +35,15 @@ pub struct AdminUser {
pub identities: Vec<Principal>,
}

#[derive(Clone, Debug, CandidType, Deserialize)]
#[derive(Clone, Debug, CandidType, Deserialize, PartialEq, Eq)]
pub struct DisasterRecoveryCommittee {
/// The users that are able to request disaster recovery.
pub users: Vec<AdminUser>,
/// The quorum required to approve a disaster recovery request.
pub quorum: u16,
}

#[derive(Clone, Debug, CandidType, Deserialize)]
#[derive(Clone, Debug, CandidType, Deserialize, PartialEq, Eq)]
pub struct Account {
/// The account id, which is a UUID.
pub id: UuidDTO,
Expand Down Expand Up @@ -107,7 +107,7 @@ pub enum DisasterRecoveryError {
Unauthorized,
}

#[derive(Clone, Debug, CandidType)]
#[derive(Clone, Debug, CandidType, Deserialize)]
pub struct IsCommitteeMemberResponse {
pub is_committee_member: bool,
}
Expand Down Expand Up @@ -144,7 +144,7 @@ pub struct SetDisasterRecoveryAccountsAndAssetsInput {
pub assets: Vec<Asset>,
}

#[derive(Clone, Debug, CandidType, Deserialize)]
#[derive(Clone, Debug, CandidType, Deserialize, PartialEq, Eq)]
pub enum InstallMode {
/// Install the module.
Install,
Expand Down Expand Up @@ -176,7 +176,7 @@ pub struct GetLogsInput {
pub pagination: Option<PaginationInput>,
}

#[derive(Clone, Debug, CandidType, Deserialize)]
#[derive(Clone, Debug, CandidType, Deserialize, PartialEq, Eq)]
pub struct LogEntry {
pub time: TimestampRfc3339,
pub entry_type: String,
Expand All @@ -197,7 +197,7 @@ pub enum TriggerUpgradeResponse {
Err(TriggerUpgradeError),
}

#[derive(Clone, Debug, CandidType, Deserialize)]
#[derive(Clone, Debug, CandidType, Deserialize, PartialEq, Eq)]
pub struct StationRecoveryRequest {
/// The user ID of the station.
pub user_id: UuidDTO,
Expand All @@ -211,21 +211,21 @@ pub struct StationRecoveryRequest {
pub submitted_at: TimestampRfc3339,
}

#[derive(Clone, Debug, CandidType, Deserialize)]
#[derive(Clone, Debug, CandidType, Deserialize, PartialEq, Eq)]
pub enum RecoveryStatus {
/// There are no active recovery requests.
Idle,
/// There is a consensus on the recovery requests.
InProgress { since: TimestampRfc3339 },
}

#[derive(Clone, Debug, CandidType, Deserialize)]
#[derive(Clone, Debug, CandidType, Deserialize, PartialEq, Eq)]
pub struct RecoveryFailure {
/// The reason for the recovery failure.
pub reason: String,
}

#[derive(Clone, Debug, CandidType, Deserialize)]
#[derive(Clone, Debug, CandidType, Deserialize, PartialEq, Eq)]
pub enum RecoveryResult {
/// The recovery request was successful.
Success,
Expand Down
Loading

0 comments on commit e29355a

Please sign in to comment.