add better err reporting UnableToOpenVotingKeystore (#3781)

## Issue Addressed

#3780 

## Proposed Changes

Add error reporting that notifies the node operator that the `voting_keystore_path` in their `validator_definitions.yml` file may be incorrect.

## Additional Info

There is more info in issue #3780 


Co-authored-by: Paul Hauner <paul@paulhauner.com>
This commit is contained in:
David Theodore 2023-01-17 05:13:47 +00:00 committed by realbigsean
parent 47ade13ef7
commit 1b6d1a9ef9

View File

@ -31,6 +31,7 @@ use crate::beacon_node_fallback::{
}; };
use crate::doppelganger_service::DoppelgangerService; use crate::doppelganger_service::DoppelgangerService;
use crate::graffiti_file::GraffitiFile; use crate::graffiti_file::GraffitiFile;
use crate::initialized_validators::Error::UnableToOpenVotingKeystore;
use account_utils::validator_definitions::ValidatorDefinitions; use account_utils::validator_definitions::ValidatorDefinitions;
use attestation_service::{AttestationService, AttestationServiceBuilder}; use attestation_service::{AttestationService, AttestationServiceBuilder};
use block_service::{BlockService, BlockServiceBuilder}; use block_service::{BlockService, BlockServiceBuilder};
@ -184,7 +185,16 @@ impl<T: EthSpec> ProductionValidatorClient<T> {
log.clone(), log.clone(),
) )
.await .await
.map_err(|e| format!("Unable to initialize validators: {:?}", e))?; .map_err(|e| {
match e {
UnableToOpenVotingKeystore(err) => {
format!("Unable to initialize validators: {:?}. If you have recently moved the location of your data directory \
make sure to update the location of voting_keystore_path in your validator_definitions.yml", err)
},
err => {
format!("Unable to initialize validators: {:?}", err)}
}
})?;
let voting_pubkeys: Vec<_> = validators.iter_voting_pubkeys().collect(); let voting_pubkeys: Vec<_> = validators.iter_voting_pubkeys().collect();