@@ -18,6 +18,9 @@ const ENTITY_TYPE_CARDANO_STAKE_DISTRIBUTION: usize = 1;
18
18
/// Database representation of the SignedEntityType::CardanoImmutableFilesFull value
19
19
const ENTITY_TYPE_CARDANO_IMMUTABLE_FILES_FULL : usize = 2 ;
20
20
21
+ /// Database representation of the SignedEntityType::CardanoTransactions value
22
+ const ENTITY_TYPE_CARDANO_TRANSACTIONS : usize = 3 ;
23
+
21
24
/// The signed entity type that represents a type of data signed by the Mithril
22
25
/// protocol Note: Each variant of this enum must be associated to an entry in
23
26
/// the `signed_entity_type` table of the signer/aggregator nodes. The variant
@@ -36,6 +39,9 @@ pub enum SignedEntityType {
36
39
37
40
/// Full Cardano Immutable Files
38
41
CardanoImmutableFilesFull ( Beacon ) ,
42
+
43
+ /// Cardano Transactions
44
+ CardanoTransactions ( Beacon ) ,
39
45
}
40
46
41
47
impl SignedEntityType {
@@ -47,7 +53,7 @@ impl SignedEntityType {
47
53
/// Return the epoch from the intern beacon.
48
54
pub fn get_epoch ( & self ) -> Epoch {
49
55
match self {
50
- Self :: CardanoImmutableFilesFull ( b) => b. epoch ,
56
+ Self :: CardanoImmutableFilesFull ( b) | Self :: CardanoTransactions ( b ) => b. epoch ,
51
57
Self :: CardanoStakeDistribution ( e) | Self :: MithrilStakeDistribution ( e) => * e,
52
58
}
53
59
}
@@ -80,6 +86,14 @@ impl SignedEntityType {
80
86
} ) ?;
81
87
Self :: CardanoImmutableFilesFull ( beacon)
82
88
}
89
+ ENTITY_TYPE_CARDANO_TRANSACTIONS => {
90
+ let beacon: Beacon = serde_json:: from_str( beacon_str) . map_err( |e| {
91
+ HydrationError :: InvalidData ( format!(
92
+ "Invalid Beacon JSON in open_message.beacon: '{beacon_str}'. Error: {e}"
93
+ ) )
94
+ } ) ?;
95
+ Self :: CardanoTransactions ( beacon)
96
+ }
83
97
index => panic!( "Invalid entity_type_id {index}." ) ,
84
98
} ;
85
99
@@ -93,13 +107,16 @@ impl SignedEntityType {
93
107
Self :: MithrilStakeDistribution ( _) => ENTITY_TYPE_MITHRIL_STAKE_DISTRIBUTION ,
94
108
Self :: CardanoStakeDistribution ( _) => ENTITY_TYPE_CARDANO_STAKE_DISTRIBUTION ,
95
109
Self :: CardanoImmutableFilesFull ( _) => ENTITY_TYPE_CARDANO_IMMUTABLE_FILES_FULL ,
110
+ Self :: CardanoTransactions ( _) => ENTITY_TYPE_CARDANO_TRANSACTIONS ,
96
111
}
97
112
}
98
113
99
114
/// Return a JSON serialized value of the internal beacon
100
115
pub fn get_json_beacon ( & self ) -> StdResult < String > {
101
116
let value = match self {
102
- Self :: CardanoImmutableFilesFull ( value) => serde_json:: to_string ( value) ?,
117
+ Self :: CardanoImmutableFilesFull ( value) | Self :: CardanoTransactions ( value) => {
118
+ serde_json:: to_string ( value) ?
119
+ }
103
120
Self :: CardanoStakeDistribution ( value) | Self :: MithrilStakeDistribution ( value) => {
104
121
serde_json:: to_string ( value) ?
105
122
}
@@ -112,7 +129,9 @@ impl SignedEntityType {
112
129
pub fn get_open_message_timeout ( & self ) -> Option < Duration > {
113
130
match self {
114
131
Self :: MithrilStakeDistribution ( _) | Self :: CardanoImmutableFilesFull ( _) => None ,
115
- Self :: CardanoStakeDistribution ( _) => Some ( Duration :: from_secs ( 600 ) ) ,
132
+ Self :: CardanoStakeDistribution ( _) | Self :: CardanoTransactions ( _) => {
133
+ Some ( Duration :: from_secs ( 600 ) )
134
+ }
116
135
}
117
136
}
118
137
@@ -128,6 +147,9 @@ impl SignedEntityType {
128
147
SignedEntityTypeDiscriminants :: CardanoImmutableFilesFull => {
129
148
Self :: CardanoImmutableFilesFull ( beacon. to_owned ( ) )
130
149
}
150
+ SignedEntityTypeDiscriminants :: CardanoTransactions => {
151
+ Self :: CardanoTransactions ( beacon. to_owned ( ) )
152
+ }
131
153
}
132
154
}
133
155
}
@@ -139,6 +161,7 @@ impl SignedEntityTypeDiscriminants {
139
161
Self :: MithrilStakeDistribution => ENTITY_TYPE_MITHRIL_STAKE_DISTRIBUTION ,
140
162
Self :: CardanoStakeDistribution => ENTITY_TYPE_CARDANO_STAKE_DISTRIBUTION ,
141
163
Self :: CardanoImmutableFilesFull => ENTITY_TYPE_CARDANO_IMMUTABLE_FILES_FULL ,
164
+ Self :: CardanoTransactions => ENTITY_TYPE_CARDANO_TRANSACTIONS ,
142
165
}
143
166
}
144
167
}
0 commit comments