canic_core/dto/root_store/
mod.rs1use crate::ids::{
4 CanisterRole, ComponentSpecId, ComponentTopologyDigest, FleetSubnetRootReleaseSet,
5 ReleaseBuildId,
6};
7use crate::role_contract::ProtocolProfileDigest;
8use candid::{CandidType, Principal};
9use serde::{Deserialize, Serialize};
10
11pub const ROOT_STORE_RELEASE_SET_MANIFEST_MAX_BYTES: u64 = 16 * 1_024 * 1_024;
13pub const ROOT_STORE_RELEASE_SET_TEMPLATE_PREFIX: &str = "root-release-set:";
15pub const ROOT_STORE_ARTIFACT_TEMPLATE_PREFIX: &str = "component:";
17
18#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
25#[serde(deny_unknown_fields)]
26pub struct RootStoreArtifact {
27 pub role: CanisterRole,
28 pub package: String,
29 pub release_build_id: ReleaseBuildId,
30 pub wasm_relative_path: String,
31 pub wasm_size_bytes: u64,
32 pub wasm_sha256_hex: String,
33 pub wasm_gz_relative_path: String,
34 pub wasm_gz_size_bytes: u64,
35 pub wasm_gz_sha256_hex: String,
36 pub candid_sha256: [u8; 32],
37 pub protocol_profile_digest: ProtocolProfileDigest,
38}
39
40#[derive(
47 CandidType, Clone, Copy, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize,
48)]
49pub enum RootStoreReleaseSetEntryKind {
50 #[serde(rename = "component")]
51 Component,
52
53 #[serde(rename = "component_child")]
54 ComponentChild,
55}
56
57#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
64#[serde(deny_unknown_fields)]
65pub struct RootStoreReleaseSetEntry {
66 pub component_spec: ComponentSpecId,
67 pub kind: RootStoreReleaseSetEntryKind,
68 pub artifact: RootStoreArtifact,
69}
70
71#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
78#[serde(deny_unknown_fields)]
79pub struct RootStoreReleaseSetManifest {
80 pub release_build_id: ReleaseBuildId,
81 pub component_topology_digest: ComponentTopologyDigest,
82 pub entries: Vec<RootStoreReleaseSetEntry>,
83}
84
85#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
92pub struct RootStoreBootstrapRequest {
93 pub operation_id: [u8; 32],
94 pub manifest_payload_size_bytes: u64,
95}
96
97#[derive(CandidType, Clone, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)]
104pub struct RootStoreCatalogEntry {
105 pub role: CanisterRole,
106 pub raw_module_hash: [u8; 32],
108 pub candid_sha256: [u8; 32],
110 pub protocol_profile_digest: ProtocolProfileDigest,
112 pub payload_hash: [u8; 32],
114 pub payload_size_bytes: u64,
115}
116
117#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
124pub struct RootStoreBootstrapResponse {
125 pub fleet_subnet_root: Principal,
126 pub wasm_store: Principal,
127 pub release_set: FleetSubnetRootReleaseSet,
128 pub catalog: Vec<RootStoreCatalogEntry>,
129}