Skip to content

Commit

Permalink
Docs fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pawanjay176 committed Aug 17, 2020
1 parent fe13b1b commit ae533f3
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 21 deletions.
14 changes: 8 additions & 6 deletions book/src/key-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ keypairs. Creating a single validator looks like this:
- `lighthouse account validator create --wallet-name wally --wallet-passphrase wally.pass --count 1`


In step (1), we created a wallet in `~/.lighthouse/wallets` with the name
In step (1), we created a wallet in `~/.lighthouse/{testnet}/wallets` with the name
`wally`. We encrypted this using a pre-defined password in the
`wally.pass` file. Then, in step (2), we created one new validator in the
`~/.lighthouse/validators` directory using `wally` (unlocking it with
`~/.lighthouse/{testnet}/validators` directory using `wally` (unlocking it with
`mywallet.pass`) and storing the passwords to the validators voting key in
`~/.lighthouse/secrets`.
`~/.lighthouse/{testnet}/secrets`.

Thanks to the hierarchical key derivation scheme, we can delete all of the
aforementioned directories and then regenerate them as long as we remembered
Expand All @@ -63,14 +63,16 @@ There are three important directories in Lighthouse validator key management:

- `wallets/`: contains encrypted wallets which are used for hierarchical
key derivation.
- Defaults to `~/.lighthouse/wallets`
- Defaults to `~/.lighthouse/{testnet}/wallets`
- `validators/`: contains a directory for each validator containing
encrypted keystores and other validator-specific data.
- Defaults to `~/.lighthouse/validators`
- Defaults to `~/.lighthouse/{testnet}/validators`
- `secrets/`: since the validator signing keys are "hot", the validator process
needs access to the passwords to decrypt the keystores in the validators
dir. These passwords are stored here.
- Defaults to `~/.lighthouse/secrets`
- Defaults to `~/.lighthouse/{testnet}/secrets`

where `testnet` is the name of the testnet passed in the `--testnet` parameter (default is `medalla`).

When the validator client boots, it searches the `validators/` for directories
containing voting keystores. When it discovers a keystore, it searches the
Expand Down
10 changes: 6 additions & 4 deletions book/src/validator-create.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ OPTIONS:
The GWEI value of the deposit amount. Defaults to the minimum amount required for an active validator
(MAX_EFFECTIVE_BALANCE)
--secrets-dir <SECRETS_DIR>
The path where the validator keystore passwords will be stored. Defaults to ~/.lighthouse/secrets
The path where the validator keystore passwords will be stored. Defaults to ~/.lighthouse/{testnet}/secrets

-s, --spec <TITLE>
Specifies the default eth2 spec type. [default: mainnet] [possible values: mainnet, minimal, interop]
Expand All @@ -53,7 +53,7 @@ OPTIONS:
Path to directory containing eth2_testnet specs. Defaults to a hard-coded Lighthouse testnet. Only effective
if there is no existing database.
--validator-dir <VALIDATOR_DIRECTORY>
The path where the validator directories will be created. Defaults to ~/.lighthouse/validators
The path where the validator directories will be created. Defaults to ~/.lighthouse/{testnet}/validators

--wallet-name <WALLET_NAME> Use the wallet identified by this name
--wallet-passphrase <WALLET_PASSWORD_PATH>
Expand All @@ -73,10 +73,12 @@ This command will:
- Derive a new BLS keypair from `wally`, updating it so that it generates a
new key next time.
- Create a new directory in `~/.lighthouse/validators` containing:
- Create a new directory in `~/.lighthouse/{testnet}/validators` containing:
- An encrypted keystore containing the validators voting keypair.
- An `eth1_deposit_data.rlp` assuming the default deposit amount (`32 ETH`
for most testnets and mainnet) which can be submitted to the deposit
contract for the medalla testnet. Other testnets can be set via the
`--testnet` CLI param.
- Store a password to the validators voting keypair in `~/.lighthouse/secrets`.
- Store a password to the validators voting keypair in `~/.lighthouse/{testnet}/secrets`.
where `testnet` is the name of the testnet passed in the `--testnet` parameter (default is `medalla`).
6 changes: 3 additions & 3 deletions book/src/validator-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ useful.
## Introducing the `validator_definitions.yml` file

The `validator_definitions.yml` file is located in the `validator-dir`, which
defaults to `~/.lighthouse/validators`. It is a
defaults to `~/.lighthouse/{testnet}/validators`. It is a
[YAML](https://en.wikipedia.org/wiki/YAML) encoded file defining exactly which
validators the validator client will (and won't) act for.

Expand Down Expand Up @@ -92,7 +92,7 @@ name identical to the `voting_public_key` value.
Lets assume the following directory structure:

```
~/.lighthouse/validators
~/.lighthouse/{testnet}/validators
├── john
│   └── voting-keystore.json
├── sally
Expand Down Expand Up @@ -135,7 +135,7 @@ In order for the validator client to decrypt the validators, they will need to
ensure their `secrets-dir` is organised as below:

```
~/.lighthouse/secrets
~/.lighthouse/{testnet}/secrets
├── 0xa5566f9ec3c6e1fdf362634ebec9ef7aceb0e460e5079714808388e5d48f4ae1e12897fed1bea951c17fa389d511e477
├── 0xaa440c566fcf34dedf233baf56cf5fb05bb420d9663b4208272545608c27c13d5b08174518c758ecd814f158f2b4a337
└── 0x87a580d31d7bc69069b55f5a01995a610dd391a26dc9e36e81057a17211983a79266800ab8531f21f1083d7d84085007
Expand Down
2 changes: 1 addition & 1 deletion lighthouse/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ fn main() {
.short("d")
.value_name("DIR")
.global(true)
.help("Data directory for lighthouse keys and databases.")
.help("Root data directory for lighthouse keys and databases. Defaults to ~/.lighthouse")
.takes_value(true),
)
.arg(
Expand Down
2 changes: 1 addition & 1 deletion validator_client/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
"The directory which contains the password to unlock the validator \
voting keypairs. Each password should be contained in a file where the \
name is the 0x-prefixed hex representation of the validators voting public \
key. Defaults to ~/.lighthouse/secrets.",
key. Defaults to ~/.lighthouse/{testnet}/secrets.",
)
.takes_value(true),
)
Expand Down
11 changes: 5 additions & 6 deletions validator_client/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use clap::ArgMatches;
use clap_utils::{parse_optional, parse_path_with_default_in_home_dir};
use directory::{get_testnet_dir, DEFAULT_SECRET_DIR, DEFAULT_VALIDATOR_DIR};
use directory::{get_testnet_dir, DEFAULT_ROOT_DIR, DEFAULT_SECRET_DIR, DEFAULT_VALIDATOR_DIR};
use serde_derive::{Deserialize, Serialize};
use std::path::PathBuf;
use types::{Graffiti, GRAFFITI_BYTES_LEN};

pub const DEFAULT_HTTP_SERVER: &str = "http://localhost:5052/";
pub const DEFAULT_DATADIR: &str = ".lighthouse";
/// Path to the slashing protection database within the datadir.
pub const SLASHING_PROTECTION_FILENAME: &str = "slashing_protection.sqlite";

Expand Down Expand Up @@ -36,10 +35,10 @@ impl Default for Config {
/// Build a new configuration from defaults.
fn default() -> Self {
let data_dir = dirs::home_dir()
.map(|home| home.join(DEFAULT_DATADIR))
.map(|home| home.join(DEFAULT_ROOT_DIR))
.unwrap_or_else(|| PathBuf::from("."));
let secrets_dir = dirs::home_dir()
.map(|home| home.join(DEFAULT_DATADIR))
.map(|home| home.join(DEFAULT_ROOT_DIR))
.unwrap_or_else(|| PathBuf::from("."));
Self {
data_dir,
Expand All @@ -62,15 +61,15 @@ impl Config {
config.data_dir = parse_path_with_default_in_home_dir(
cli_args,
"datadir",
PathBuf::from(DEFAULT_DATADIR)
PathBuf::from(DEFAULT_ROOT_DIR)
.join(get_testnet_dir(cli_args))
.join(DEFAULT_VALIDATOR_DIR),
)?;

config.secrets_dir = parse_path_with_default_in_home_dir(
cli_args,
"secrets-dir",
PathBuf::from(DEFAULT_DATADIR)
PathBuf::from(DEFAULT_ROOT_DIR)
.join(get_testnet_dir(cli_args))
.join(DEFAULT_SECRET_DIR),
)?;
Expand Down

0 comments on commit ae533f3

Please sign in to comment.