1pub const CANIC_COMMAND: &str = "canic_command";
6pub const CANIC_COORDINATOR_COMMAND: &str = "canic_coordinator_command";
7pub const CANIC_COORDINATOR_OPERATION_STATUS: &str = "canic_coordinator_operation_status";
8pub const CANIC_COORDINATOR_REGISTRY: &str = "canic_coordinator_registry";
9pub const CANIC_WASM_STORE_CATALOG: &str = "canic_wasm_store_catalog";
10pub const CANIC_ROOT_COMMAND: &str = "canic_root_command";
11pub const CANIC_ROOT_STATUS: &str = "canic_root_status";
12pub const CANIC_PUBLIC_STATUS: &str = "canic_public_status";
13pub const CANIC_OBSERVABILITY: &str = "canic_observability";
14pub const CANIC_AUTH_STATUS: &str = "canic_auth_status";
15pub const CANIC_CONTROL_STATUS: &str = "canic_control_status";
16pub const CANIC_ADMISSION_STATUS: &str = "canic_admission_status";
17pub const CANIC_ROOT_AUTH_STATUS: &str = "canic_root_auth_status";
18pub const CANIC_ROOT_OPERATION_STATUS: &str = "canic_root_operation_status";
19pub const CANIC_WASM_STORE_COMMAND: &str = "canic_wasm_store_command";
20pub const CANIC_WASM_STORE_STATUS: &str = "canic_wasm_store_status";
21
22#[must_use]
24pub fn command_endpoint_for_role(role: &crate::ids::CanisterRole) -> &'static str {
25 if role.is_fleet_coordinator() {
26 CANIC_COORDINATOR_COMMAND
27 } else if role.is_root() {
28 CANIC_ROOT_COMMAND
29 } else if role.is_wasm_store() {
30 CANIC_WASM_STORE_COMMAND
31 } else {
32 CANIC_COMMAND
33 }
34}
35
36pub const BLOB_STORAGE_BLOBS_ARE_LIVE: &str = "_immutableObjectStorageBlobsAreLive";
37pub const BLOB_STORAGE_BLOBS_TO_DELETE: &str = "_immutableObjectStorageBlobsToDelete";
38pub const BLOB_STORAGE_CONFIRM_BLOB_DELETION: &str = "_immutableObjectStorageConfirmBlobDeletion";
39pub const BLOB_STORAGE_CREATE_CERTIFICATE: &str = "_immutableObjectStorageCreateCertificate";
40pub const BLOB_STORAGE_UPDATE_GATEWAY_PRINCIPALS: &str =
41 "_immutableObjectStorageUpdateGatewayPrincipals";
42pub const BLOB_STORAGE_FUND_FROM_PROJECT_CYCLES: &str =
43 "_immutableObjectStorageFundFromProjectCycles";
44pub const BLOB_STORAGE_STATUS: &str = "get_blob_storage_status";
45pub const BLOB_STORAGE_CASHIER_ACCOUNT_BALANCE_GET_V1: &str = "account_balance_get_v1";
46pub const BLOB_STORAGE_CASHIER_ACCOUNT_TOP_UP_V1: &str = "account_top_up_v1";
47pub const BLOB_STORAGE_CASHIER_STORAGE_GATEWAY_PRINCIPAL_LIST_V1: &str =
48 "storage_gateway_principal_list_v1";
49
50pub const CASCADE_SNAPSHOT_MAX_BYTES: usize = 16_384;
52
53pub const BLOB_STORAGE_069_GATEWAY_METHODS: &[&str] = &[
54 BLOB_STORAGE_BLOBS_ARE_LIVE,
55 BLOB_STORAGE_BLOBS_TO_DELETE,
56 BLOB_STORAGE_CONFIRM_BLOB_DELETION,
57 BLOB_STORAGE_CREATE_CERTIFICATE,
58];
59
60pub const BLOB_STORAGE_070_GATEWAY_METHODS: &[&str] = &[
61 BLOB_STORAGE_UPDATE_GATEWAY_PRINCIPALS,
62 BLOB_STORAGE_FUND_FROM_PROJECT_CYCLES,
63];
64
65pub const BLOB_STORAGE_070_CASHIER_METHODS: &[&str] = &[
66 BLOB_STORAGE_CASHIER_ACCOUNT_BALANCE_GET_V1,
67 BLOB_STORAGE_CASHIER_ACCOUNT_TOP_UP_V1,
68 BLOB_STORAGE_CASHIER_STORAGE_GATEWAY_PRINCIPAL_LIST_V1,
69];
70
71#[cfg(test)]
72mod tests {
73 use super::{
74 CANIC_COMMAND, CANIC_COORDINATOR_COMMAND, CANIC_ROOT_COMMAND, CANIC_WASM_STORE_COMMAND,
75 command_endpoint_for_role,
76 };
77 use crate::ids::CanisterRole;
78 use std::collections::BTreeSet;
79
80 #[test]
81 fn built_in_roles_own_distinct_command_endpoints() {
82 let ordinary = CanisterRole::new("ordinary");
83 let roles = [
84 (&ordinary, CANIC_COMMAND),
85 (&CanisterRole::FLEET_COORDINATOR, CANIC_COORDINATOR_COMMAND),
86 (&CanisterRole::ROOT, CANIC_ROOT_COMMAND),
87 (&CanisterRole::WASM_STORE, CANIC_WASM_STORE_COMMAND),
88 ];
89 for (role, command) in roles {
90 assert_eq!(command_endpoint_for_role(role), command);
91 }
92 let commands = roles
93 .iter()
94 .map(|(_, command)| *command)
95 .collect::<BTreeSet<_>>();
96 assert_eq!(commands.len(), roles.len());
97 }
98}