@@ -169,6 +169,12 @@ pub trait AggregatorRunnerTrait: Sync + Send {
169
169
beacon : & Beacon ,
170
170
) -> Result < ( ) , Box < dyn StdError + Sync + Send > > ;
171
171
172
+ /// Certifier inform new epoch
173
+ async fn certifier_inform_new_epoch (
174
+ & self ,
175
+ epoch : & Epoch ,
176
+ ) -> Result < ( ) , Box < dyn StdError + Sync + Send > > ;
177
+
172
178
/// Create new open message
173
179
async fn create_open_message (
174
180
& self ,
@@ -689,6 +695,18 @@ impl AggregatorRunnerTrait for AggregatorRunner {
689
695
Ok ( ( ) )
690
696
}
691
697
698
+ async fn certifier_inform_new_epoch (
699
+ & self ,
700
+ epoch : & Epoch ,
701
+ ) -> Result < ( ) , Box < dyn StdError + Sync + Send > > {
702
+ self . dependencies
703
+ . certifier_service
704
+ . inform_epoch ( * epoch)
705
+ . await ?;
706
+
707
+ Ok ( ( ) )
708
+ }
709
+
692
710
async fn create_open_message (
693
711
& self ,
694
712
signed_entity_type : & SignedEntityType ,
@@ -703,6 +721,7 @@ impl AggregatorRunnerTrait for AggregatorRunner {
703
721
704
722
#[ cfg( test) ]
705
723
pub mod tests {
724
+ use crate :: certifier_service:: MockCertifierService ;
706
725
use crate :: dependency:: SimulateFromChainParams ;
707
726
use crate :: multi_signer:: MockMultiSigner ;
708
727
use crate :: runtime:: WorkingCertificate ;
@@ -713,12 +732,10 @@ pub mod tests {
713
732
} ;
714
733
use crate :: { MithrilSignerRegisterer , ProtocolParametersStorer , SignerRegistrationRound } ;
715
734
use mithril_common:: chain_observer:: FakeObserver ;
716
- use mithril_common:: crypto_helper:: {
717
- tests_setup:: setup_certificate_chain, } ;
735
+ use mithril_common:: crypto_helper:: tests_setup:: setup_certificate_chain;
718
736
use mithril_common:: digesters:: DumbImmutableFileObserver ;
719
737
use mithril_common:: entities:: {
720
- Beacon , CertificatePending , ProtocolMessage , SignedEntityType ,
721
- StakeDistribution ,
738
+ Beacon , CertificatePending , Epoch , ProtocolMessage , SignedEntityType , StakeDistribution ,
722
739
} ;
723
740
use mithril_common:: store:: StakeStorer ;
724
741
use mithril_common:: test_utils:: MithrilFixtureBuilder ;
@@ -1215,4 +1232,19 @@ pub mod tests {
1215
1232
runner. update_era_checker ( & beacon) . await . unwrap ( ) ;
1216
1233
assert_eq ! ( beacon. epoch, era_checker. current_epoch( ) ) ;
1217
1234
}
1235
+
1236
+ #[ tokio:: test]
1237
+ async fn test_certifier_inform_new_epoch ( ) {
1238
+ let mut mock_certifier_service = MockCertifierService :: new ( ) ;
1239
+ mock_certifier_service
1240
+ . expect_inform_epoch ( )
1241
+ . returning ( |_| Ok ( ( ) ) )
1242
+ . times ( 1 ) ;
1243
+
1244
+ let ( mut deps, config) = initialize_dependencies ( ) . await ;
1245
+ deps. certifier_service = Arc :: new ( mock_certifier_service) ;
1246
+
1247
+ let runner = AggregatorRunner :: new ( config, Arc :: new ( deps) ) ;
1248
+ runner. certifier_inform_new_epoch ( & Epoch ( 1 ) ) . await . unwrap ( ) ;
1249
+ }
1218
1250
}
0 commit comments