Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions account_manager/src/validator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pub fn cli_app() -> Command {
"The path to search for validator directories. \
Defaults to ~/.lighthouse/{network}/validators",
)
.global(true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if there is a better way than adding .global(true) here, because the --validator-dir flag is defined before the subcommands import, create etc. So I think adding a global here is fine.

.action(ArgAction::Set)
.conflicts_with("datadir"),
)
Expand Down
18 changes: 9 additions & 9 deletions lighthouse/tests/account_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,9 @@ impl TestValidator {
store_withdrawal_key: bool,
) -> Result<Vec<String>, String> {
let mut cmd = validator_cmd();
cmd.arg(format!("--{}", VALIDATOR_DIR_FLAG))
cmd.arg(CREATE_CMD)
.arg(format!("--{}", VALIDATOR_DIR_FLAG))
.arg(self.validator_dir.clone().into_os_string())
.arg(CREATE_CMD)
.arg(format!("--{}", WALLETS_DIR_FLAG))
.arg(self.wallet.base_dir().into_os_string())
.arg(format!("--{}", WALLET_NAME_FLAG))
Expand Down Expand Up @@ -427,9 +427,9 @@ fn validator_import_launchpad() {
File::create(src_dir.path().join(NOT_KEYSTORE_NAME)).unwrap();

let mut child = validator_cmd()
.arg(IMPORT_CMD)
.arg(format!("--{}", VALIDATOR_DIR_FLAG))
.arg(dst_dir.path().as_os_str())
.arg(IMPORT_CMD)
.arg(format!("--{}", STDIN_INPUTS_FLAG)) // Using tty does not work well with tests.
.arg(format!("--{}", import::DIR_FLAG))
.arg(src_dir.path().as_os_str())
Expand Down Expand Up @@ -479,10 +479,10 @@ fn validator_import_launchpad() {
// Disable all the validators in validator_definition.
output_result(
validator_cmd()
.arg(format!("--{}", VALIDATOR_DIR_FLAG))
.arg(dst_dir.path().as_os_str())
.arg(MODIFY_CMD)
.arg(DISABLE)
.arg(format!("--{}", VALIDATOR_DIR_FLAG))
.arg(dst_dir.path().as_os_str())
.arg(format!("--{}", ALL)),
)
.unwrap();
Expand Down Expand Up @@ -514,10 +514,10 @@ fn validator_import_launchpad() {
// Enable keystore validator again
output_result(
validator_cmd()
.arg(format!("--{}", VALIDATOR_DIR_FLAG))
.arg(dst_dir.path().as_os_str())
.arg(MODIFY_CMD)
.arg(ENABLE)
.arg(format!("--{}", VALIDATOR_DIR_FLAG))
.arg(dst_dir.path().as_os_str())
.arg(format!("--{}", PUBKEY_FLAG))
.arg(format!("{}", keystore.public_key().unwrap())),
)
Expand Down Expand Up @@ -560,9 +560,9 @@ fn validator_import_launchpad_no_password_then_add_password() {

let validator_import_key_cmd = || {
validator_cmd()
.arg(IMPORT_CMD)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is good, as it moves the subcommand import (and other subcommands) to before the --validator-dir flag.

The test will only pass with the change in mod.rs to add .global(true) to allow subcommands such as import be placed before the --valdiator-dir

.arg(format!("--{}", VALIDATOR_DIR_FLAG))
.arg(dst_dir.path().as_os_str())
.arg(IMPORT_CMD)
.arg(format!("--{}", STDIN_INPUTS_FLAG)) // Using tty does not work well with tests.
.arg(format!("--{}", import::DIR_FLAG))
.arg(src_dir.path().as_os_str())
Expand Down Expand Up @@ -700,9 +700,9 @@ fn validator_import_launchpad_password_file() {
.unwrap();

let mut child = validator_cmd()
.arg(IMPORT_CMD)
.arg(format!("--{}", VALIDATOR_DIR_FLAG))
.arg(dst_dir.path().as_os_str())
.arg(IMPORT_CMD)
.arg(format!("--{}", import::DIR_FLAG))
.arg(src_dir.path().as_os_str())
.arg(format!("--{}", import::REUSE_PASSWORD_FLAG))
Expand Down
Loading