Add move tests, "builder-proposals" takes bool

This commit is contained in:
Paul Hauner
2022-08-25 11:29:31 +10:00
parent 0c786c0ee2
commit 7f89f1efa7
4 changed files with 122 additions and 14 deletions

View File

@@ -158,7 +158,9 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
"When provided, all created validators will attempt to create \
blocks via builder rather than the local EL.",
)
.required(false),
.required(false)
.possible_values(&["true", "false"])
.takes_value(true),
)
.arg(
Arg::with_name(BEACON_NODE_FLAG)
@@ -188,7 +190,7 @@ pub struct CreateConfig {
pub disable_deposits: bool,
pub specify_voting_keystore_password: bool,
pub eth1_withdrawal_address: Option<Address>,
pub builder_proposals: bool,
pub builder_proposals: Option<bool>,
pub fee_recipient: Option<Address>,
pub gas_limit: Option<u64>,
pub bn_url: Option<SensitiveUrl>,
@@ -211,7 +213,7 @@ impl CreateConfig {
matches,
ETH1_WITHDRAWAL_ADDRESS_FLAG,
)?,
builder_proposals: matches.is_present(BUILDER_PROPOSALS_FLAG),
builder_proposals: clap_utils::parse_optional(matches, BUILDER_PROPOSALS_FLAG)?,
fee_recipient: clap_utils::parse_optional(matches, FEE_RECIPIENT_FLAG)?,
gas_limit: clap_utils::parse_optional(matches, GAS_LIMIT_FLAG)?,
bn_url: clap_utils::parse_optional(matches, BEACON_NODE_FLAG)?,
@@ -433,8 +435,11 @@ impl ValidatorsAndDeposits {
slashing_protection: None,
fee_recipient,
gas_limit,
builder_proposals: Some(builder_proposals),
enabled: Some(true),
builder_proposals,
// Allow the VC to choose a default "enabled" state. Since "enabled" is not part of
// the standard API, leaving this as `None` means we are not forced to use the
// non-standard API.
enabled: None,
};
eprintln!(

View File

@@ -14,6 +14,7 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
.about("Provides commands for managing validators in a Lighthouse Validator Client.")
.subcommand(create_validators::cli_app())
.subcommand(import_validators::cli_app())
.subcommand(move_validators::cli_app())
}
pub async fn cli_run<'a, T: EthSpec>(
@@ -28,6 +29,9 @@ pub async fn cli_run<'a, T: EthSpec>(
(import_validators::CMD, Some(matches)) => {
import_validators::cli_run(matches, dump_config).await
}
(move_validators::CMD, Some(matches)) => {
move_validators::cli_run(matches, dump_config).await
}
(unknown, _) => Err(format!(
"{} does not have a {} command. See --help",
CMD, unknown

View File

@@ -124,7 +124,9 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
"When provided, all created validators will attempt to create \
blocks via builder rather than the local EL.",
)
.required(false),
.required(false)
.possible_values(&["true", "false"])
.takes_value(true),
)
}
@@ -156,7 +158,7 @@ pub struct MoveConfig {
pub dest_vc_url: SensitiveUrl,
pub dest_vc_token_path: PathBuf,
pub validators: Validators,
pub builder_proposals: bool,
pub builder_proposals: Option<bool>,
pub fee_recipient: Option<Address>,
pub gas_limit: Option<u64>,
}
@@ -175,7 +177,7 @@ impl MoveConfig {
DEST_VALIDATOR_CLIENT_TOKEN_FLAG,
)?,
validators: clap_utils::parse_required(matches, VALIDATORS_FLAG)?,
builder_proposals: matches.is_present(BUILDER_PROPOSALS_FLAG),
builder_proposals: clap_utils::parse_optional(matches, BUILDER_PROPOSALS_FLAG)?,
fee_recipient: clap_utils::parse_optional(matches, FEE_RECIPIENT_FLAG)?,
gas_limit: clap_utils::parse_optional(matches, GAS_LIMIT_FLAG)?,
})
@@ -388,8 +390,11 @@ async fn run<'a>(config: MoveConfig) -> Result<(), String> {
slashing_protection: Some(InterchangeJsonStr(slashing_protection)),
fee_recipient,
gas_limit,
builder_proposals: Some(builder_proposals),
enabled: Some(true),
builder_proposals,
// Allow the VC to choose a default "enabled" state. Since "enabled" is not part of
// the standard API, leaving this as `None` means we are not forced to use the
// non-standard API.
enabled: None,
};
// We might as well just ignore validators that already exist on the destination machine,