File tree Expand file tree Collapse file tree 9 files changed +54
-17
lines changed Expand file tree Collapse file tree 9 files changed +54
-17
lines changed Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " mithril-aggregator"
3
- version = " 0.2.22 "
3
+ version = " 0.2.23 "
4
4
description = " A Mithril Aggregator server"
5
5
authors = { workspace = true }
6
6
edition = { workspace = true }
Original file line number Diff line number Diff line change @@ -627,13 +627,23 @@ impl AggregatorRunnerTrait for AggregatorRunner {
627
627
. map_err ( |e| {
628
628
RuntimeError :: General ( format ! ( "Could not get Era information ('{e}')" ) . into ( ) )
629
629
} ) ?;
630
- self . dependencies . era_checker . change_era (
631
- token. get_current_supported_era ( ) . map_err ( |e| {
632
- RuntimeError :: General ( format ! ( "Could not update EraChecker service ('{e}')" ) . into ( ) )
633
- } ) ?,
634
- token. get_current_epoch ( ) ,
630
+ let current_era = token. get_current_supported_era ( ) . map_err ( |e| {
631
+ RuntimeError :: General ( format ! ( "Could not update EraChecker service ('{e}')" ) . into ( ) )
632
+ } ) ?;
633
+ self . dependencies
634
+ . era_checker
635
+ . change_era ( current_era, token. get_current_epoch ( ) ) ;
636
+ debug ! (
637
+ "Current Era is {} (Epoch {})." ,
638
+ current_era,
639
+ token. get_current_epoch( )
635
640
) ;
636
641
642
+ if token. get_next_supported_era ( ) . is_err ( ) {
643
+ let era_name = & token. get_next_era_marker ( ) . unwrap ( ) . name ;
644
+ warn ! ( "Upcoming Era '{era_name}' is not supported by this version of the software. Please update!" ) ;
645
+ }
646
+
637
647
Ok ( ( ) )
638
648
}
639
649
}
Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ impl AggregatorRuntime {
101
101
102
102
loop {
103
103
if let Err ( e) = self . cycle ( ) . await {
104
- error ! ( "STATE MACHINE: an error occurred: " ; "error" => ?e ) ;
104
+ error ! ( "STATE MACHINE: an error occurred: {e}" ) ;
105
105
}
106
106
107
107
info ! (
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ impl EraEpochToken {
57
57
/// software.
58
58
pub fn get_current_supported_era ( & self ) -> Result < SupportedEra , UnsupportedEraError > {
59
59
SupportedEra :: from_str ( & self . current_era . name )
60
+ . map_err ( |_| UnsupportedEraError :: new ( & self . current_era . name ) )
60
61
}
61
62
62
63
/// Return the [EraMarker] of the current Era.
@@ -75,7 +76,10 @@ impl EraEpochToken {
75
76
/// for upgrade.
76
77
pub fn get_next_supported_era ( & self ) -> Result < Option < SupportedEra > , UnsupportedEraError > {
77
78
match self . next_era . as_ref ( ) {
78
- Some ( marker) => Ok ( Some ( SupportedEra :: from_str ( & marker. name ) ?) ) ,
79
+ Some ( marker) => Ok ( Some (
80
+ SupportedEra :: from_str ( & marker. name )
81
+ . map_err ( |_| UnsupportedEraError :: new ( & self . current_era . name ) ) ?,
82
+ ) ) ,
79
83
None => Ok ( None ) ,
80
84
}
81
85
}
Original file line number Diff line number Diff line change 1
1
use serde:: { Deserialize , Serialize } ;
2
2
use strum:: IntoEnumIterator ;
3
3
use strum_macros:: { Display , EnumIter , EnumString } ;
4
+ use thiserror:: Error ;
4
5
5
6
/// Error related to [SupportedEra] String parsing implementation.
6
- pub type UnsupportedEraError = strum:: ParseError ;
7
+ #[ derive( Debug , Error ) ]
8
+ #[ error( "Unsupported Era '{era}'." ) ]
9
+ pub struct UnsupportedEraError {
10
+ era : String ,
11
+ }
12
+
13
+ impl UnsupportedEraError {
14
+ pub fn new ( era : & str ) -> Self {
15
+ Self {
16
+ era : era. to_owned ( ) ,
17
+ }
18
+ }
19
+ }
7
20
8
21
/// The era that the software is running or will run
9
22
#[ derive(
Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " mithril-signer"
3
- version = " 0.2.14 "
3
+ version = " 0.2.15 "
4
4
description = " A Mithril Signer"
5
5
authors = { workspace = true }
6
6
edition = { workspace = true }
Original file line number Diff line number Diff line change @@ -444,12 +444,21 @@ impl Runner for SignerRunner {
444
444
. read_era_epoch_token ( epoch)
445
445
. await
446
446
. map_err ( Box :: new) ?;
447
-
448
- self . services . era_checker . change_era (
449
- era_token. get_current_supported_era ( ) ?,
450
- era_token. get_current_epoch ( ) ,
447
+ let current_era = era_token. get_current_supported_era ( ) ?;
448
+ self . services
449
+ . era_checker
450
+ . change_era ( current_era, era_token. get_current_epoch ( ) ) ;
451
+ debug ! (
452
+ "Current Era is {} (Epoch {})." ,
453
+ current_era,
454
+ era_token. get_current_epoch( )
451
455
) ;
452
456
457
+ if era_token. get_next_supported_era ( ) . is_err ( ) {
458
+ let era_name = & era_token. get_next_era_marker ( ) . unwrap ( ) . name ;
459
+ warn ! ( "Upcoming Era '{era_name}' is not supported by this version of the software. Please update!" ) ;
460
+ }
461
+
453
462
Ok ( ( ) )
454
463
}
455
464
}
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ impl StateMachine {
97
97
98
98
loop {
99
99
if let Err ( e) = self . cycle ( ) . await {
100
- error ! ( "STATE MACHINE: an error occured: " ; "error" => ?e ) ;
100
+ error ! ( "STATE MACHINE: an error occured: {e}" ) ;
101
101
}
102
102
103
103
info ! (
@@ -126,6 +126,7 @@ impl StateMachine {
126
126
} else if let Some ( epoch_settings) = self . runner . get_epoch_settings ( ) . await ? {
127
127
info ! ( "→ Epoch settings found" ) ;
128
128
if epoch_settings. epoch >= * epoch {
129
+ info ! ( "new Epoch found" ) ;
129
130
info ! ( " ⋅ transiting to REGISTERED" ) ;
130
131
self . state = self
131
132
. transition_from_unregistered_to_registered ( & epoch_settings)
You can’t perform that action at this time.
0 commit comments