Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ As a minor extension, we have adopted a slightly different versioning convention
| ----- | ------- |
| N/A | `-` |

## Mithril Distribution [2543] - 2025-11-03
## Mithril Distribution [2543.1] - 2025-11-03

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

## Mithril Distribution [2537] - 2025-09-17
## Mithril Distribution [2537.0] - 2025-09-17

- Client library, CLI and WASM:
- Support for stable `cardano_database_v2` backend in the `mithril-client` library.
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mithril-signer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mithril-signer"
version = "0.2.275"
version = "0.2.277"
description = "A Mithril Signer"
authors = { workspace = true }
edition = { workspace = true }
Expand Down
58 changes: 34 additions & 24 deletions mithril-signer/src/runtime/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,37 +207,41 @@ impl Runner for SignerRunner {
),
None => None,
};
let protocol_initializer = MithrilProtocolInitializerBuilder::build(
stake,
&protocol_parameters,
self.services.kes_signer.clone(),
kes_period,
)?;
self.services
.protocol_initializer_store
.save_protocol_initializer(epoch_offset_to_recording_epoch, protocol_initializer)
.await?;

let protocol_initializer = self
.services
.protocol_initializer_store
.get_protocol_initializer(epoch_offset_to_recording_epoch)
.await?.ok_or(RunnerError::NoValueError(
format!("no protocol_initializer available in store for epoch {epoch_offset_to_recording_epoch}"),
)).with_context(
.await
.with_context(
|| "register_signer_to_aggregator can not retrieve protocol initializer from store",
)?;
let signer = Signer::new(
self.services.single_signer.get_party_id(),
protocol_initializer.verification_key().into(),
protocol_initializer.verification_key_signature(),
protocol_operational_certificate,
kes_period,
);
self.services
.certificate_handler
.register_signer(epoch_offset_to_recording_epoch, &signer)
.await?;

if protocol_initializer.is_none() {
let protocol_initializer = MithrilProtocolInitializerBuilder::build(
stake,
&protocol_parameters,
self.services.kes_signer.clone(),
kes_period,
)?;

let signer = Signer::new(
self.services.single_signer.get_party_id(),
protocol_initializer.verification_key().into(),
protocol_initializer.verification_key_signature(),
protocol_operational_certificate,
kes_period,
);
self.services
.certificate_handler
.register_signer(epoch_offset_to_recording_epoch, &signer)
.await?;

self.services
.protocol_initializer_store
.save_protocol_initializer(epoch_offset_to_recording_epoch, protocol_initializer)
.await?;
}

Ok(())
}
Expand Down Expand Up @@ -705,6 +709,9 @@ mod tests {
"A protocol initializer should have been registered at the 'Recording' epoch"
);

let total_registered_signers = certificate_handler.get_total_registered_signers().await;
assert_eq!(1, total_registered_signers);

runner
.register_signer_to_aggregator()
.await
Expand All @@ -725,6 +732,9 @@ mod tests {
serde_json::to_string(&last_registered_signer_second_registration).unwrap(),
"The signer registration should be the same and should have been registered twice"
);

let total_registered_signers = certificate_handler.get_total_registered_signers().await;
assert_eq!(1, total_registered_signers);
}

#[tokio::test]
Expand Down
10 changes: 10 additions & 0 deletions mithril-signer/src/services/aggregator_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,19 @@ pub(crate) mod dumb {
epoch_settings: RwLock<Option<SignerEpochSettings>>,
last_registered_signer: RwLock<Option<Signer>>,
aggregator_features: RwLock<AggregatorFeaturesMessage>,
total_registered_signers: RwLock<u32>,
}

impl DumbAggregatorClient {
/// Return the last signer that called with the `register` method.
pub async fn get_last_registered_signer(&self) -> Option<Signer> {
self.last_registered_signer.read().await.clone()
}

/// Return the total number of signers that called with the `register` method.
pub async fn get_total_registered_signers(&self) -> u32 {
*self.total_registered_signers.read().await
}
}

impl Default for DumbAggregatorClient {
Expand All @@ -114,6 +120,7 @@ pub(crate) mod dumb {
epoch_settings: RwLock::new(Some(SignerEpochSettings::dummy())),
last_registered_signer: RwLock::new(None),
aggregator_features: RwLock::new(AggregatorFeaturesMessage::dummy()),
total_registered_signers: RwLock::new(0),
}
}
}
Expand All @@ -132,6 +139,9 @@ pub(crate) mod dumb {
let signer = signer.clone();
*last_registered_signer = Some(signer);

let mut total_registered_signers = self.total_registered_signers.write().await;
*total_registered_signers += 1;

Ok(())
}

Expand Down
Loading