1
1
use serde:: { Deserialize , Serialize } ;
2
2
3
- use crate :: {
4
- crypto_helper:: KESPeriod ,
5
- entities:: {
6
- Beacon , HexEncodedOpCert , HexEncodedVerificationKey , HexEncodedVerificationKeySignature ,
7
- PartyId , ProtocolParameters , SignedEntityType ,
8
- } ,
9
- test_utils:: fake_keys,
10
- } ;
3
+ use crate :: entities:: { Beacon , ProtocolParameters , SignedEntityType } ;
4
+ use crate :: messages:: SignerMessagePart ;
11
5
12
6
/// Structure to transport [crate::entities::CertificatePending] data.
13
7
#[ derive( Clone , Debug , PartialEq , Serialize , Deserialize ) ]
@@ -28,10 +22,10 @@ pub struct CertificatePendingMessage {
28
22
pub next_protocol_parameters : ProtocolParameters ,
29
23
30
24
/// Current Signers
31
- pub signers : Vec < SignerMessage > ,
25
+ pub signers : Vec < SignerMessagePart > ,
32
26
33
27
/// Signers that will be able to sign on the next epoch
34
- pub next_signers : Vec < SignerMessage > ,
28
+ pub next_signers : Vec < SignerMessagePart > ,
35
29
}
36
30
37
31
impl CertificatePendingMessage {
@@ -50,55 +44,8 @@ impl CertificatePendingMessage {
50
44
m : 1000 ,
51
45
phi_f : 0.65 ,
52
46
} ,
53
- signers : [ SignerMessage :: dummy ( ) ] . to_vec ( ) ,
54
- next_signers : [ SignerMessage :: dummy ( ) ] . to_vec ( ) ,
55
- }
56
- }
57
- }
58
-
59
- // todo: move to message_parts
60
- /// Signer Message
61
- #[ derive( Clone , Debug , PartialEq , Eq , Default , Serialize , Deserialize ) ]
62
- pub struct SignerMessage {
63
- /// The unique identifier of the signer
64
- // TODO: Should be removed once the signer certification is fully deployed
65
- pub party_id : PartyId ,
66
-
67
- /// The public key used to authenticate signer signature
68
- pub verification_key : HexEncodedVerificationKey ,
69
-
70
- /// The encoded signer 'Mithril verification key' signature (signed by the
71
- /// Cardano node KES secret key).
72
- // TODO: Option should be removed once the signer certification is fully
73
- // deployed.
74
- #[ serde( skip_serializing_if = "Option::is_none" ) ]
75
- pub verification_key_signature : Option < HexEncodedVerificationKeySignature > ,
76
-
77
- /// The encoded operational certificate of stake pool operator attached to
78
- /// the signer node.
79
- // TODO: Option should be removed once the signer certification is fully
80
- // deployed.
81
- #[ serde( skip_serializing_if = "Option::is_none" ) ]
82
- pub operational_certificate : Option < HexEncodedOpCert > ,
83
-
84
- /// The KES period used to compute the verification key signature
85
- // TODO: This KES period should not be used as is and should probably be
86
- // within an allowed range of KES periods for the epoch.
87
- #[ serde( skip_serializing_if = "Option::is_none" ) ]
88
- pub kes_period : Option < KESPeriod > ,
89
- }
90
-
91
- impl SignerMessage {
92
- /// Return a dummy test entity (test-only).
93
- pub fn dummy ( ) -> Self {
94
- Self {
95
- party_id : "pool1m8crhnqj5k2kyszf5j2scshupystyxc887zdfrpzh6ty6eun4fx" . to_string ( ) ,
96
- verification_key : fake_keys:: signer_verification_key ( ) [ 0 ] . 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 ( ) ) ,
101
- kes_period : Some ( 6 ) ,
47
+ signers : [ SignerMessagePart :: dummy ( ) ] . to_vec ( ) ,
48
+ next_signers : [ SignerMessagePart :: dummy ( ) ] . to_vec ( ) ,
102
49
}
103
50
}
104
51
}
@@ -129,7 +76,7 @@ mod tests {
129
76
phi_f : 0.65 ,
130
77
} ,
131
78
signers : vec ! [
132
- SignerMessage {
79
+ SignerMessagePart {
133
80
party_id: "123" . to_string( ) ,
134
81
verification_key: "7b22766b223a5b3134332c3136312c3235352c34382c37382c35372c3230342c3232302c32352c3232312c3136342c3235322c3234382c31342c35362c3132362c3138362c3133352c3232382c3138382c3134352c3138312c35322c3230302c39372c39392c3231332c34362c302c3139392c3139332c38392c3138372c38382c32392c3133352c3137332c3234342c38362c33362c38332c35342c36372c3136342c362c3133372c39342c37322c362c3130352c3132382c3132382c39332c34382c3137362c31312c342c3234362c3133382c34382c3138302c3133332c39302c3134322c3139322c32342c3139332c3131312c3134322c33312c37362c3131312c3131302c3233342c3135332c39302c3230382c3139322c33312c3132342c39352c3130322c34392c3135382c39392c35322c3232302c3136352c39342c3235312c36382c36392c3132312c31362c3232342c3139345d2c22706f70223a5b3136382c35302c3233332c3139332c31352c3133362c36352c37322c3132332c3134382c3132392c3137362c33382c3139382c3230392c34372c32382c3230342c3137362c3134342c35372c3235312c34322c32382c36362c37362c38392c39372c3135382c36332c35342c3139382c3139342c3137362c3133352c3232312c31342c3138352c3139372c3232352c3230322c39382c3234332c37342c3233332c3232352c3134332c3135312c3134372c3137372c3137302c3131372c36362c3136352c36362c36322c33332c3231362c3233322c37352c36382c3131342c3139352c32322c3130302c36352c34342c3139382c342c3136362c3130322c3233332c3235332c3234302c35392c3137352c36302c3131372c3134322c3131342c3134302c3132322c31372c38372c3131302c3138372c312c31372c31302c3139352c3135342c31332c3234392c38362c35342c3232365d7d" . to_string( ) ,
135
82
verification_key_signature: None ,
@@ -138,7 +85,7 @@ mod tests {
138
85
}
139
86
] ,
140
87
next_signers : vec ! [
141
- SignerMessage {
88
+ SignerMessagePart {
142
89
party_id: "123" . to_string( ) ,
143
90
verification_key: "7b22766b223a5b3134332c3136312c3235352c34382c37382c35372c3230342c3232302c32352c3232312c3136342c3235322c3234382c31342c35362c3132362c3138362c3133352c3232382c3138382c3134352c3138312c35322c3230302c39372c39392c3231332c34362c302c3139392c3139332c38392c3138372c38382c32392c3133352c3137332c3234342c38362c33362c38332c35342c36372c3136342c362c3133372c39342c37322c362c3130352c3132382c3132382c39332c34382c3137362c31312c342c3234362c3133382c34382c3138302c3133332c39302c3134322c3139322c32342c3139332c3131312c3134322c33312c37362c3131312c3131302c3233342c3135332c39302c3230382c3139322c33312c3132342c39352c3130322c34392c3135382c39392c35322c3232302c3136352c39342c3235312c36382c36392c3132312c31362c3232342c3139345d2c22706f70223a5b3136382c35302c3233332c3139332c31352c3133362c36352c37322c3132332c3134382c3132392c3137362c33382c3139382c3230392c34372c32382c3230342c3137362c3134342c35372c3235312c34322c32382c36362c37362c38392c39372c3135382c36332c35342c3139382c3139342c3137362c3133352c3232312c31342c3138352c3139372c3232352c3230322c39382c3234332c37342c3233332c3232352c3134332c3135312c3134372c3137372c3137302c3131372c36362c3136352c36362c36322c33332c3231362c3233322c37352c36382c3131342c3139352c32322c3130302c36352c34342c3139382c342c3136362c3130322c3233332c3235332c3234302c35392c3137352c36302c3131372c3134322c3131342c3134302c3132322c31372c38372c3131302c3138372c312c31372c31302c3139352c3135342c31332c3234392c38362c35342c3232365d7d" . to_string( ) ,
144
91
verification_key_signature: None ,
0 commit comments