@@ -76,10 +76,13 @@ pub trait AggregatorRunnerTrait: Sync + Send {
76
76
/// Read the stake distribution from the blockchain and store it.
77
77
async fn update_stake_distribution ( & self , new_beacon : & Beacon ) -> Result < ( ) , RuntimeError > ;
78
78
79
- /// Open the signer registration round for an epoch.
79
+ /// Open the signer registration round of an epoch.
80
80
async fn open_signer_registration_round ( & self , new_beacon : & Beacon )
81
81
-> Result < ( ) , RuntimeError > ;
82
82
83
+ /// Close the signer registration round of an epoch.
84
+ async fn close_signer_registration_round ( & self ) -> Result < ( ) , RuntimeError > ;
85
+
83
86
/// Update the multisigner with the protocol parameters from configuration.
84
87
async fn update_protocol_parameters_in_multisigner (
85
88
& self ,
@@ -314,6 +317,17 @@ impl AggregatorRunnerTrait for AggregatorRunner {
314
317
Ok ( ( ) )
315
318
}
316
319
320
+ async fn close_signer_registration_round ( & self ) -> Result < ( ) , RuntimeError > {
321
+ debug ! ( "RUNNER: close signer registration round" ) ;
322
+
323
+ self . dependencies
324
+ . signer_registration_round_opener
325
+ . close_registration_round ( )
326
+ . await ?;
327
+
328
+ Ok ( ( ) )
329
+ }
330
+
317
331
async fn update_protocol_parameters_in_multisigner (
318
332
& self ,
319
333
new_beacon : & Beacon ,
@@ -770,6 +784,32 @@ pub mod tests {
770
784
) ;
771
785
}
772
786
787
+ #[ tokio:: test]
788
+ async fn test_close_signer_registration_round ( ) {
789
+ let ( mut deps, config) = initialize_dependencies ( ) . await ;
790
+ let signer_registration_round_opener = Arc :: new ( MithrilSignerRegisterer :: new (
791
+ deps. chain_observer . clone ( ) ,
792
+ deps. verification_key_store . clone ( ) ,
793
+ ) ) ;
794
+ deps. signer_registration_round_opener = signer_registration_round_opener. clone ( ) ;
795
+ let deps = Arc :: new ( deps) ;
796
+ let runner = AggregatorRunner :: new ( config, deps. clone ( ) ) ;
797
+
798
+ let beacon = fake_data:: beacon ( ) ;
799
+ runner
800
+ . open_signer_registration_round ( & beacon)
801
+ . await
802
+ . expect ( "opening signer registration should not return an error" ) ;
803
+
804
+ runner
805
+ . close_signer_registration_round ( )
806
+ . await
807
+ . expect ( "closing signer registration should not return an error" ) ;
808
+
809
+ let saved_current_round = signer_registration_round_opener. get_current_round ( ) . await ;
810
+ assert ! ( saved_current_round. is_none( ) ) ;
811
+ }
812
+
773
813
#[ tokio:: test]
774
814
async fn test_update_protocol_parameters_in_multisigner ( ) {
775
815
let ( deps, config) = initialize_dependencies ( ) . await ;
0 commit comments