Skip to content

Commit c7220be

Browse files
authored
Merge pull request #2773 from input-output-hk/jpraynaud/2771-apply-hotfix-2345
fix: apply hotfix of `2345.1-hotfix`
2 parents a525362 + 271f793 commit c7220be

File tree

5 files changed

+49
-29
lines changed

5 files changed

+49
-29
lines changed

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ As a minor extension, we have adopted a slightly different versioning convention
2121
| ----- | ------- |
2222
| N/A | `-` |
2323

24-
## Mithril Distribution [2543] - 2025-11-03
24+
## Mithril Distribution [2543.1] - 2025-11-03
2525

2626
- Client library, CLI and WASM:
2727
- **DEPRECATED**: The `with_aggregator_client` and `new` functions have been deprecated in the `ClientBuilder` struct of the library.
@@ -60,10 +60,10 @@ As a minor extension, we have adopted a slightly different versioning convention
6060
| mithril-client-cli | `0.12.33` |
6161
| mithril-client-wasm | `0.9.7` |
6262
| mithril-common | `0.6.25` |
63-
| mithril-signer | `0.2.273` |
63+
| mithril-signer | `0.2.276` |
6464
| mithril-stm | `0.5.5` |
6565

66-
## Mithril Distribution [2537] - 2025-09-17
66+
## Mithril Distribution [2537.0] - 2025-09-17
6767

6868
- Client library, CLI and WASM:
6969
- Support for stable `cardano_database_v2` backend in the `mithril-client` library.

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mithril-signer/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mithril-signer"
3-
version = "0.2.275"
3+
version = "0.2.277"
44
description = "A Mithril Signer"
55
authors = { workspace = true }
66
edition = { workspace = true }

mithril-signer/src/runtime/runner.rs

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -207,37 +207,41 @@ impl Runner for SignerRunner {
207207
),
208208
None => None,
209209
};
210-
let protocol_initializer = MithrilProtocolInitializerBuilder::build(
211-
stake,
212-
&protocol_parameters,
213-
self.services.kes_signer.clone(),
214-
kes_period,
215-
)?;
216-
self.services
217-
.protocol_initializer_store
218-
.save_protocol_initializer(epoch_offset_to_recording_epoch, protocol_initializer)
219-
.await?;
220210

221211
let protocol_initializer = self
222212
.services
223213
.protocol_initializer_store
224214
.get_protocol_initializer(epoch_offset_to_recording_epoch)
225-
.await?.ok_or(RunnerError::NoValueError(
226-
format!("no protocol_initializer available in store for epoch {epoch_offset_to_recording_epoch}"),
227-
)).with_context(
215+
.await
216+
.with_context(
228217
|| "register_signer_to_aggregator can not retrieve protocol initializer from store",
229218
)?;
230-
let signer = Signer::new(
231-
self.services.single_signer.get_party_id(),
232-
protocol_initializer.verification_key().into(),
233-
protocol_initializer.verification_key_signature(),
234-
protocol_operational_certificate,
235-
kes_period,
236-
);
237-
self.services
238-
.certificate_handler
239-
.register_signer(epoch_offset_to_recording_epoch, &signer)
240-
.await?;
219+
220+
if protocol_initializer.is_none() {
221+
let protocol_initializer = MithrilProtocolInitializerBuilder::build(
222+
stake,
223+
&protocol_parameters,
224+
self.services.kes_signer.clone(),
225+
kes_period,
226+
)?;
227+
228+
let signer = Signer::new(
229+
self.services.single_signer.get_party_id(),
230+
protocol_initializer.verification_key().into(),
231+
protocol_initializer.verification_key_signature(),
232+
protocol_operational_certificate,
233+
kes_period,
234+
);
235+
self.services
236+
.certificate_handler
237+
.register_signer(epoch_offset_to_recording_epoch, &signer)
238+
.await?;
239+
240+
self.services
241+
.protocol_initializer_store
242+
.save_protocol_initializer(epoch_offset_to_recording_epoch, protocol_initializer)
243+
.await?;
244+
}
241245

242246
Ok(())
243247
}
@@ -705,6 +709,9 @@ mod tests {
705709
"A protocol initializer should have been registered at the 'Recording' epoch"
706710
);
707711

712+
let total_registered_signers = certificate_handler.get_total_registered_signers().await;
713+
assert_eq!(1, total_registered_signers);
714+
708715
runner
709716
.register_signer_to_aggregator()
710717
.await
@@ -725,6 +732,9 @@ mod tests {
725732
serde_json::to_string(&last_registered_signer_second_registration).unwrap(),
726733
"The signer registration should be the same and should have been registered twice"
727734
);
735+
736+
let total_registered_signers = certificate_handler.get_total_registered_signers().await;
737+
assert_eq!(1, total_registered_signers);
728738
}
729739

730740
#[tokio::test]

mithril-signer/src/services/aggregator_client.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,19 @@ pub(crate) mod dumb {
9999
epoch_settings: RwLock<Option<SignerEpochSettings>>,
100100
last_registered_signer: RwLock<Option<Signer>>,
101101
aggregator_features: RwLock<AggregatorFeaturesMessage>,
102+
total_registered_signers: RwLock<u32>,
102103
}
103104

104105
impl DumbAggregatorClient {
105106
/// Return the last signer that called with the `register` method.
106107
pub async fn get_last_registered_signer(&self) -> Option<Signer> {
107108
self.last_registered_signer.read().await.clone()
108109
}
110+
111+
/// Return the total number of signers that called with the `register` method.
112+
pub async fn get_total_registered_signers(&self) -> u32 {
113+
*self.total_registered_signers.read().await
114+
}
109115
}
110116

111117
impl Default for DumbAggregatorClient {
@@ -114,6 +120,7 @@ pub(crate) mod dumb {
114120
epoch_settings: RwLock::new(Some(SignerEpochSettings::dummy())),
115121
last_registered_signer: RwLock::new(None),
116122
aggregator_features: RwLock::new(AggregatorFeaturesMessage::dummy()),
123+
total_registered_signers: RwLock::new(0),
117124
}
118125
}
119126
}
@@ -132,6 +139,9 @@ pub(crate) mod dumb {
132139
let signer = signer.clone();
133140
*last_registered_signer = Some(signer);
134141

142+
let mut total_registered_signers = self.total_registered_signers.write().await;
143+
*total_registered_signers += 1;
144+
135145
Ok(())
136146
}
137147

0 commit comments

Comments
 (0)