canic_core/dto/root_store/
mod.rs1use crate::dto::fixture_provisioning::FixtureDescriptor;
4use crate::ids::{
5 CanisterRole, ComponentSpecId, ComponentTopologyDigest, FleetSubnetRootReleaseSet,
6 ReleaseBuildId,
7};
8use crate::role_contract::ProtocolProfileDigest;
9use candid::{CandidType, Principal};
10use serde::{Deserialize, Serialize};
11
12pub const ROOT_STORE_RELEASE_SET_MANIFEST_MAX_BYTES: u64 = 16 * 1_024 * 1_024;
14pub const ROOT_STORE_RELEASE_SET_TEMPLATE_PREFIX: &str = "root-release-set:";
16pub const ROOT_STORE_ARTIFACT_TEMPLATE_PREFIX: &str = "component:";
18
19#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
26#[serde(deny_unknown_fields)]
27pub struct RootStoreArtifact {
28 pub role: CanisterRole,
29 pub package: String,
30 pub release_build_id: ReleaseBuildId,
31 pub wasm_relative_path: String,
32 pub wasm_size_bytes: u64,
33 pub wasm_sha256_hex: String,
34 pub wasm_gz_relative_path: String,
35 pub wasm_gz_size_bytes: u64,
36 pub wasm_gz_sha256_hex: String,
37 pub candid_sha256: [u8; 32],
38 pub protocol_profile_digest: ProtocolProfileDigest,
39}
40
41#[derive(
48 CandidType, Clone, Copy, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize,
49)]
50pub enum RootStoreReleaseSetEntryKind {
51 #[serde(rename = "component")]
52 Component,
53
54 #[serde(rename = "component_child")]
55 ComponentChild,
56}
57
58#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
65#[serde(deny_unknown_fields)]
66pub struct RootStoreReleaseSetEntry {
67 pub component_spec: ComponentSpecId,
68 pub kind: RootStoreReleaseSetEntryKind,
69 pub artifact: RootStoreArtifact,
70}
71
72#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
78#[serde(deny_unknown_fields)]
79pub struct RootStoreFixture {
80 pub role: CanisterRole,
81 pub content_id: [u8; 32],
82 pub descriptor: FixtureDescriptor,
83}
84
85#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
92#[serde(deny_unknown_fields)]
93pub struct RootStoreReleaseSetManifest {
94 pub release_build_id: ReleaseBuildId,
95 pub component_topology_digest: ComponentTopologyDigest,
96 pub entries: Vec<RootStoreReleaseSetEntry>,
97 pub fixtures: Vec<RootStoreFixture>,
98}
99
100#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
107pub struct RootStoreBootstrapRequest {
108 pub operation_id: [u8; 32],
109 pub manifest_payload_size_bytes: u64,
110}
111
112#[derive(CandidType, Clone, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)]
119pub struct RootStoreCatalogEntry {
120 pub role: CanisterRole,
121 pub raw_module_hash: [u8; 32],
123 pub candid_sha256: [u8; 32],
125 pub protocol_profile_digest: ProtocolProfileDigest,
127 pub payload_hash: [u8; 32],
129 pub payload_size_bytes: u64,
130}
131
132#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
139pub struct RootStoreBootstrapResponse {
140 pub fleet_subnet_root: Principal,
141 pub wasm_store: Principal,
142 pub release_set: FleetSubnetRootReleaseSet,
143 pub catalog: Vec<RootStoreCatalogEntry>,
144 pub fixtures: Vec<RootStoreFixture>,
145}
146
147#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
153#[serde(deny_unknown_fields)]
154pub struct RootStoreFixturePrepareRequest {
155 pub bootstrap: RootStoreBootstrapRequest,
156 pub role: CanisterRole,
157}