Skip to content

Commit a14f968

Browse files
committed
refactor: rename 'kes_period' to 'kes_evolution' in Signer entities and messages
1 parent b6b9a62 commit a14f968

File tree

13 files changed

+59
-61
lines changed

13 files changed

+59
-61
lines changed

mithril-aggregator/src/database/record/signer_registration.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ pub struct SignerRegistrationRecord {
2525
/// Operational certificate of the stake pool operator associated to the signer
2626
pub operational_certificate: Option<HexEncodedOpCert>,
2727

28-
/// The kes period used to compute the verification key signature
28+
/// The number of evolutions of the KES key since the start KES period of the operational certificate at the time of signature.
29+
///
30+
/// Note: the naming 'kes_period' lacks clarity and should be renamed to 'kes_evolutions'
31+
// TODO: This 'kes_period' should be renamed to 'kes_evolutions' to avoid confusion
2932
pub kes_period: Option<KesPeriod>,
3033

3134
/// The stake associated to the signer
@@ -47,7 +50,7 @@ impl SignerRegistrationRecord {
4750
operational_certificate: other
4851
.operational_certificate
4952
.map(|o| o.to_json_hex().unwrap()),
50-
kes_period: other.kes_period,
53+
kes_period: other.kes_evolutions,
5154
stake: Some(other.stake),
5255
created_at: Utc::now(),
5356
}
@@ -63,7 +66,7 @@ impl From<SignerRegistrationRecord> for Signer {
6366
.verification_key_signature
6467
.map(|k| k.try_into().unwrap()),
6568
operational_certificate: other.operational_certificate.map(|o| o.try_into().unwrap()),
66-
kes_period: other.kes_period,
69+
kes_evolutions: other.kes_period,
6770
}
6871
}
6972
}
@@ -77,7 +80,7 @@ impl From<SignerRegistrationRecord> for SignerWithStake {
7780
.verification_key_signature
7881
.map(|k| k.try_into().unwrap()),
7982
operational_certificate: other.operational_certificate.map(|o| o.try_into().unwrap()),
80-
kes_period: other.kes_period,
83+
kes_evolutions: other.kes_period,
8184
stake: other.stake.unwrap_or_default(),
8285
}
8386
}

mithril-aggregator/src/database/repository/signer_registration_store.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ mod tests {
164164
.unwrap(),
165165
verification_key_signature: None,
166166
operational_certificate: None,
167-
kes_period: None,
167+
kes_evolutions: None,
168168
stake: 10,
169169
})
170170
.collect()
@@ -244,7 +244,7 @@ mod tests {
244244
verification_key: fake_keys::signer_verification_key()[0].try_into().unwrap(),
245245
verification_key_signature: None,
246246
operational_certificate: None,
247-
kes_period: None,
247+
kes_evolutions: None,
248248
stake: 10,
249249
},
250250
)
@@ -269,7 +269,7 @@ mod tests {
269269
verification_key: fake_keys::signer_verification_key()[2].try_into().unwrap(),
270270
verification_key_signature: None,
271271
operational_certificate: None,
272-
kes_period: None,
272+
kes_evolutions: None,
273273
stake: 10,
274274
},
275275
)
@@ -282,7 +282,7 @@ mod tests {
282282
verification_key: fake_keys::signer_verification_key()[2].try_into().unwrap(),
283283
verification_key_signature: None,
284284
operational_certificate: None,
285-
kes_period: None,
285+
kes_evolutions: None,
286286
stake: 10,
287287
}),
288288
res,

mithril-aggregator/src/message_adapters/from_register_signer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl TryFromMessageAdapter<RegisterSignerMessage, Signer> for FromRegisterSigner
3232
}
3333
_ => None,
3434
},
35-
kes_period: register_signer_message.kes_period,
35+
kes_evolutions: register_signer_message.kes_evolutions,
3636
})
3737
}
3838
}

mithril-common/src/entities/signer.rs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ pub struct Signer {
3333
#[serde(skip_serializing_if = "Option::is_none")]
3434
pub operational_certificate: Option<ProtocolOpCert>,
3535

36-
/// The kes period used to compute the verification key signature
37-
// TODO: This kes period should not be used as is and should probably be within an allowed range of kes period for the epoch
36+
/// The number of evolutions of the KES key since the start KES period of the operational certificate at the time of signature.
3837
#[serde(skip_serializing_if = "Option::is_none")]
39-
pub kes_period: Option<KesPeriod>,
38+
#[serde(rename = "kes_period")]
39+
pub kes_evolutions: Option<KesPeriod>,
4040
}
4141

4242
impl PartialEq for Signer {
@@ -71,7 +71,7 @@ impl Signer {
7171
verification_key,
7272
verification_key_signature,
7373
operational_certificate,
74-
kes_period,
74+
kes_evolutions: kes_period,
7575
}
7676
}
7777

@@ -116,7 +116,7 @@ impl Debug for Signer {
116116
"operational_certificate",
117117
&format_args!("{:?}", self.operational_certificate),
118118
)
119-
.field("kes_period", &format_args!("{:?}", self.kes_period))
119+
.field("kes_evolutions", &format_args!("{:?}", self.kes_evolutions))
120120
.finish(),
121121
false => debug.finish_non_exhaustive(),
122122
}
@@ -130,7 +130,7 @@ impl From<SignerWithStake> for Signer {
130130
other.verification_key,
131131
other.verification_key_signature,
132132
other.operational_certificate,
133-
other.kes_period,
133+
other.kes_evolutions,
134134
)
135135
}
136136
}
@@ -159,11 +159,9 @@ pub struct SignerWithStake {
159159
pub operational_certificate: Option<ProtocolOpCert>,
160160

161161
/// The number of evolutions of the KES key since the start KES period of the operational certificate at the time of signature.
162-
///
163-
/// Note: the naming 'kes_period' lacks clarity and should be renamed to 'kes_evolutions'
164-
// TODO: This 'kes_period' should be rename to 'kes_evolutions' to avoid confusion
165162
#[serde(skip_serializing_if = "Option::is_none")]
166-
pub kes_period: Option<KesPeriod>,
163+
#[serde(rename = "kes_period")]
164+
pub kes_evolutions: Option<KesPeriod>,
167165

168166
/// The signer stake
169167
pub stake: Stake,
@@ -202,7 +200,7 @@ impl SignerWithStake {
202200
verification_key,
203201
verification_key_signature,
204202
operational_certificate,
205-
kes_period,
203+
kes_evolutions: kes_period,
206204
stake,
207205
}
208206
}
@@ -214,7 +212,7 @@ impl SignerWithStake {
214212
verification_key: signer.verification_key,
215213
verification_key_signature: signer.verification_key_signature,
216214
operational_certificate: signer.operational_certificate,
217-
kes_period: signer.kes_period,
215+
kes_evolutions: signer.kes_evolutions,
218216
stake,
219217
}
220218
}
@@ -257,7 +255,7 @@ impl Debug for SignerWithStake {
257255
"operational_certificate",
258256
&format_args!("{:?}", self.operational_certificate),
259257
)
260-
.field("kes_period", &format_args!("{:?}", self.kes_period))
258+
.field("kes_evolutions", &format_args!("{:?}", self.kes_evolutions))
261259
.finish(),
262260
false => debug.finish_non_exhaustive(),
263261
}

mithril-common/src/messages/epoch_settings.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,14 @@ mod tests {
100100
verification_key: "key_123".to_string(),
101101
verification_key_signature: Some("signature_123".to_string()),
102102
operational_certificate: Some("certificate_123".to_string()),
103-
kes_period: Some(12),
103+
kes_evolutions: Some(12),
104104
}],
105105
next_signers: vec![SignerMessagePart {
106106
party_id: "456".to_string(),
107107
verification_key: "key_456".to_string(),
108108
verification_key_signature: Some("signature_456".to_string()),
109109
operational_certificate: Some("certificate_456".to_string()),
110-
kes_period: Some(45),
110+
kes_evolutions: Some(45),
111111
}],
112112
cardano_transactions_signing_config: Some(CardanoTransactionsSigningConfig {
113113
security_parameter: BlockNumber(70),
@@ -130,14 +130,14 @@ mod tests {
130130
verification_key: "key_123".to_string(),
131131
verification_key_signature: Some("signature_123".to_string()),
132132
operational_certificate: Some("certificate_123".to_string()),
133-
kes_period: Some(12),
133+
kes_evolutions: Some(12),
134134
}],
135135
next_signers: vec![SignerMessagePart {
136136
party_id: "456".to_string(),
137137
verification_key: "key_456".to_string(),
138138
verification_key_signature: Some("signature_456".to_string()),
139139
operational_certificate: Some("certificate_456".to_string()),
140-
kes_period: Some(45),
140+
kes_evolutions: Some(45),
141141
}],
142142
cardano_transactions_signing_config: Some(CardanoTransactionsSigningConfig {
143143
security_parameter: BlockNumber(70),
@@ -160,14 +160,14 @@ mod tests {
160160
verification_key: "key_123".to_string(),
161161
verification_key_signature: Some("signature_123".to_string()),
162162
operational_certificate: Some("certificate_123".to_string()),
163-
kes_period: Some(12),
163+
kes_evolutions: Some(12),
164164
}],
165165
next_signers: vec![SignerMessagePart {
166166
party_id: "456".to_string(),
167167
verification_key: "key_456".to_string(),
168168
verification_key_signature: Some("signature_456".to_string()),
169169
operational_certificate: Some("certificate_456".to_string()),
170-
kes_period: Some(45),
170+
kes_evolutions: Some(45),
171171
}],
172172
cardano_transactions_signing_config: Some(CardanoTransactionsSigningConfig {
173173
security_parameter: BlockNumber(70),

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

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,10 @@ pub struct SignerWithStakeMessagePart {
3636
#[serde(skip_serializing_if = "Option::is_none")]
3737
pub operational_certificate: Option<HexEncodedOpCert>,
3838

39-
/// The KES period used to compute the verification key signature
40-
// TODO: This KES period should not be used as is and should probably be
41-
// within an allowed range of KES periods for the epoch.
39+
/// The number of evolutions of the KES key since the start KES period of the operational certificate at the time of signature.
4240
#[serde(skip_serializing_if = "Option::is_none")]
43-
pub kes_period: Option<KesPeriod>,
41+
#[serde(rename = "kes_period")]
42+
pub kes_evolutions: Option<KesPeriod>,
4443

4544
/// The signer stake
4645
pub stake: Stake,
@@ -89,7 +88,7 @@ impl TryInto<SignerWithStake> for SignerWithStakeMessagePart {
8988
party_id: self.party_id,
9089
verification_key: self.verification_key.try_into()?,
9190
verification_key_signature,
92-
kes_period: self.kes_period,
91+
kes_evolutions: self.kes_evolutions,
9392
operational_certificate,
9493
stake: self.stake,
9594
};
@@ -108,7 +107,7 @@ impl From<SignerWithStake> for SignerWithStakeMessagePart {
108107
operational_certificate: value
109108
.operational_certificate
110109
.map(|op_cert| op_cert.try_into().unwrap()),
111-
kes_period: value.kes_period,
110+
kes_evolutions: value.kes_evolutions,
112111
stake: value.stake,
113112
}
114113
}
@@ -134,7 +133,7 @@ impl Debug for SignerWithStakeMessagePart {
134133
"operational_certificate",
135134
&format_args!("{:?}", self.operational_certificate),
136135
)
137-
.field("kes_period", &format_args!("{:?}", self.kes_period))
136+
.field("kes_evolutions", &format_args!("{:?}", self.kes_evolutions))
138137
.finish(),
139138
false => debug.finish_non_exhaustive(),
140139
}
@@ -166,11 +165,10 @@ pub struct SignerMessagePart {
166165
#[serde(skip_serializing_if = "Option::is_none")]
167166
pub operational_certificate: Option<HexEncodedOpCert>,
168167

169-
/// The KES period used to compute the verification key signature
170-
// TODO: This KES period should not be used as is and should probably be
171-
// within an allowed range of KES periods for the epoch.
168+
/// The number of evolutions of the KES key since the start KES period of the operational certificate at the time of signature.
172169
#[serde(skip_serializing_if = "Option::is_none")]
173-
pub kes_period: Option<KesPeriod>,
170+
#[serde(rename = "kes_period")]
171+
pub kes_evolutions: Option<KesPeriod>,
174172
}
175173

176174
impl SignerMessagePart {
@@ -213,7 +211,7 @@ impl TryInto<Signer> for SignerMessagePart {
213211
party_id: self.party_id,
214212
verification_key: self.verification_key.try_into()?,
215213
verification_key_signature,
216-
kes_period: self.kes_period,
214+
kes_evolutions: self.kes_evolutions,
217215
operational_certificate,
218216
};
219217
Ok(value)
@@ -231,7 +229,7 @@ impl From<Signer> for SignerMessagePart {
231229
operational_certificate: value
232230
.operational_certificate
233231
.map(|op_cert| op_cert.try_into().unwrap()),
234-
kes_period: value.kes_period,
232+
kes_evolutions: value.kes_evolutions,
235233
}
236234
}
237235
}
@@ -256,7 +254,7 @@ impl Debug for SignerMessagePart {
256254
"operational_certificate",
257255
&format_args!("{:?}", self.operational_certificate),
258256
)
259-
.field("kes_period", &format_args!("{:?}", self.kes_period))
257+
.field("kes_period", &format_args!("{:?}", self.kes_evolutions))
260258
.finish(),
261259
false => debug.finish_non_exhaustive(),
262260
}
@@ -280,7 +278,7 @@ mod tests {
280278
operational_certificate: Some(
281279
"5b5b5b35312c36322c392c3230302c3230392c34312c3234352c3230372c3135392c3139392c31342c372c38322c3230332c3234302c312c3132392c3138372c3131392c3232312c3133362c3234372c38392c3132382c3232382c3133332c302c39382c31322c3232382c3137382c3233345d2c31362c313139302c5b3231302c3134382c37332c3136332c3232322c3233332c3138302c33372c3133312c3235342c392c3230352c3135382c3134392c31342c37302c39322c372c3233352c3231342c3131312c35322c3131362c34312c3131382c362c3132392c312c3130362c312c39342c3233332c3131352c3137332c3130302c3133392c3131342c3130392c31352c31342c3233332c34332c3137392c3137342c35302c31302c3135302c39372c3132372c3138322c31362c372c3131322c3234352c34382c3134312c38342c3130322c342c32352c3231312c3134342c3230322c345d5d2c5b3133312c3135352c37322c35372c3134372c3231382c3137332c36382c3139312c3234322c3138392c3234372c32372c3235342c3134382c3232352c35332c31312c36392c3135372c3138322c38302c3233342c3133312c3233342c33392c3130322c32312c322c332c36352c3139305d5d".to_string(),
282280
),
283-
kes_period: Some(6)
281+
kes_evolutions: Some(6)
284282
}
285283
}
286284

@@ -295,7 +293,7 @@ mod tests {
295293
operational_certificate: Some(
296294
"82845820333e09c8d129f5cf9fc70e0752cbf00181bb77dd88f75980e48500620ce4b2ea101904a65840d29449a3dee9b42583fe09cd9e950e465c07ebd66f347429760681016a015ee973ad648b726d0f0ee92bb3ae320a96617fb6100770f5308d54660419d390ca045820839b483993daad44bff2bdf71bfe94e1350b459db650ea83ea276615020341be".to_string(),
297295
),
298-
kes_period: Some(6)
296+
kes_evolutions: Some(6)
299297
}
300298
}
301299

@@ -333,7 +331,7 @@ mod tests {
333331
verification_key: signer_message_part.verification_key,
334332
verification_key_signature: signer_message_part.verification_key_signature,
335333
operational_certificate: signer_message_part.operational_certificate,
336-
kes_period: signer_message_part.kes_period,
334+
kes_evolutions: signer_message_part.kes_evolutions,
337335
stake: 123,
338336
}
339337
}
@@ -346,7 +344,7 @@ mod tests {
346344
verification_key: signer_message_part.verification_key,
347345
verification_key_signature: signer_message_part.verification_key_signature,
348346
operational_certificate: signer_message_part.operational_certificate,
349-
kes_period: signer_message_part.kes_period,
347+
kes_evolutions: signer_message_part.kes_evolutions,
350348
stake: 123,
351349
}
352350
}

mithril-common/src/messages/mithril_stake_distribution.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ mod tests {
4444
verification_key: "7b22766b223a5b3134332c3136312c3235352c34382c37382c35372c3230342c3232302c32352c3232312c3136342c3235322c3234382c31342c35362c3132362c3138362c3133352c3232382c3138382c3134352c3138312c35322c3230302c39372c39392c3231332c34362c302c3139392c3139332c38392c3138372c38382c32392c3133352c3137332c3234342c38362c33362c38332c35342c36372c3136342c362c3133372c39342c37322c362c3130352c3132382c3132382c39332c34382c3137362c31312c342c3234362c3133382c34382c3138302c3133332c39302c3134322c3139322c32342c3139332c3131312c3134322c33312c37362c3131312c3131302c3233342c3135332c39302c3230382c3139322c33312c3132342c39352c3130322c34392c3135382c39392c35322c3232302c3136352c39342c3235312c36382c36392c3132312c31362c3232342c3139345d2c22706f70223a5b3136382c35302c3233332c3139332c31352c3133362c36352c37322c3132332c3134382c3132392c3137362c33382c3139382c3230392c34372c32382c3230342c3137362c3134342c35372c3235312c34322c32382c36362c37362c38392c39372c3135382c36332c35342c3139382c3139342c3137362c3133352c3232312c31342c3138352c3139372c3232352c3230322c39382c3234332c37342c3233332c3232352c3134332c3135312c3134372c3137372c3137302c3131372c36362c3136352c36362c36322c33332c3231362c3233322c37352c36382c3131342c3139352c32322c3130302c36352c34342c3139382c342c3136362c3130322c3233332c3235332c3234302c35392c3137352c36302c3131372c3134322c3131342c3134302c3132322c31372c38372c3131302c3138372c312c31372c31302c3139352c3135342c31332c3234392c38362c35342c3232365d7d".to_string(),
4545
verification_key_signature: None,
4646
operational_certificate: None,
47-
kes_period: None,
47+
kes_evolutions: None,
4848
stake: 826
4949
},
5050
],

0 commit comments

Comments
 (0)