Skip to content

Commit 9e0baf6

Browse files
committed
refactor(dmq): adapt consumer client with new 'DmqMsg' structure
Following the move of operational certificate and cold verification out of the signed payload.
1 parent 5047597 commit 9e0baf6

File tree

1 file changed

+25
-29
lines changed
  • internal/mithril-dmq/src/consumer/client

1 file changed

+25
-29
lines changed

internal/mithril-dmq/src/consumer/client/pallas.rs

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,8 @@ impl<M: TryFromBytes + Debug> DmqConsumerClientPallas<M> {
113113
.0
114114
.into_iter()
115115
.map(|dmq_message| {
116-
let opcert =
117-
OpCert::try_from_bytes(&dmq_message.msg_payload.operational_certificate)
118-
.with_context(|| "Failed to parse operational certificate")?;
116+
let opcert = OpCert::try_from_bytes(&dmq_message.operational_certificate)
117+
.with_context(|| "Failed to parse operational certificate")?;
119118
let party_id = opcert.compute_protocol_party_id()?;
120119
let payload = M::try_from_bytes(&dmq_message.msg_payload.msg_body)
121120
.with_context(|| "Failed to parse DMQ message body")?;
@@ -180,45 +179,42 @@ mod tests {
180179
msg_payload: DmqMsgPayload {
181180
msg_id: vec![0, 1],
182181
msg_body: DmqMessageTestPayload::new(b"msg_1").to_bytes_vec().unwrap(),
183-
184182
kes_period: 10,
185-
operational_certificate: vec![
186-
130, 132, 88, 32, 230, 80, 215, 83, 21, 9, 187, 108, 255, 215, 153, 140,
187-
40, 198, 142, 78, 200, 250, 98, 26, 9, 82, 32, 110, 161, 30, 176, 63, 205,
188-
125, 203, 41, 0, 0, 88, 64, 212, 171, 206, 39, 218, 5, 255, 3, 193, 52, 44,
189-
198, 171, 83, 19, 80, 114, 225, 186, 191, 156, 192, 84, 146, 245, 159, 31,
190-
240, 9, 247, 4, 87, 170, 168, 98, 199, 21, 139, 19, 190, 12, 251, 65, 215,
191-
169, 26, 86, 37, 137, 188, 17, 14, 178, 205, 175, 93, 39, 86, 4, 138, 187,
192-
234, 95, 5, 88, 32, 32, 253, 186, 201, 177, 11, 117, 135, 187, 167, 181,
193-
188, 22, 59, 206, 105, 231, 150, 215, 30, 78, 212, 76, 16, 252, 180, 72,
194-
134, 137, 247, 161, 68,
195-
],
196-
cold_verification_key: vec![0, 1, 2, 3, 4, 5],
197183
expires_at: 100,
198184
},
199185
kes_signature: vec![0, 1, 2, 3],
186+
operational_certificate: vec![
187+
130, 132, 88, 32, 230, 80, 215, 83, 21, 9, 187, 108, 255, 215, 153, 140, 40,
188+
198, 142, 78, 200, 250, 98, 26, 9, 82, 32, 110, 161, 30, 176, 63, 205, 125,
189+
203, 41, 0, 0, 88, 64, 212, 171, 206, 39, 218, 5, 255, 3, 193, 52, 44, 198,
190+
171, 83, 19, 80, 114, 225, 186, 191, 156, 192, 84, 146, 245, 159, 31, 240, 9,
191+
247, 4, 87, 170, 168, 98, 199, 21, 139, 19, 190, 12, 251, 65, 215, 169, 26, 86,
192+
37, 137, 188, 17, 14, 178, 205, 175, 93, 39, 86, 4, 138, 187, 234, 95, 5, 88,
193+
32, 32, 253, 186, 201, 177, 11, 117, 135, 187, 167, 181, 188, 22, 59, 206, 105,
194+
231, 150, 215, 30, 78, 212, 76, 16, 252, 180, 72, 134, 137, 247, 161, 68,
195+
],
196+
cold_verification_key: vec![0, 1, 2, 3, 4, 5],
200197
},
201198
DmqMsg {
202199
msg_payload: DmqMsgPayload {
203200
msg_id: vec![1, 2],
204201
msg_body: DmqMessageTestPayload::new(b"msg_2").to_bytes_vec().unwrap(),
205-
206202
kes_period: 11,
207-
operational_certificate: vec![
208-
130, 132, 88, 32, 230, 80, 215, 83, 21, 9, 187, 108, 255, 215, 153, 140,
209-
40, 198, 142, 78, 200, 250, 98, 26, 9, 82, 32, 110, 161, 30, 176, 63, 205,
210-
125, 203, 41, 0, 0, 88, 64, 132, 4, 199, 39, 190, 173, 88, 102, 121, 117,
211-
55, 62, 39, 189, 113, 96, 175, 24, 171, 240, 74, 42, 139, 202, 128, 185,
212-
44, 130, 209, 77, 191, 122, 196, 224, 33, 158, 187, 156, 203, 190, 173,
213-
150, 247, 87, 172, 58, 153, 185, 157, 87, 128, 14, 187, 107, 187, 215, 105,
214-
195, 107, 135, 172, 43, 173, 9, 88, 32, 77, 75, 24, 6, 47, 133, 2, 89, 141,
215-
224, 69, 202, 123, 105, 240, 103, 245, 159, 147, 177, 110, 58, 248, 115,
216-
58, 152, 138, 220, 35, 65, 245, 200,
217-
],
218-
cold_verification_key: vec![0, 1, 2, 3, 4, 5],
219203
expires_at: 101,
220204
},
221205
kes_signature: vec![1, 2, 3, 4],
206+
operational_certificate: vec![
207+
130, 132, 88, 32, 230, 80, 215, 83, 21, 9, 187, 108, 255, 215, 153, 140, 40,
208+
198, 142, 78, 200, 250, 98, 26, 9, 82, 32, 110, 161, 30, 176, 63, 205, 125,
209+
203, 41, 0, 0, 88, 64, 132, 4, 199, 39, 190, 173, 88, 102, 121, 117, 55, 62,
210+
39, 189, 113, 96, 175, 24, 171, 240, 74, 42, 139, 202, 128, 185, 44, 130, 209,
211+
77, 191, 122, 196, 224, 33, 158, 187, 156, 203, 190, 173, 150, 247, 87, 172,
212+
58, 153, 185, 157, 87, 128, 14, 187, 107, 187, 215, 105, 195, 107, 135, 172,
213+
43, 173, 9, 88, 32, 77, 75, 24, 6, 47, 133, 2, 89, 141, 224, 69, 202, 123, 105,
214+
240, 103, 245, 159, 147, 177, 110, 58, 248, 115, 58, 152, 138, 220, 35, 65,
215+
245, 200,
216+
],
217+
cold_verification_key: vec![0, 1, 2, 3, 4, 5],
222218
},
223219
]
224220
}

0 commit comments

Comments
 (0)