Skip to content

Commit 5de155b

Browse files
committed
Add fake keys for operational certificates & factorize usages
1 parent b7a59d2 commit 5de155b

File tree

4 files changed

+35
-7
lines changed

4 files changed

+35
-7
lines changed

mithril-common/src/messages/certificate_pending.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,10 @@ impl SignerMessage {
9494
Self {
9595
party_id: "pool1m8crhnqj5k2kyszf5j2scshupystyxc887zdfrpzh6ty6eun4fx".to_string(),
9696
verification_key: fake_keys::signer_verification_key()[0].to_string(),
97-
verification_key_signature: Some(fake_keys::signer_verification_key_signature()[0].to_string()),
98-
operational_certificate: Some("5b5b5b3230332c3130392c34302c32382c3235312c39342c35322c32342c3231322c3131362c3134392c38302c3138332c3136322c312c36322c352c3133332c35372c3230342c31352c3137322c3134372c38362c3132352c35392c31322c3235332c3130312c3138342c32332c31355d2c322c3132382c5b3133382c3131302c3139322c35302c38362c332c3136382c33342c3137322c31392c39312c3133392c3139302c3134302c31382c3137372c33312c34362c3132322c3130362c3233342c3137372c3130382c3232352c3230372c342c302c35392c3233372c3133352c3130342c39382c3133332c3133312c32392c3231322c3137312c3139342c3234342c3139312c3137392c3131392c34322c37352c3135302c36312c3232362c3132312c35342c3232332c3139332c3133382c3139302c32372c3138322c3135322c35362c32312c3136302c3230372c33352c3233372c3130322c31325d5d2c5b3230372c31322c3136382c3139302c34362c3131362c3139362c3133332c3139362c3233312c3132342c3235302c3134372c33372c3137352c3231312c3234372c3139382c3134302c3133392c3234362c3130342c3132342c3232372c34392c352c3235332c3232382c3130372c39332c3133362c3134345d5d".to_string()),
97+
verification_key_signature: Some(
98+
fake_keys::signer_verification_key_signature()[0].to_string(),
99+
),
100+
operational_certificate: Some(fake_keys::operational_certificate()[0].to_string()),
99101
kes_period: Some(6),
100102
}
101103
}

mithril-common/src/messages/message_parts/signer.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@ impl SignerWithStakeMessagePart {
4949
Self {
5050
party_id: "pool1m8crhnqj5k2kyszf5j2scshupystyxc887zdfrpzh6ty6eun4fx".to_string(),
5151
verification_key: fake_keys::signer_verification_key()[0].to_string(),
52-
verification_key_signature: Some(fake_keys::signer_verification_key_signature()[0].to_string()),
53-
operational_certificate: Some("5b5b5b3230332c3130392c34302c32382c3235312c39342c35322c32342c3231322c3131362c3134392c38302c3138332c3136322c312c36322c352c3133332c35372c3230342c31352c3137322c3134372c38362c3132352c35392c31322c3235332c3130312c3138342c32332c31355d2c322c3132382c5b3133382c3131302c3139322c35302c38362c332c3136382c33342c3137322c31392c39312c3133392c3139302c3134302c31382c3137372c33312c34362c3132322c3130362c3233342c3137372c3130382c3232352c3230372c342c302c35392c3233372c3133352c3130342c39382c3133332c3133312c32392c3231322c3137312c3139342c3234342c3139312c3137392c3131392c34322c37352c3135302c36312c3232362c3132312c35342c3232332c3139332c3133382c3139302c32372c3138322c3135322c35362c32312c3136302c3230372c33352c3233372c3130322c31325d5d2c5b3230372c31322c3136382c3139302c34362c3131362c3139362c3133332c3139362c3233312c3132342c3235302c3134372c33372c3137352c3231312c3234372c3139382c3134302c3133392c3234362c3130342c3132342c3232372c34392c352c3235332c3232382c3130372c39332c3133362c3134345d5d".to_string()),
52+
verification_key_signature: Some(
53+
fake_keys::signer_verification_key_signature()[0].to_string(),
54+
),
55+
operational_certificate: Some(fake_keys::operational_certificate()[0].to_string()),
5456
kes_period: Some(6),
5557
stake: 234,
5658
}

mithril-common/src/messages/register_signer.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ impl RegisterSignerMessage {
5252
epoch: Some(Epoch(1)),
5353
party_id: "pool1m8crhnqj5k2kyszf5j2scshupystyxc887zdfrpzh6ty6eun4fx".to_string(),
5454
verification_key: fake_keys::signer_verification_key()[0].to_string(),
55-
verification_key_signature: Some(fake_keys::signer_verification_key_signature()[0].to_string()),
56-
operational_certificate: Some("5b5b5b3230332c3130392c34302c32382c3235312c39342c35322c32342c3231322c3131362c3134392c38302c3138332c3136322c312c36322c352c3133332c35372c3230342c31352c3137322c3134372c38362c3132352c35392c31322c3235332c3130312c3138342c32332c31355d2c322c3132382c5b3133382c3131302c3139322c35302c38362c332c3136382c33342c3137322c31392c39312c3133392c3139302c3134302c31382c3137372c33312c34362c3132322c3130362c3233342c3137372c3130382c3232352c3230372c342c302c35392c3233372c3133352c3130342c39382c3133332c3133312c32392c3231322c3137312c3139342c3234342c3139312c3137392c3131392c34322c37352c3135302c36312c3232362c3132312c35342c3232332c3139332c3133382c3139302c32372c3138322c3135322c35362c32312c3136302c3230372c33352c3233372c3130322c31325d5d2c5b3230372c31322c3136382c3139302c34362c3131362c3139362c3133332c3139362c3233312c3132342c3235302c3134372c33372c3137352c3231312c3234372c3139382c3134302c3133392c3234362c3130342c3132342c3232372c34392c352c3235332c3232382c3130372c39332c3133362c3134345d5d".to_string()),
55+
verification_key_signature: Some(
56+
fake_keys::signer_verification_key_signature()[0].to_string(),
57+
),
58+
operational_certificate: Some(fake_keys::operational_certificate()[0].to_string()),
5759
kes_period: Some(6),
5860
}
5961
}

mithril-common/src/test_utils/fake_keys.rs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,23 @@ pub const fn signer_verification_key_signature<'a>() -> [&'a str; 1] {
168168
]
169169
}
170170

171+
/// A list of pre json hex encoded [OpCert][crate::crypto_helper::OpCert]
172+
pub const fn operational_certificate<'a>() -> [&'a str; 1] {
173+
[
174+
"5b5b5b3230332c3130392c34302c32382c3235312c39342c35322c32342c3231322c3131362c3134392c38302c\
175+
3138332c3136322c312c36322c352c3133332c35372c3230342c31352c3137322c3134372c38362c3132352c353\
176+
92c31322c3235332c3130312c3138342c32332c31355d2c322c3132382c5b3133382c3131302c3139322c35302c\
177+
38362c332c3136382c33342c3137322c31392c39312c3133392c3139302c3134302c31382c3137372c33312c343\
178+
62c3132322c3130362c3233342c3137372c3130382c3232352c3230372c342c302c35392c3233372c3133352c31\
179+
30342c39382c3133332c3133312c32392c3231322c3137312c3139342c3234342c3139312c3137392c3131392c3\
180+
4322c37352c3135302c36312c3232362c3132312c35342c3232332c3139332c3133382c3139302c32372c313832\
181+
2c3135322c35362c32312c3136302c3230372c33352c3233372c3130322c31325d5d2c5b3230372c31322c31363\
182+
82c3139302c34362c3131362c3139362c3133332c3139362c3233312c3132342c3235302c3134372c33372c3137\
183+
352c3231312c3234372c3139382c3134302c3133392c3234362c3130342c3132342c3232372c34392c352c32353\
184+
32c3232382c3130372c39332c3133362c3134345d5d",
185+
]
186+
}
187+
171188
#[cfg(test)]
172189
mod test {
173190
use super::*;
@@ -176,7 +193,7 @@ mod test {
176193
use serde::{de::DeserializeOwned, Serialize};
177194
use std::any::type_name;
178195

179-
use crate::crypto_helper::key_decode_hex;
196+
use crate::crypto_helper::{key_decode_hex, OpCert};
180197

181198
fn assert_encoded_are_still_matching_concrete_type<T: Serialize + DeserializeOwned>(
182199
encoded_types: &[&str],
@@ -223,4 +240,9 @@ mod test {
223240
&signer_verification_key_signature(),
224241
);
225242
}
243+
244+
#[test]
245+
fn assert_encoded_operational_certificate_are_still_matching_concrete_type() {
246+
assert_encoded_are_still_matching_concrete_type::<OpCert>(&operational_certificate());
247+
}
226248
}

0 commit comments

Comments
 (0)