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