Directory restructure (#1532)

Closes #1487
Closes #1427

Directory restructure in accordance with #1487. Also has temporary migration code to move the old directories into new structure.
Also extracts all default directory names and utility functions into a `directory` crate to avoid repetitio.

~Since `validator_definition.yaml` stores absolute paths, users will have to manually change the keystore paths or delete the file to get the validators picked up by the vc.~. `validator_definition.yaml` is migrated as well from the default directories.

Co-authored-by: realbigsean <seananderson33@gmail.com>
Co-authored-by: Paul Hauner <paul@paulhauner.com>
This commit is contained in:
Pawan Dhananjay
2020-09-29 00:02:44 +00:00
committed by Paul Hauner
parent dffc56ef1d
commit 8e20176337
40 changed files with 367 additions and 265 deletions

View File

@@ -96,7 +96,7 @@ pub fn testing_client_config() -> ClientConfig {
/// This struct is separate to `LocalValidatorClient` to allow for pre-computation of validator
/// keypairs since the task is quite resource intensive.
pub struct ValidatorFiles {
pub datadir: TempDir,
pub validator_dir: TempDir,
pub secrets_dir: TempDir,
}
@@ -110,7 +110,7 @@ impl ValidatorFiles {
.map_err(|e| format!("Unable to create VC secrets dir: {:?}", e))?;
Ok(Self {
datadir,
validator_dir: datadir,
secrets_dir,
})
}
@@ -120,7 +120,7 @@ impl ValidatorFiles {
let this = Self::new()?;
build_deterministic_validator_dirs(
this.datadir.path().into(),
this.validator_dir.path().into(),
this.secrets_dir.path().into(),
keypair_indices,
)
@@ -170,7 +170,7 @@ impl<E: EthSpec> LocalValidatorClient<E> {
mut config: ValidatorConfig,
files: ValidatorFiles,
) -> Result<Self, String> {
config.data_dir = files.datadir.path().into();
config.validator_dir = files.validator_dir.path().into();
config.secrets_dir = files.secrets_dir.path().into();
ProductionValidatorClient::new(context, config)