Skip to content

Commit

Permalink
Minor documentation fixes (#1297)
Browse files Browse the repository at this point in the history
## Issue Addressed

N/A

## Proposed Changes

- Fix a wrong command in the validator generation example.
- Replace occurrences of 'passphrase' with 'password'. This is mostly because I felt that there was a lot of mixing of the two phrases in the documentation and the actual commands which is a bit confusing. Picked 'password' everywhere because it felt more appropriate but I don't mind changing it to 'passphrase' as long it's consistent everywhere.
  • Loading branch information
pawanjay176 committed Sep 2, 2020
1 parent fb9d828 commit 8718120
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 23 deletions.
9 changes: 4 additions & 5 deletions account_manager/src/validator/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use validator_dir::Builder as ValidatorDirBuilder;
pub const CMD: &str = "create";
pub const BASE_DIR_FLAG: &str = "base-dir";
pub const WALLET_NAME_FLAG: &str = "wallet-name";
pub const WALLET_PASSPHRASE_FLAG: &str = "wallet-passphrase";
pub const WALLET_PASSWORD_FLAG: &str = "wallet-password";
pub const DEPOSIT_GWEI_FLAG: &str = "deposit-gwei";
pub const STORE_WITHDRAW_FLAG: &str = "store-withdrawal-keystore";
pub const COUNT_FLAG: &str = "count";
Expand All @@ -34,8 +34,8 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
.required(true),
)
.arg(
Arg::with_name(WALLET_PASSPHRASE_FLAG)
.long(WALLET_PASSPHRASE_FLAG)
Arg::with_name(WALLET_PASSWORD_FLAG)
.long(WALLET_PASSWORD_FLAG)
.value_name("WALLET_PASSWORD_PATH")
.help("A path to a file containing the password which will unlock the wallet.")
.takes_value(true)
Expand Down Expand Up @@ -109,8 +109,7 @@ pub fn cli_run<T: EthSpec>(
let spec = env.core_context().eth2_config.spec;

let name: String = clap_utils::parse_required(matches, WALLET_NAME_FLAG)?;
let wallet_password_path: PathBuf =
clap_utils::parse_required(matches, WALLET_PASSPHRASE_FLAG)?;
let wallet_password_path: PathBuf = clap_utils::parse_required(matches, WALLET_PASSWORD_FLAG)?;
let validator_dir = clap_utils::parse_path_with_default_in_home_dir(
matches,
VALIDATOR_DIR_FLAG,
Expand Down
10 changes: 5 additions & 5 deletions account_manager/src/wallet/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use std::path::{Path, PathBuf};
pub const CMD: &str = "create";
pub const HD_TYPE: &str = "hd";
pub const NAME_FLAG: &str = "name";
pub const PASSPHRASE_FLAG: &str = "passphrase-file";
pub const PASSWORD_FLAG: &str = "password-file";
pub const TYPE_FLAG: &str = "type";
pub const MNEMONIC_FLAG: &str = "mnemonic-output-path";

Expand All @@ -34,8 +34,8 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
.required(true),
)
.arg(
Arg::with_name(PASSPHRASE_FLAG)
.long(PASSPHRASE_FLAG)
Arg::with_name(PASSWORD_FLAG)
.long(PASSWORD_FLAG)
.value_name("WALLET_PASSWORD_PATH")
.help(
"A path to a file containing the password which will unlock the wallet. \
Expand Down Expand Up @@ -71,7 +71,7 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {

pub fn cli_run(matches: &ArgMatches, base_dir: PathBuf) -> Result<(), String> {
let name: String = clap_utils::parse_required(matches, NAME_FLAG)?;
let wallet_password_path: PathBuf = clap_utils::parse_required(matches, PASSPHRASE_FLAG)?;
let wallet_password_path: PathBuf = clap_utils::parse_required(matches, PASSWORD_FLAG)?;
let mnemonic_output_path: Option<PathBuf> = clap_utils::parse_optional(matches, MNEMONIC_FLAG)?;
let type_field: String = clap_utils::parse_required(matches, TYPE_FLAG)?;

Expand All @@ -90,7 +90,7 @@ pub fn cli_run(matches: &ArgMatches, base_dir: PathBuf) -> Result<(), String> {

// Create a random password if the file does not exist.
if !wallet_password_path.exists() {
// To prevent users from accidentally supplying their password to the PASSPHRASE_FLAG and
// To prevent users from accidentally supplying their password to the PASSWORD_FLAG and
// create a file with that name, we require that the password has a .pass suffix.
if wallet_password_path.extension() != Some(&OsStr::new("pass")) {
return Err(format!(
Expand Down
4 changes: 2 additions & 2 deletions book/src/become-a-validator-source.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ validator](./validator-create.md). A two-step example follows:
Create a wallet with:

```bash
lighthouse --testnet medalla account wallet create --name my-validators --passphrase-file my-validators.pass
lighthouse --testnet medalla account wallet create --name my-validators --password-file my-validators.pass
```

The output will look like this:
Expand Down Expand Up @@ -124,7 +124,7 @@ used to restore your validator if there is a data loss.
Create a validator from the wallet with:

```bash
lighthouse --testnet medalla account validator create --wallet-name my-validators --wallet-passphrase my-validators.pass --count 1
lighthouse --testnet medalla account validator create --wallet-name my-validators --wallet-password my-validators.pass --count 1
```

The output will look like this:
Expand Down
4 changes: 2 additions & 2 deletions book/src/key-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ items, starting at one easy-to-backup mnemonic and ending with multiple
keypairs. Creating a single validator looks like this:

1. Create a **wallet** and record the **mnemonic**:
- `lighthouse account wallet create --name wally --passphrase-file wally.pass`
- `lighthouse account wallet create --name wally --password-file wally.pass`
1. Create the voting and withdrawal **keystores** for one validator:
- `lighthouse account validator create --wallet-name wally --wallet-passphrase wally.pass --count 1`
- `lighthouse account validator create --wallet-name wally --wallet-password wally.pass --count 1`


In step (1), we created a wallet in `~/.lighthouse/wallets` with the name
Expand Down
8 changes: 4 additions & 4 deletions book/src/validator-create.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ lighthouse account validator create --help
Creates new validators from an existing EIP-2386 wallet using the EIP-2333 HD key derivation scheme.

USAGE:
lighthouse account_manager validator create [FLAGS] [OPTIONS] --wallet-name <WALLET_NAME> --wallet-passphrase <WALLET_PASSWORD_PATH>
lighthouse account_manager validator create [FLAGS] [OPTIONS] --wallet-name <WALLET_NAME> --wallet-password <WALLET_PASSWORD_PATH>

FLAGS:
-h, --help Prints help information
Expand Down Expand Up @@ -56,7 +56,7 @@ OPTIONS:
The path where the validator directories will be created. Defaults to ~/.lighthouse/validators

--wallet-name <WALLET_NAME> Use the wallet identified by this name
--wallet-passphrase <WALLET_PASSWORD_PATH>
--wallet-password <WALLET_PASSWORD_PATH>
A path to a file containing the password which will unlock the wallet.
```
Expand All @@ -66,12 +66,12 @@ The example assumes that the `wally` wallet was generated from the
[wallet](./wallet-create.md) example.
```bash
lighthouse --testnet medalla account validator create --name wally --wallet-passphrase wally.pass --count 1
lighthouse --testnet medalla account validator create --name wally --wallet-password wally.pass --count 1
```
This command will:
- Derive a new BLS keypair from `wally`, updating it so that it generates a
- Derive a single new BLS keypair from `wally`, updating it so that it generates a
new key next time.
- Create a new directory in `~/.lighthouse/validators` containing:
- An encrypted keystore containing the validators voting keypair.
Expand Down
6 changes: 3 additions & 3 deletions book/src/wallet-create.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ lighthouse account wallet create --help
Creates a new HD (hierarchical-deterministic) EIP-2386 wallet.

USAGE:
lighthouse account_manager wallet create [OPTIONS] --name <WALLET_NAME> --passphrase-file <WALLET_PASSWORD_PATH>
lighthouse account_manager wallet create [OPTIONS] --name <WALLET_NAME> --password-file <WALLET_PASSWORD_PATH>

FLAGS:
-h, --help Prints help information
Expand All @@ -39,7 +39,7 @@ OPTIONS:
--name <WALLET_NAME>
The wallet will be created with this name. It is not allowed to create two wallets with the same name for
the same --base-dir.
--passphrase-file <WALLET_PASSWORD_PATH>
--password-file <WALLET_PASSWORD_PATH>
A path to a file containing the password which will unlock the wallet. If the file does not exist, a random
password will be generated and saved at that path. To avoid confusion, if the file does not already exist it
must include a '.pass' suffix.
Expand All @@ -61,7 +61,7 @@ Creates a new wallet named `wally` with a randomly generated password saved
to `./wallet.pass`:
```bash
lighthouse account wallet create --name wally --passphrase-file wally.pass
lighthouse account wallet create --name wally --password-file wally.pass
```
> Notes:
Expand Down
4 changes: 2 additions & 2 deletions lighthouse/tests/account_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ fn create_wallet<P: AsRef<Path>>(
.arg(CREATE_CMD)
.arg(format!("--{}", NAME_FLAG))
.arg(&name)
.arg(format!("--{}", PASSPHRASE_FLAG))
.arg(format!("--{}", PASSWORD_FLAG))
.arg(password.as_ref().as_os_str())
.arg(format!("--{}", MNEMONIC_FLAG))
.arg(mnemonic.as_ref().as_os_str()),
Expand Down Expand Up @@ -238,7 +238,7 @@ impl TestValidator {
.arg(CREATE_CMD)
.arg(format!("--{}", WALLET_NAME_FLAG))
.arg(&self.wallet.name)
.arg(format!("--{}", WALLET_PASSPHRASE_FLAG))
.arg(format!("--{}", WALLET_PASSWORD_FLAG))
.arg(self.wallet.password_path().into_os_string())
.arg(format!("--{}", VALIDATOR_DIR_FLAG))
.arg(self.validator_dir.clone().into_os_string())
Expand Down

0 comments on commit 8718120

Please sign in to comment.