ic_query/sns/report/model/reports/upgrade.rs
1//! Module: sns::report::model::reports::upgrade
2//!
3//! Responsibility: bounded native SNS upgrade report DTOs.
4//! Does not own: Governance or SNS-W calls, source validation, lookup, or rendering.
5//! Boundary: preserves native deployed, pending, and next blessed SNS versions.
6
7use super::invocation::SnsCanisterMethod;
8use serde::{Deserialize as SerdeDeserialize, Serialize};
9
10///
11/// SnsVersion
12///
13/// Native six-role SNS Wasm version represented as lowercase hexadecimal hashes.
14///
15
16#[derive(Clone, Debug, Eq, PartialEq, SerdeDeserialize, Serialize)]
17#[serde(deny_unknown_fields)]
18pub struct SnsVersion {
19 /// Archive Wasm hash.
20 pub archive_wasm_hash_hex: String,
21 /// Root Wasm hash.
22 pub root_wasm_hash_hex: String,
23 /// Swap Wasm hash.
24 pub swap_wasm_hash_hex: String,
25 /// Ledger Wasm hash.
26 pub ledger_wasm_hash_hex: String,
27 /// Governance Wasm hash.
28 pub governance_wasm_hash_hex: String,
29 /// Ledger index Wasm hash.
30 pub index_wasm_hash_hex: String,
31}
32
33///
34/// SnsPendingUpgrade
35///
36/// Native pending-upgrade state reported by SNS Governance.
37///
38
39#[derive(Clone, Debug, Eq, PartialEq, SerdeDeserialize, Serialize)]
40#[serde(deny_unknown_fields)]
41pub struct SnsPendingUpgrade {
42 /// Native deadline after which Governance may mark the upgrade failed.
43 pub mark_failed_at_seconds: u64,
44 /// Native Governance upgrade-lock checking value.
45 pub checking_upgrade_lock: u64,
46 /// NNS proposal that initiated the pending upgrade.
47 pub proposal_id: u64,
48 /// Pending target version, when Governance returned it.
49 pub target_version: Option<SnsVersion>,
50}
51
52///
53/// SnsRunningVersionResponse
54///
55/// Complete native Governance running-version response retained for bracketing.
56///
57
58#[derive(Clone, Debug, Eq, PartialEq, SerdeDeserialize, Serialize)]
59#[serde(deny_unknown_fields)]
60pub struct SnsRunningVersionResponse {
61 /// Currently deployed six-role version when Governance supplied it.
62 pub deployed_version: Option<SnsVersion>,
63 /// Pending Governance upgrade state when present.
64 pub pending_version: Option<SnsPendingUpgrade>,
65}
66
67///
68/// SnsUpgradeQueryGap
69///
70/// Failed next-version query retained after deployed-version collection succeeded.
71///
72
73#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
74pub struct SnsUpgradeQueryGap {
75 /// Native SNS-W method that failed.
76 pub method: SnsCanisterMethod,
77 /// Transport, encoding, or decoding failure retained for diagnostics.
78 pub reason: String,
79}
80
81///
82/// SnsUpgradeReport
83///
84/// Bounded live report of one SNS deployed, pending, and next blessed version.
85///
86
87#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
88pub struct SnsUpgradeReport {
89 /// Report schema version.
90 pub schema_version: u32,
91 /// Requested IC network identity.
92 pub network: String,
93 /// Mainnet SNS-W canister used for discovery and next-version lookup.
94 pub sns_wasm_canister_id: String,
95 /// Collection timestamp in UTC.
96 pub fetched_at: String,
97 /// IC API endpoint used for all calls.
98 pub source_endpoint: String,
99 /// Collector identity recorded by the source request.
100 pub fetched_by: String,
101 /// SNS-W list id assigned to this deployed SNS.
102 pub id: usize,
103 /// SNS name resolved during discovery.
104 pub name: String,
105 /// Root canister identity used to resolve this SNS.
106 pub root_canister_id: String,
107 /// Governance canister queried for deployed and pending versions.
108 pub governance_canister_id: String,
109 /// Native Governance running-version method.
110 pub running_version_method: SnsCanisterMethod,
111 /// Native SNS-W next-version method.
112 pub next_version_method: SnsCanisterMethod,
113 /// Whether both component responses represent one authoritative point in time.
114 pub point_in_time_guaranteed: bool,
115 /// Fixed number of bounded upgrade component queries attempted.
116 pub component_query_count: usize,
117 /// Number of component queries that returned successfully.
118 pub successful_component_query_count: usize,
119 /// Number of retained next-version query gaps.
120 pub component_gap_count: usize,
121 /// Governance-reported deployed SNS version.
122 pub deployed_version: SnsVersion,
123 /// Governance-reported pending upgrade, when present.
124 pub pending_upgrade: Option<SnsPendingUpgrade>,
125 /// Next blessed SNS-W version, or `None` when no successor exists.
126 pub next_version: Option<SnsVersion>,
127 /// Failed next-version query, distinct from a successful response with no successor.
128 pub next_version_gap: Option<SnsUpgradeQueryGap>,
129}