@@ -43,8 +43,13 @@ impl CardanoTransactionsPreloaderChecker for CardanoTransactionsPreloaderActivat
4343 . configuration_for_aggregation
4444 . enabled_signed_entity_types ;
4545
46+ let next_activated_signed_entity_types = configuration
47+ . configuration_for_next_aggregation
48+ . enabled_signed_entity_types ;
49+
4650 Ok ( activated_signed_entity_types
47- . contains ( & SignedEntityTypeDiscriminants :: CardanoTransactions ) )
51+ . union ( & next_activated_signed_entity_types)
52+ . any ( |s| s == & SignedEntityTypeDiscriminants :: CardanoTransactions ) )
4853 }
4954}
5055
@@ -82,7 +87,43 @@ mod tests {
8287 }
8388
8489 #[ tokio:: test]
85- async fn preloader_activation_state_activate_preloader_when_cardano_transactions_not_in_aggregator_capabilities ( )
90+ async fn preloader_activation_is_not_activated_when_cardano_transactions_not_in_current_or_next_configuration_for_aggregation ( )
91+ {
92+ let mut network_configuration_provider = MockMithrilNetworkConfigurationProvider :: new ( ) ;
93+ network_configuration_provider
94+ . expect_get_network_configuration ( )
95+ . times ( 1 )
96+ . returning ( |_| {
97+ Ok ( MithrilNetworkConfiguration {
98+ configuration_for_aggregation : MithrilNetworkConfigurationForEpoch {
99+ enabled_signed_entity_types : BTreeSet :: from ( [ ] ) ,
100+ ..Dummy :: dummy ( )
101+ } ,
102+ configuration_for_next_aggregation : MithrilNetworkConfigurationForEpoch {
103+ enabled_signed_entity_types : BTreeSet :: from ( [ ] ) ,
104+ ..Dummy :: dummy ( )
105+ } ,
106+ ..Dummy :: dummy ( )
107+ } )
108+ } ) ;
109+ let mut ticker_service = MockTickerService :: new ( ) ;
110+ ticker_service
111+ . expect_get_current_epoch ( )
112+ . times ( 1 )
113+ . returning ( || Ok ( Epoch ( 1 ) ) ) ;
114+
115+ let preloader = CardanoTransactionsPreloaderActivationSigner :: new (
116+ Arc :: new ( network_configuration_provider) ,
117+ Arc :: new ( ticker_service) ,
118+ ) ;
119+
120+ let is_activated = preloader. is_activated ( ) . await . unwrap ( ) ;
121+
122+ assert ! ( !is_activated) ;
123+ }
124+
125+ #[ tokio:: test]
126+ async fn preloader_activation_is_activated_when_cardano_transactions_is_in_configuration_for_aggregation ( )
86127 {
87128 let mut network_configuration_provider = MockMithrilNetworkConfigurationProvider :: new ( ) ;
88129 network_configuration_provider
@@ -92,13 +133,18 @@ mod tests {
92133 Ok ( MithrilNetworkConfiguration {
93134 configuration_for_aggregation : MithrilNetworkConfigurationForEpoch {
94135 enabled_signed_entity_types : BTreeSet :: from ( [
95- SignedEntityTypeDiscriminants :: MithrilStakeDistribution ,
136+ SignedEntityTypeDiscriminants :: CardanoTransactions ,
96137 ] ) ,
97138 ..Dummy :: dummy ( )
98139 } ,
140+ configuration_for_next_aggregation : MithrilNetworkConfigurationForEpoch {
141+ enabled_signed_entity_types : BTreeSet :: from ( [ ] ) ,
142+ ..Dummy :: dummy ( )
143+ } ,
99144 ..Dummy :: dummy ( )
100145 } )
101146 } ) ;
147+
102148 let mut ticker_service = MockTickerService :: new ( ) ;
103149 ticker_service
104150 . expect_get_current_epoch ( )
@@ -112,11 +158,11 @@ mod tests {
112158
113159 let is_activated = preloader. is_activated ( ) . await . unwrap ( ) ;
114160
115- assert ! ( ! is_activated) ;
161+ assert ! ( is_activated) ;
116162 }
117163
118164 #[ tokio:: test]
119- async fn preloader_activation_state_activate_preloader_when_cardano_transactions_in_aggregator_capabilities ( )
165+ async fn preloader_activation_is_activated_when_cardano_transactions_is_in_configuration_for_next_aggregation ( )
120166 {
121167 let mut network_configuration_provider = MockMithrilNetworkConfigurationProvider :: new ( ) ;
122168 network_configuration_provider
@@ -125,6 +171,10 @@ mod tests {
125171 . returning ( |_| {
126172 Ok ( MithrilNetworkConfiguration {
127173 configuration_for_aggregation : MithrilNetworkConfigurationForEpoch {
174+ enabled_signed_entity_types : BTreeSet :: from ( [ ] ) ,
175+ ..Dummy :: dummy ( )
176+ } ,
177+ configuration_for_next_aggregation : MithrilNetworkConfigurationForEpoch {
128178 enabled_signed_entity_types : BTreeSet :: from ( [
129179 SignedEntityTypeDiscriminants :: CardanoTransactions ,
130180 ] ) ,
0 commit comments