Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

signer retrieves registrations with epoch settings route #1913

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
76ad12c
Add current_signers and next_signers to EpochSettings in mithril-common
sfauvel Aug 28, 2024
bded99e
Adapt mithril-aggregator to send current and next signers in epoch-se…
sfauvel Aug 28, 2024
be10cb0
Adapt signer to work with new attributes on EpochSettings
sfauvel Aug 28, 2024
41804fa
Update state machine to register epoch_settings information and get s…
sfauvel Aug 29, 2024
b2d1bc6
Add an epoch_service that provide signers with stake
sfauvel Aug 29, 2024
d54b2ca
Move EpochService into `services` module and use an EpochData struct …
sfauvel Aug 29, 2024
2852338
Add some test on EpochService and remove commented code
sfauvel Aug 30, 2024
0a29cec
Store only signer when inform_epoch_settings in Signer and compute Si…
sfauvel Aug 30, 2024
ea16c69
Create function to get signers with stack from EpochService
sfauvel Aug 30, 2024
169874f
Remove signers parameter from `compute_message` and `compute_single_s…
sfauvel Sep 2, 2024
6dff44b
Give the `EpochSetting` ownership to the `EpochService `when calling …
sfauvel Sep 2, 2024
df20a54
Remove `register_signer_to_aggregator` parameters and retrieve values…
sfauvel Sep 2, 2024
417c9b4
Improve building of `EpochSettingMessage`
sfauvel Sep 2, 2024
1cf3f79
Fix some clippy issues
sfauvel Sep 3, 2024
d582e7b
Remove duplication in FakeAggregator
sfauvel Sep 3, 2024
1c31204
Use `SignerMessagePart::from_signers` instead of a specific function
sfauvel Sep 3, 2024
2d55a0b
Remove `associate_signers_with_stake` from runner and improve epoch_s…
sfauvel Sep 3, 2024
aac8161
Fix `next_protocol_multi_signer`build in `FakeEpochService::with_data`
sfauvel Sep 3, 2024
632a99b
Depreciate `signers, `next_signers`, `protocol_parameters` and `next_…
sfauvel Sep 3, 2024
f908f37
Fix clippy suggestions and remove useless comments
sfauvel Sep 3, 2024
1d6ab33
Remove unused `ToEpochSettingsMessageAdapter`
sfauvel Sep 3, 2024
36fe621
Fix typo and unused import
sfauvel Sep 3, 2024
47a16ac
Fix OpenAPI deprecation syntax
sfauvel Sep 3, 2024
598a722
Improve test and allow deprecated in Adapter
sfauvel Sep 4, 2024
1298283
Add a `SignerMessagePart` fallible conversion to Signer
sfauvel Sep 5, 2024
f6a8f65
Move functions from `Runner` trait to the implementation and fix PR r…
sfauvel Sep 6, 2024
0344ca1
Remove signers assignation in `FromPendingCertificateMessageAdapter`
sfauvel Sep 6, 2024
eb44059
Update Mithril Aggregator Fake data
sfauvel Sep 9, 2024
4c4463a
Taking into account the remarks of the PR
sfauvel Sep 9, 2024
59a8894
Upgrade crate versions
sfauvel Sep 10, 2024
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
8 changes: 4 additions & 4 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-aggregator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mithril-aggregator"
version = "0.5.60"
version = "0.5.61"
description = "A Mithril Aggregator server"
authors = { workspace = true }
edition = { workspace = true }
Expand Down
25 changes: 18 additions & 7 deletions mithril-aggregator/src/http_server/routes/epoch_routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ fn epoch_settings(
mod handlers {
use crate::dependency_injection::EpochServiceWrapper;
use crate::http_server::routes::reply;
use crate::ToEpochSettingsMessageAdapter;
use mithril_common::entities::EpochSettings;
use mithril_common::messages::ToMessageAdapter;
use mithril_common::messages::{EpochSettingsMessage, SignerMessagePart};
use slog_scope::{debug, warn};
use std::convert::Infallible;
use warp::http::StatusCode;
Expand All @@ -40,17 +38,30 @@ mod handlers {
epoch_service.epoch_of_current_data(),
epoch_service.next_protocol_parameters(),
epoch_service.upcoming_protocol_parameters(),
epoch_service.current_signers(),
epoch_service.next_signers(),
) {
(Ok(epoch), Ok(protocol_parameters), Ok(next_protocol_parameters)) => {
let epoch_settings = EpochSettings {
(
Ok(epoch),
Ok(protocol_parameters),
Ok(next_protocol_parameters),
Ok(current_signers),
Ok(next_signers),
) => {
let epoch_settings_message = EpochSettingsMessage {
epoch,
protocol_parameters: protocol_parameters.clone(),
next_protocol_parameters: next_protocol_parameters.clone(),
current_signers: SignerMessagePart::from_signers(current_signers.to_vec()),
next_signers: SignerMessagePart::from_signers(next_signers.to_vec()),
};
let epoch_settings_message = ToEpochSettingsMessageAdapter::adapt(epoch_settings);
Ok(reply::json(&epoch_settings_message, StatusCode::OK))
}
(Err(err), _, _) | (_, Err(err), _) | (_, _, Err(err)) => {
(Err(err), _, _, _, _)
| (_, Err(err), _, _, _)
| (_, _, Err(err), _, _)
| (_, _, _, Err(err), _)
| (_, _, _, _, Err(err)) => {
warn!("epoch_settings::error"; "error" => ?err);
Ok(reply::server_error(err))
}
Expand Down
4 changes: 1 addition & 3 deletions mithril-aggregator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ pub use crate::configuration::{
pub use crate::multi_signer::{MultiSigner, MultiSignerImpl};
pub use commands::{CommandType, MainOpts};
pub use dependency_injection::DependencyContainer;
pub use message_adapters::{
FromRegisterSignerAdapter, ToCertificatePendingMessageAdapter, ToEpochSettingsMessageAdapter,
};
pub use message_adapters::{FromRegisterSignerAdapter, ToCertificatePendingMessageAdapter};
pub use runtime::{
AggregatorConfig, AggregatorRunner, AggregatorRunnerTrait, AggregatorRuntime, RuntimeError,
};
Expand Down
2 changes: 0 additions & 2 deletions mithril-aggregator/src/message_adapters/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ mod to_cardano_transaction_list_message;
mod to_cardano_transaction_message;
mod to_cardano_transactions_proof_message;
mod to_certificate_pending_message;
mod to_epoch_settings_message;
mod to_mithril_stake_distribution_list_message;
mod to_mithril_stake_distribution_message;
mod to_snapshot_list_message;
Expand All @@ -24,7 +23,6 @@ pub use to_cardano_transaction_list_message::ToCardanoTransactionListMessageAdap
pub use to_cardano_transaction_message::ToCardanoTransactionMessageAdapter;
pub use to_cardano_transactions_proof_message::ToCardanoTransactionsProofsMessageAdapter;
pub use to_certificate_pending_message::ToCertificatePendingMessageAdapter;
pub use to_epoch_settings_message::ToEpochSettingsMessageAdapter;
#[cfg(test)]
pub use to_mithril_stake_distribution_list_message::ToMithrilStakeDistributionListMessageAdapter;
#[cfg(test)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use mithril_common::entities::CardanoDbBeacon;
use mithril_common::{
entities::{CertificatePending, SignedEntityType, Signer},
entities::{CertificatePending, SignedEntityType},
messages::{CertificatePendingMessage, SignerMessagePart},
};

Expand All @@ -23,31 +23,12 @@ impl ToCertificatePendingMessageAdapter {
signed_entity_type: certificate_pending.signed_entity_type,
protocol_parameters: certificate_pending.protocol_parameters,
next_protocol_parameters: certificate_pending.next_protocol_parameters,
signers: Self::adapt_signers(certificate_pending.signers),
next_signers: Self::adapt_signers(certificate_pending.next_signers),
signers: SignerMessagePart::from_signers(certificate_pending.signers),
next_signers: SignerMessagePart::from_signers(certificate_pending.next_signers),
}
}
}

impl ToCertificatePendingMessageAdapter {
fn adapt_signers(signers: Vec<Signer>) -> Vec<SignerMessagePart> {
signers
.into_iter()
.map(|signer| SignerMessagePart {
party_id: signer.party_id,
verification_key: signer.verification_key.try_into().unwrap(),
verification_key_signature: signer
.verification_key_signature
.map(|k| k.try_into().unwrap()),
kes_period: signer.kes_period,
operational_certificate: signer
.operational_certificate
.map(|o| o.try_into().unwrap()),
})
.collect()
}
}

#[cfg(test)]
mod tests {
use mithril_common::{
Expand Down Expand Up @@ -95,6 +76,7 @@ mod tests {
}

#[test]
#[allow(deprecated)]
fn adapt_signers() {
let fake_signers = fake_data::signers(5);
let signers = fake_signers[1..3].to_vec();
Expand Down

This file was deleted.

Loading
Loading