@@ -2,6 +2,8 @@ use std::collections::BTreeSet;
22
33use serde:: { Deserialize , Serialize } ;
44
5+ use mithril_stm:: AggregateSignatureType ;
6+
57use crate :: entities:: SignedEntityTypeDiscriminants ;
68
79/// Message advertised by an Aggregator to inform about its features
@@ -23,6 +25,9 @@ pub struct AggregatorCapabilities {
2325 /// Signed entity types that are signed by the aggregator
2426 pub signed_entity_types : BTreeSet < SignedEntityTypeDiscriminants > ,
2527
28+ /// Aggregate signature type used by the aggregator
29+ pub aggregate_signature_type : AggregateSignatureType ,
30+
2631 /// Cardano transactions prover capabilities
2732 #[ serde( skip_serializing_if = "Option::is_none" ) ]
2833 pub cardano_transactions_prover : Option < CardanoTransactionsProverCapabilities > ,
@@ -73,6 +78,38 @@ mod tests {
7378 }
7479 }
7580
81+ #[ derive( Debug , Serialize , Deserialize , PartialEq ) ]
82+ struct AggregatorFeaturesMessageUntilV0_6_17 {
83+ pub open_api_version : String ,
84+ pub documentation_url : String ,
85+ pub capabilities : AggregatorCapabilitiesUntilV0_6_17 ,
86+ }
87+
88+ #[ derive( Debug , Serialize , Deserialize , PartialEq ) ]
89+ struct AggregatorCapabilitiesUntilV0_6_17 {
90+ pub signed_entity_types : BTreeSet < SignedEntityTypeDiscriminants > ,
91+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
92+ pub cardano_transactions_prover : Option < CardanoTransactionsProverCapabilities > ,
93+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
94+ pub cardano_transactions_signing_config : Option < CardanoTransactionsSigningConfig > ,
95+ }
96+
97+ fn golden_message_until_open_api_0_6_17 ( ) -> AggregatorFeaturesMessageUntilV0_6_17 {
98+ AggregatorFeaturesMessageUntilV0_6_17 {
99+ open_api_version : "0.0.1" . to_string ( ) ,
100+ documentation_url : "https://example.com" . to_string ( ) ,
101+ capabilities : AggregatorCapabilitiesUntilV0_6_17 {
102+ signed_entity_types : BTreeSet :: from ( [
103+ SignedEntityTypeDiscriminants :: CardanoTransactions ,
104+ ] ) ,
105+ cardano_transactions_prover : Some ( CardanoTransactionsProverCapabilities {
106+ max_hashes_allowed_by_request : 100 ,
107+ } ) ,
108+ cardano_transactions_signing_config : None ,
109+ } ,
110+ }
111+ }
112+
76113 fn golden_message_current ( ) -> AggregatorFeaturesMessage {
77114 AggregatorFeaturesMessage {
78115 open_api_version : "0.0.1" . to_string ( ) ,
@@ -81,6 +118,7 @@ mod tests {
81118 signed_entity_types : BTreeSet :: from ( [
82119 SignedEntityTypeDiscriminants :: CardanoTransactions ,
83120 ] ) ,
121+ aggregate_signature_type : AggregateSignatureType :: Concatenation ,
84122 cardano_transactions_prover : Some ( CardanoTransactionsProverCapabilities {
85123 max_hashes_allowed_by_request : 100 ,
86124 } ) ,
@@ -93,6 +131,7 @@ mod tests {
93131 "documentation_url": "https://example.com",
94132 "capabilities": {
95133 "signed_entity_types": ["CardanoTransactions"],
134+ "aggregate_signature_type": "Concatenation",
96135 "cardano_transactions_prover": {
97136 "max_hashes_allowed_by_request": 100
98137 }
@@ -107,6 +146,14 @@ mod tests {
107146 assert_eq ! ( golden_message_until_open_api_0_1_45( ) , message) ;
108147 }
109148
149+ #[ test]
150+ fn test_current_json_deserialized_into_message_supported_until_open_api_0_6_17 ( ) {
151+ let json = CURRENT_JSON ;
152+ let message: AggregatorFeaturesMessageUntilV0_6_17 = serde_json:: from_str ( json) . unwrap ( ) ;
153+
154+ assert_eq ! ( golden_message_until_open_api_0_6_17( ) , message) ;
155+ }
156+
110157 #[ test]
111158 fn test_current_json_deserialized_into_current_message ( ) {
112159 let json = CURRENT_JSON ;
0 commit comments