File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
mithril-common/src/messages Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -50,3 +50,42 @@ pub struct CardanoTransactionsProverCapabilities {
50
50
/// Maximum number of hashes allowed for a single request
51
51
pub max_hashes_allowed_by_request : usize ,
52
52
}
53
+
54
+ #[ cfg( test) ]
55
+ mod tests {
56
+ use super :: * ;
57
+
58
+ fn golden_message ( ) -> AggregatorFeaturesMessage {
59
+ AggregatorFeaturesMessage {
60
+ open_api_version : "0.0.1" . to_string ( ) ,
61
+ documentation_url : "https://example.com" . to_string ( ) ,
62
+ capabilities : AggregatorCapabilities {
63
+ signed_entity_types : BTreeSet :: from ( [
64
+ SignedEntityTypeDiscriminants :: CardanoTransactions ,
65
+ ] ) ,
66
+ cardano_transactions_prover : Some ( CardanoTransactionsProverCapabilities {
67
+ max_hashes_allowed_by_request : 100 ,
68
+ } ) ,
69
+ } ,
70
+ }
71
+ }
72
+
73
+ // Test the retro compatibility with possible future upgrades.
74
+ #[ test]
75
+ fn test_v1 ( ) {
76
+ let json = r#"{
77
+ "open_api_version": "0.0.1",
78
+ "documentation_url": "https://example.com",
79
+ "capabilities": {
80
+ "signed_entity_types": ["CardanoTransactions"],
81
+ "cardano_transactions_prover": {
82
+ "max_hashes_allowed_by_request": 100
83
+ }
84
+ }
85
+ }"# ;
86
+
87
+ let message: AggregatorFeaturesMessage = serde_json:: from_str ( json) . unwrap ( ) ;
88
+
89
+ assert_eq ! ( golden_message( ) , message) ;
90
+ }
91
+ }
You can’t perform that action at this time.
0 commit comments