@@ -14,6 +14,9 @@ pub struct AggregatorStatusMessage {
14
14
/// Current Cardano era
15
15
pub cardano_era : CardanoEra ,
16
16
17
+ /// Cardano network
18
+ pub cardano_network : String ,
19
+
17
20
/// Current Mithril era
18
21
pub mithril_era : SupportedEra ,
19
22
@@ -57,6 +60,7 @@ mod tests {
57
60
const ACTUAL_JSON : & str = r#"{
58
61
"epoch": 48,
59
62
"cardano_era": "conway",
63
+ "cardano_network": "mainnet",
60
64
"mithril_era": "pythagoras",
61
65
"cardano_node_version": "1.2.3",
62
66
"aggregator_node_version": "4.5.6",
@@ -70,10 +74,56 @@ mod tests {
70
74
"total_cardano_stake": 888888888
71
75
}"# ;
72
76
77
+ #[ derive( Debug , Clone , Serialize , Deserialize , PartialEq ) ]
78
+ pub struct AggregatorStatusMessageUntilV0_1_37 {
79
+ pub epoch : Epoch ,
80
+ pub cardano_era : CardanoEra ,
81
+ pub mithril_era : SupportedEra ,
82
+ pub cardano_node_version : String ,
83
+ pub aggregator_node_version : String ,
84
+ #[ serde( rename = "protocol" ) ]
85
+ pub protocol_parameters : ProtocolParameters ,
86
+ #[ serde( rename = "next_protocol" ) ]
87
+ pub next_protocol_parameters : ProtocolParameters ,
88
+ pub total_signers : usize ,
89
+ pub total_next_signers : usize ,
90
+ pub total_stakes_signers : Stake ,
91
+ pub total_next_stakes_signers : Stake ,
92
+ pub total_cardano_spo : TotalSPOs ,
93
+ pub total_cardano_stake : Stake ,
94
+ }
95
+
96
+ fn golden_message_until_open_api_0_1_37 ( ) -> AggregatorStatusMessageUntilV0_1_37 {
97
+ AggregatorStatusMessageUntilV0_1_37 {
98
+ epoch : Epoch ( 48 ) ,
99
+ cardano_era : "conway" . to_string ( ) ,
100
+ mithril_era : SupportedEra :: Pythagoras ,
101
+ cardano_node_version : "1.2.3" . to_string ( ) ,
102
+ aggregator_node_version : "4.5.6" . to_string ( ) ,
103
+ protocol_parameters : ProtocolParameters {
104
+ k : 5 ,
105
+ m : 100 ,
106
+ phi_f : 0.65 ,
107
+ } ,
108
+ next_protocol_parameters : ProtocolParameters {
109
+ k : 50 ,
110
+ m : 1000 ,
111
+ phi_f : 0.65 ,
112
+ } ,
113
+ total_signers : 1234 ,
114
+ total_next_signers : 56789 ,
115
+ total_stakes_signers : 123456789 ,
116
+ total_next_stakes_signers : 987654321 ,
117
+ total_cardano_spo : 7777 ,
118
+ total_cardano_stake : 888888888 ,
119
+ }
120
+ }
121
+
73
122
fn golden_actual_message ( ) -> AggregatorStatusMessage {
74
123
AggregatorStatusMessage {
75
124
epoch : Epoch ( 48 ) ,
76
125
cardano_era : "conway" . to_string ( ) ,
126
+ cardano_network : "mainnet" . to_string ( ) ,
77
127
mithril_era : SupportedEra :: Pythagoras ,
78
128
cardano_node_version : "1.2.3" . to_string ( ) ,
79
129
aggregator_node_version : "4.5.6" . to_string ( ) ,
@@ -96,6 +146,14 @@ mod tests {
96
146
}
97
147
}
98
148
149
+ #[ test]
150
+ fn test_actual_json_deserialized_into_message_supported_until_open_api_0_1_37 ( ) {
151
+ let json = ACTUAL_JSON ;
152
+ let message: AggregatorStatusMessageUntilV0_1_37 = serde_json:: from_str ( json) . unwrap ( ) ;
153
+
154
+ assert_eq ! ( golden_message_until_open_api_0_1_37( ) , message) ;
155
+ }
156
+
99
157
// Test the compatibility with current structure.
100
158
#[ test]
101
159
fn test_actual_json_deserialized_into_actual_message ( ) {
0 commit comments