Skip to content

Commit

Permalink
Merge pull request #1979 from input-output-hk/djo/1945/signer-certifi…
Browse files Browse the repository at this point in the history
…er-sign-send-signatures

Signer certifier service sign & send signatures
  • Loading branch information
Alenar authored Oct 8, 2024
2 parents d0ecaad + 8c8b8d2 commit 322a8ce
Show file tree
Hide file tree
Showing 14 changed files with 777 additions and 765 deletions.
4 changes: 2 additions & 2 deletions 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-common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mithril-common"
version = "0.4.63"
version = "0.4.64"
description = "Common types, interfaces, and utilities for Mithril nodes."
authors = { workspace = true }
edition = { workspace = true }
Expand Down
27 changes: 27 additions & 0 deletions mithril-common/src/test_utils/fake_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,33 @@ pub fn protocol_parameters() -> entities::ProtocolParameters {
entities::ProtocolParameters::new(k, m, phi_f)
}

cfg_random! {
/// Fake ProtocolInitializer
pub fn protocol_initializer<S: Into<String>>(
seed: S,
stake: entities::Stake,
) -> crypto_helper::ProtocolInitializer {
use rand_chacha::ChaCha20Rng;
use rand_core::SeedableRng;

let protocol_parameters = protocol_parameters();
let seed: [u8; 32] = format!("{:<032}", seed.into()).as_bytes()[..32]
.try_into()
.unwrap();
let mut rng = ChaCha20Rng::from_seed(seed);
let kes_secret_key_path: Option<std::path::PathBuf> = None;
let kes_period = Some(0);

crypto_helper::ProtocolInitializer::setup(
protocol_parameters.into(),
kes_secret_key_path,
kes_period,
stake,
&mut rng,
).unwrap()
}
}

/// Fake CertificatePending
pub fn certificate_pending() -> entities::CertificatePending {
// Epoch
Expand Down
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.193"
version = "0.2.194"
description = "A Mithril Signer"
authors = { workspace = true }
edition = { workspace = true }
Expand Down
13 changes: 10 additions & 3 deletions mithril-signer/src/dependency_injection/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ impl<'a> DependenciesBuilder<'a> {
)?),
self.config.store_retention_limit,
));
let single_signer = Arc::new(MithrilSingleSigner::new(self.compute_protocol_party_id()?));
let digester = Arc::new(CardanoImmutableDigester::new(
self.build_digester_cache_provider().await?,
slog_scope::logger(),
Expand Down Expand Up @@ -322,10 +321,16 @@ impl<'a> DependenciesBuilder<'a> {
let cardano_stake_distribution_signable_builder = Arc::new(
CardanoStakeDistributionSignableBuilder::new(stake_store.clone()),
);
let epoch_service = Arc::new(RwLock::new(MithrilEpochService::new(stake_store.clone())));
let epoch_service = Arc::new(RwLock::new(MithrilEpochService::new(
stake_store.clone(),
protocol_initializer_store.clone(),
)));
let single_signer = Arc::new(MithrilSingleSigner::new(
self.compute_protocol_party_id()?,
epoch_service.clone(),
));
let signable_seed_builder_service = Arc::new(SignerSignableSeedBuilder::new(
epoch_service.clone(),
single_signer.clone(),
protocol_initializer_store.clone(),
));
let signable_builder_service = Arc::new(MithrilSignableBuilderService::new(
Expand Down Expand Up @@ -366,6 +371,8 @@ impl<'a> DependenciesBuilder<'a> {
epoch_service.clone(),
)),
signed_entity_type_lock.clone(),
single_signer.clone(),
aggregator_client.clone(),
));

let services = SignerDependencyContainer {
Expand Down
Loading

0 comments on commit 322a8ce

Please sign in to comment.