mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 00:42:42 +00:00
Revert "Add password migrate command"
This reverts commit 36477a004f2c8afac4c0b8e8fa8c4473dc74175b.
This commit is contained in:
@@ -16,7 +16,7 @@ use std::fs::{self, File};
|
|||||||
use std::io;
|
use std::io;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use types::{graffiti::GraffitiString, Address, PublicKey};
|
use types::{graffiti::GraffitiString, Address, PublicKey};
|
||||||
use validator_dir::{write_password_to_file, VOTING_KEYSTORE_FILE};
|
use validator_dir::VOTING_KEYSTORE_FILE;
|
||||||
|
|
||||||
/// The file name for the serialized `ValidatorDefinitions` struct.
|
/// The file name for the serialized `ValidatorDefinitions` struct.
|
||||||
pub const CONFIG_FILENAME: &str = "validator_definitions.yml";
|
pub const CONFIG_FILENAME: &str = "validator_definitions.yml";
|
||||||
@@ -47,7 +47,6 @@ pub enum Error {
|
|||||||
UnableToCreateValidatorDir(PathBuf),
|
UnableToCreateValidatorDir(PathBuf),
|
||||||
UnableToReadKeystorePassword(String),
|
UnableToReadKeystorePassword(String),
|
||||||
KeystoreWithoutPassword,
|
KeystoreWithoutPassword,
|
||||||
UnableToCreatePassword(validator_dir::BuilderError),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Defines how a password for a validator keystore will be persisted.
|
/// Defines how a password for a validator keystore will be persisted.
|
||||||
@@ -351,42 +350,6 @@ impl ValidatorDefinitions {
|
|||||||
Ok(new_defs_count)
|
Ok(new_defs_count)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(paul): remove this
|
|
||||||
pub fn migrate_passwords_to_secrets_dir<P: AsRef<Path>>(
|
|
||||||
&mut self,
|
|
||||||
validators_dir: P,
|
|
||||||
secrets_dir: P,
|
|
||||||
) -> Result<(), Error> {
|
|
||||||
for def in &mut self.0 {
|
|
||||||
match &mut def.signing_definition {
|
|
||||||
SigningDefinition::LocalKeystore {
|
|
||||||
voting_keystore_path,
|
|
||||||
voting_keystore_password_path,
|
|
||||||
voting_keystore_password,
|
|
||||||
} => {
|
|
||||||
if voting_keystore_password_path.is_some() {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
let keystore = Keystore::from_json_file(&voting_keystore_path)
|
|
||||||
.map_err(Error::UnableToOpenKeystore)?;
|
|
||||||
|
|
||||||
if let Some(password) = voting_keystore_password {
|
|
||||||
let password_path = default_keystore_password_path(&keystore, &secrets_dir);
|
|
||||||
if !password_path.exists() {
|
|
||||||
write_password_to_file(&password_path, password.as_ref())
|
|
||||||
.map_err(Error::UnableToCreatePassword)?;
|
|
||||||
*voting_keystore_password_path = Some(password_path);
|
|
||||||
*voting_keystore_password = None;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SigningDefinition::Web3Signer { .. } => (),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self.save(validators_dir)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Encodes `self` as a YAML string and atomically writes it to the `CONFIG_FILENAME` file in
|
/// Encodes `self` as a YAML string and atomically writes it to the `CONFIG_FILENAME` file in
|
||||||
/// the `validators_dir` directory.
|
/// the `validators_dir` directory.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -15,6 +15,6 @@ pub use crate::validator_dir::{
|
|||||||
ETH1_DEPOSIT_TX_HASH_FILE,
|
ETH1_DEPOSIT_TX_HASH_FILE,
|
||||||
};
|
};
|
||||||
pub use builder::{
|
pub use builder::{
|
||||||
keystore_password_path, write_password_to_file, Builder, Error as BuilderError,
|
keystore_password_path, Builder, Error as BuilderError, ETH1_DEPOSIT_DATA_FILE,
|
||||||
ETH1_DEPOSIT_DATA_FILE, VOTING_KEYSTORE_FILE, WITHDRAWAL_KEYSTORE_FILE,
|
VOTING_KEYSTORE_FILE, WITHDRAWAL_KEYSTORE_FILE,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -162,11 +162,6 @@ impl<T: EthSpec> ProductionValidatorClient<T> {
|
|||||||
let mut validator_defs = ValidatorDefinitions::open_or_create(&config.validator_dir)
|
let mut validator_defs = ValidatorDefinitions::open_or_create(&config.validator_dir)
|
||||||
.map_err(|e| format!("Unable to open or create validator definitions: {:?}", e))?;
|
.map_err(|e| format!("Unable to open or create validator definitions: {:?}", e))?;
|
||||||
|
|
||||||
// TODO(paul): remove this
|
|
||||||
validator_defs
|
|
||||||
.migrate_passwords_to_secrets_dir(&config.validator_dir, &config.secrets_dir)
|
|
||||||
.map_err(|e| format!("Unable to migrate passwords: {:?}", e))?;
|
|
||||||
|
|
||||||
if !config.disable_auto_discover {
|
if !config.disable_auto_discover {
|
||||||
let new_validators = validator_defs
|
let new_validators = validator_defs
|
||||||
.discover_local_keystores(&config.validator_dir, &config.secrets_dir, &log)
|
.discover_local_keystores(&config.validator_dir, &config.secrets_dir, &log)
|
||||||
|
|||||||
Reference in New Issue
Block a user