11use anyhow:: { Context , anyhow} ;
22use async_trait:: async_trait;
3+ use mithril_protocol_config:: interface:: MithrilNetworkConfigurationProvider ;
34use slog:: { Logger , debug} ;
45use std:: collections:: BTreeSet ;
56use std:: sync:: Arc ;
@@ -180,7 +181,8 @@ impl EpochServiceDependencies {
180181/// Implementation of the [epoch service][EpochService].
181182pub struct MithrilEpochService {
182183 /// Epoch settings that will be inserted when inform_epoch is called
183- future_epoch_settings : AggregatorEpochSettings ,
184+ //future_epoch_settings: AggregatorEpochSettings,
185+ mithril_network_configuration_provider : Arc < dyn MithrilNetworkConfigurationProvider > ,
184186 epoch_data : Option < EpochData > ,
185187 computed_epoch_data : Option < ComputedEpochData > ,
186188 epoch_settings_storer : Arc < dyn EpochSettingsStorer > ,
@@ -195,13 +197,15 @@ pub struct MithrilEpochService {
195197impl MithrilEpochService {
196198 /// Create a new service instance
197199 pub fn new (
198- future_epoch_settings : AggregatorEpochSettings ,
200+ //future_epoch_settings: AggregatorEpochSettings,
201+ mithril_network_configuration_provider : Arc < dyn MithrilNetworkConfigurationProvider > ,
199202 dependencies : EpochServiceDependencies ,
200203 allowed_discriminants : BTreeSet < SignedEntityTypeDiscriminants > ,
201204 logger : Logger ,
202205 ) -> Self {
203206 Self {
204- future_epoch_settings,
207+ //future_epoch_settings,
208+ mithril_network_configuration_provider,
205209 epoch_data : None ,
206210 computed_epoch_data : None ,
207211 epoch_settings_storer : dependencies. epoch_settings_storer ,
@@ -266,15 +270,31 @@ impl MithrilEpochService {
266270 async fn insert_future_epoch_settings ( & self , actual_epoch : Epoch ) -> StdResult < ( ) > {
267271 let recording_epoch = actual_epoch. offset_to_epoch_settings_recording_epoch ( ) ;
268272
269- debug ! (
273+ /* debug!(
270274 self.logger, "Inserting epoch settings in epoch {recording_epoch}";
271275 "epoch_settings" => ?self.future_epoch_settings
272- ) ;
276+ ); */
277+
278+ let network_configuration = self
279+ . mithril_network_configuration_provider
280+ . get_network_configuration ( )
281+ . await ?;
273282
283+ let aggregator_epoch_settings = AggregatorEpochSettings {
284+ protocol_parameters : network_configuration
285+ . signer_registration_protocol_parameters
286+ . clone ( ) ,
287+ cardano_transactions_signing_config : network_configuration
288+ . signed_entity_types_config
289+ . cardano_transactions
290+ . clone ( )
291+ . unwrap ( ) ,
292+ } ;
274293 self . epoch_settings_storer
275294 . save_epoch_settings (
276295 recording_epoch,
277- self . future_epoch_settings . clone ( ) ,
296+ /* self.future_epoch_settings.clone(), */
297+ aggregator_epoch_settings
278298 )
279299 . await
280300 . with_context ( || format ! ( "Epoch service failed to insert future_epoch_settings to epoch {recording_epoch}" ) )
0 commit comments