@@ -9,8 +9,11 @@ pub struct EpochSettingsMessage {
99 pub epoch : Epoch ,
1010
1111 /// Signer Registration Protocol parameters
12- #[ serde( rename = "signer_registration_protocol" ) ]
13- pub signer_registration_protocol_parameters : ProtocolParameters ,
12+ #[ serde(
13+ rename = "signer_registration_protocol" ,
14+ skip_serializing_if = "Option::is_none"
15+ ) ]
16+ pub signer_registration_protocol_parameters : Option < ProtocolParameters > ,
1417
1518 /// Current Signers
1619 pub current_signers : Vec < SignerMessagePart > ,
@@ -25,7 +28,6 @@ pub struct EpochSettingsMessage {
2528
2629#[ cfg( test) ]
2730mod tests {
28-
2931 use crate :: entities:: BlockNumber ;
3032
3133 use super :: * ;
@@ -56,21 +58,27 @@ mod tests {
5658 #[ derive( Debug , Serialize , Deserialize , PartialEq ) ]
5759 struct EpochSettingsMessageUntilV0_1_51 {
5860 pub epoch : Epoch ,
59-
6061 #[ serde( rename = "signer_registration_protocol" ) ]
6162 pub signer_registration_protocol_parameters : ProtocolParameters ,
62-
6363 pub current_signers : Vec < SignerMessagePart > ,
64-
6564 pub next_signers : Vec < SignerMessagePart > ,
66-
6765 #[ serde( skip_serializing_if = "Option::is_none" ) ]
6866 pub cardano_transactions_signing_config : Option < CardanoTransactionsSigningConfig > ,
69-
7067 #[ serde( skip_serializing_if = "Option::is_none" ) ]
7168 pub next_cardano_transactions_signing_config : Option < CardanoTransactionsSigningConfig > ,
7269 }
7370
71+ #[ derive( Clone , Debug , PartialEq , Serialize , Deserialize ) ]
72+ pub struct EpochSettingsMessageUntilV0_1_55 {
73+ pub epoch : Epoch ,
74+ #[ serde( rename = "signer_registration_protocol" ) ]
75+ pub signer_registration_protocol_parameters : ProtocolParameters ,
76+ pub current_signers : Vec < SignerMessagePart > ,
77+ pub next_signers : Vec < SignerMessagePart > ,
78+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
79+ pub cardano_transactions_signing_config : Option < CardanoTransactionsSigningConfig > ,
80+ }
81+
7482 fn golden_message_until_open_api_0_1_51 ( ) -> EpochSettingsMessageUntilV0_1_51 {
7583 EpochSettingsMessageUntilV0_1_51 {
7684 epoch : Epoch ( 10 ) ,
@@ -101,8 +109,8 @@ mod tests {
101109 }
102110 }
103111
104- fn golden_current_message ( ) -> EpochSettingsMessage {
105- EpochSettingsMessage {
112+ fn golden_message_until_open_api_0_1_55 ( ) -> EpochSettingsMessageUntilV0_1_55 {
113+ EpochSettingsMessageUntilV0_1_55 {
106114 epoch : Epoch ( 10 ) ,
107115 signer_registration_protocol_parameters : ProtocolParameters {
108116 k : 500 ,
@@ -130,6 +138,35 @@ mod tests {
130138 }
131139 }
132140
141+ fn golden_current_message ( ) -> EpochSettingsMessage {
142+ EpochSettingsMessage {
143+ epoch : Epoch ( 10 ) ,
144+ signer_registration_protocol_parameters : Some ( ProtocolParameters {
145+ k : 500 ,
146+ m : 10000 ,
147+ phi_f : 0.65 ,
148+ } ) ,
149+ current_signers : vec ! [ SignerMessagePart {
150+ party_id: "123" . to_string( ) ,
151+ verification_key: "key_123" . to_string( ) ,
152+ verification_key_signature: Some ( "signature_123" . to_string( ) ) ,
153+ operational_certificate: Some ( "certificate_123" . to_string( ) ) ,
154+ kes_period: Some ( 12 ) ,
155+ } ] ,
156+ next_signers : vec ! [ SignerMessagePart {
157+ party_id: "456" . to_string( ) ,
158+ verification_key: "key_456" . to_string( ) ,
159+ verification_key_signature: Some ( "signature_456" . to_string( ) ) ,
160+ operational_certificate: Some ( "certificate_456" . to_string( ) ) ,
161+ kes_period: Some ( 45 ) ,
162+ } ] ,
163+ cardano_transactions_signing_config : Some ( CardanoTransactionsSigningConfig {
164+ security_parameter : BlockNumber ( 70 ) ,
165+ step : BlockNumber ( 20 ) ,
166+ } ) ,
167+ }
168+ }
169+
133170 #[ test]
134171 fn test_current_json_deserialized_into_message_supported_until_open_api_0_1_51 ( ) {
135172 let json = CURRENT_JSON ;
@@ -138,6 +175,14 @@ mod tests {
138175 assert_eq ! ( golden_message_until_open_api_0_1_51( ) , message) ;
139176 }
140177
178+ #[ test]
179+ fn test_current_json_deserialized_into_message_supported_until_open_api_0_1_55 ( ) {
180+ let json = CURRENT_JSON ;
181+ let message: EpochSettingsMessageUntilV0_1_55 = serde_json:: from_str ( json) . unwrap ( ) ;
182+
183+ assert_eq ! ( golden_message_until_open_api_0_1_55( ) , message) ;
184+ }
185+
141186 #[ test]
142187 fn test_current_json_deserialized_into_current_message ( ) {
143188 let json = CURRENT_JSON ;
0 commit comments