Skip to content

Commit

Permalink
[node] Don't panic on failure to initialize safety rules. (#1153)
Browse files Browse the repository at this point in the history
* failure to initialize safety rules should not stop the validator from starting, since the validator may be syncing. Note: THE VALIDATOR WILL NOT BE ABLE TO SIGN BLOCKS if the safety riles cannot be initialized.

* patch build
  • Loading branch information
0o-de-lally authored Aug 11, 2022
1 parent 689cb94 commit c6d6c65
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 7 additions & 2 deletions consensus/src/epoch_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,14 @@ impl EpochManager {

let mut safety_rules =
MetricsSafetyRules::new(self.safety_rules_manager.client(), self.storage.clone());
//////// 0L ////////
// Don't panic on initialize. We may be a validator trying to sync from a starting point.
// however this error if not solved, will cause a problem on the next epoch.
if let Err(error) = safety_rules.perform_initialize() {
panic!(
"Unable to initialize safety rules, epoch: {}, error: {}", epoch, error
error!(
epoch = epoch,
error = error,
"Unable to initialize safety rules. YOUR VALIDATOR WILL NOT BE ABLE TO SIGN BLOCKS but it will be able to sync. This is likely a problem with the restore point in your DB.",
);
}

Expand Down
3 changes: 2 additions & 1 deletion consensus/src/metrics_safety_rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ impl MetricsSafetyRules {
.storage
.retrieve_epoch_change_proof(sr_waypoint.version())
.map_err(|e| {
//////// 0L ////////
Error::InternalError(format!(
"Unable to retrieve epoch change proof from storage for Waypoint. State for version {} not found. Error:{}",
"Unable to retrieve epoch change proof from storage for Waypoint. The node will continue to sync, but the validator will not be able to sign transactions. State for version {} not found. Error:{}",
&sr_waypoint.version(),
e
))
Expand Down

0 comments on commit c6d6c65

Please sign in to comment.