Skip to content

Commit

Permalink
[Operational Tool] Display validator configs even on address decrypti…
Browse files Browse the repository at this point in the history
…on failure.

Closes: aptos-labs#6090
  • Loading branch information
JoshLind authored and bors-libra committed Sep 18, 2020
1 parent 0361577 commit 7cc256c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
20 changes: 18 additions & 2 deletions config/management/operational/src/validator_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use libra_management::{config::ConfigPath, error::Error, secure_backend::Validat
use libra_network_address::NetworkAddress;
use libra_types::account_address::AccountAddress;
use serde::Serialize;
use std::str::FromStr;
use structopt::StructOpt;

#[derive(Debug, StructOpt)]
Expand Down Expand Up @@ -44,11 +45,26 @@ impl ValidatorSet {
Ok(config) => config,
Err(err) => {
println!(
"Unable to decode account {}: {}",
"Unable to decode account {}: {}. Using a dummy validator network address!",
info.account_address(),
err
);
continue;

// Return the partially decrypted validator config (using a dummy validator
// network address).
let encrypted_config = info.config();
DecryptedValidatorConfig {
name: "".to_string(),
consensus_public_key: encrypted_config.consensus_public_key.clone(),
fullnode_network_address: encrypted_config
.fullnode_network_addresses()
.map_err(|e| Error::NetworkAddressDecodeError(e.to_string()))?[0]
.clone(),
validator_network_address: NetworkAddress::from_str(
"/dns4/could-not-decrypt",
)
.map_err(|e| Error::NetworkAddressDecodeError(e.to_string()))?,
}
}
};

Expand Down
2 changes: 1 addition & 1 deletion config/management/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub enum Error {
JsonRpcReadError(&'static str, String),
#[error("Failed to write '{0}' from JSON-RPC: {1}")]
JsonRpcWriteError(&'static str, String),
#[error("Unable to deocde network address: {0}")]
#[error("Unable to decode network address: {0}")]
NetworkAddressDecodeError(String),
#[error("{0} storage unavailable, please check your configuration: {1}")]
StorageUnavailable(&'static str, String),
Expand Down

0 comments on commit 7cc256c

Please sign in to comment.