@@ -12,8 +12,8 @@ use crate::store::ProtocolInitializerStorer;
1212use mithril_common:: StdResult ;
1313use mithril_common:: crypto_helper:: ProtocolInitializer ;
1414use mithril_common:: entities:: {
15- CardanoTransactionsSigningConfig , Epoch , PartyId , ProtocolParameters , SignedEntityConfig ,
16- SignedEntityTypeDiscriminants , Signer , SignerWithStake ,
15+ CardanoBlocksTransactionsSigningConfig , CardanoTransactionsSigningConfig , Epoch , PartyId ,
16+ ProtocolParameters , SignedEntityConfig , SignedEntityTypeDiscriminants , Signer , SignerWithStake ,
1717} ;
1818use mithril_common:: logging:: LoggerExtensions ;
1919use mithril_persistence:: store:: StakeStorer ;
@@ -72,6 +72,11 @@ pub trait EpochService: Sync + Send {
7272 & self ,
7373 ) -> StdResult < & Option < CardanoTransactionsSigningConfig > > ;
7474
75+ /// Get the cardano blocks and transactions signing configuration for the current epoch
76+ fn cardano_blocks_transactions_signing_config (
77+ & self ,
78+ ) -> StdResult < & Option < CardanoBlocksTransactionsSigningConfig > > ;
79+
7580 /// Check if the given signer can sign for the current epoch
7681 fn can_signer_sign_current_epoch ( & self , party_id : PartyId ) -> StdResult < bool > ;
7782}
@@ -84,6 +89,7 @@ pub(crate) struct EpochData {
8489 pub next_signers : Vec < Signer > ,
8590 pub allowed_discriminants : BTreeSet < SignedEntityTypeDiscriminants > ,
8691 pub cardano_transactions_signing_config : Option < CardanoTransactionsSigningConfig > ,
92+ pub cardano_blocks_transactions_signing_config : Option < CardanoBlocksTransactionsSigningConfig > ,
8793}
8894
8995/// Implementation of the [epoch service][EpochService].
@@ -193,11 +199,15 @@ impl EpochService for MithrilEpochService {
193199 . enabled_signed_entity_types
194200 . clone ( ) ;
195201
196- let cardano_transactions_signing_config = mithril_network_configuration
202+ let signed_entity_types_config = & mithril_network_configuration
197203 . configuration_for_aggregation
198- . signed_entity_types_config
199- . cardano_transactions
200- . clone ( ) ;
204+ . signed_entity_types_config ;
205+
206+ let cardano_transactions_signing_config =
207+ signed_entity_types_config. cardano_transactions . clone ( ) ;
208+
209+ let cardano_blocks_transactions_signing_config =
210+ signed_entity_types_config. cardano_blocks_transactions . clone ( ) ;
201211
202212 self . epoch_data = Some ( EpochData {
203213 epoch : aggregator_signer_registration_epoch,
@@ -207,6 +217,7 @@ impl EpochService for MithrilEpochService {
207217 next_signers,
208218 allowed_discriminants,
209219 cardano_transactions_signing_config,
220+ cardano_blocks_transactions_signing_config,
210221 } ) ;
211222
212223 Ok ( ( ) )
@@ -260,6 +271,12 @@ impl EpochService for MithrilEpochService {
260271 Ok ( & self . unwrap_data ( ) ?. cardano_transactions_signing_config )
261272 }
262273
274+ fn cardano_blocks_transactions_signing_config (
275+ & self ,
276+ ) -> StdResult < & Option < CardanoBlocksTransactionsSigningConfig > > {
277+ Ok ( & self . unwrap_data ( ) ?. cardano_blocks_transactions_signing_config )
278+ }
279+
263280 fn can_signer_sign_current_epoch ( & self , party_id : PartyId ) -> StdResult < bool > {
264281 let epoch = self . epoch_of_current_data ( ) ?;
265282 if let Some ( protocol_initializer) = self . protocol_initializer ( ) ? {
@@ -313,6 +330,9 @@ impl SignedEntityConfigProvider for SignerSignedEntityConfigProvider {
313330 cardano_transactions_signing_config : epoch_service
314331 . cardano_transactions_signing_config ( ) ?
315332 . clone ( ) ,
333+ cardano_blocks_transactions_signing_config : epoch_service
334+ . cardano_blocks_transactions_signing_config ( ) ?
335+ . clone ( ) ,
316336 } )
317337 }
318338}
@@ -353,6 +373,7 @@ impl MithrilEpochService {
353373 next_signers : vec ! [ ] ,
354374 allowed_discriminants : BTreeSet :: new ( ) ,
355375 cardano_transactions_signing_config : None ,
376+ cardano_blocks_transactions_signing_config : None ,
356377 } ;
357378 self . epoch_data = Some ( epoch_data) ;
358379 self
@@ -406,6 +427,10 @@ pub(crate) mod mock_epoch_service {
406427 & self ,
407428 ) -> StdResult <& ' static Option <CardanoTransactionsSigningConfig >>;
408429
430+ fn cardano_blocks_transactions_signing_config(
431+ & self ,
432+ ) -> StdResult <& ' static Option <CardanoBlocksTransactionsSigningConfig >>;
433+
409434 fn can_signer_sign_current_epoch( & self , party_id: PartyId ) -> StdResult <bool >;
410435 }
411436 }
@@ -912,6 +937,7 @@ mod tests {
912937 let configuration_for_aggregation = MithrilNetworkConfigurationForEpoch {
913938 signed_entity_types_config : SignedEntityTypeConfiguration {
914939 cardano_transactions : None ,
940+ cardano_blocks_transactions : None ,
915941 } ,
916942 enabled_signed_entity_types : allowed_discriminants. clone ( ) ,
917943 ..Dummy :: dummy ( )
@@ -940,6 +966,7 @@ mod tests {
940966 SignedEntityConfig {
941967 allowed_discriminants,
942968 cardano_transactions_signing_config: None ,
969+ cardano_blocks_transactions_signing_config: None ,
943970 } ,
944971 config
945972 ) ;
@@ -981,6 +1008,9 @@ mod tests {
9811008 cardano_transactions_signing_config: Some (
9821009 CardanoTransactionsSigningConfig :: dummy( )
9831010 ) ,
1011+ cardano_blocks_transactions_signing_config: Some (
1012+ CardanoBlocksTransactionsSigningConfig :: dummy( )
1013+ ) ,
9841014 } ,
9851015 config
9861016 ) ;
0 commit comments