mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 09:16:00 +00:00
Remove validators subcommand
This commit is contained in:
@@ -1,12 +1,15 @@
|
|||||||
use clap::App;
|
use clap::App;
|
||||||
use clap::ArgMatches;
|
use clap::ArgMatches;
|
||||||
|
use common::write_to_json_file;
|
||||||
use environment::Environment;
|
use environment::Environment;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use types::EthSpec;
|
use types::EthSpec;
|
||||||
use validators::common::write_to_json_file;
|
|
||||||
|
|
||||||
pub mod validators;
|
pub mod common;
|
||||||
|
pub mod create_validators;
|
||||||
|
pub mod import_validators;
|
||||||
|
pub mod move_validators;
|
||||||
|
|
||||||
pub const CMD: &str = "validator_manager";
|
pub const CMD: &str = "validator_manager";
|
||||||
|
|
||||||
@@ -39,7 +42,9 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
|
|||||||
App::new(CMD)
|
App::new(CMD)
|
||||||
.visible_aliases(&["vm", "validator-manager", CMD])
|
.visible_aliases(&["vm", "validator-manager", CMD])
|
||||||
.about("Utilities for managing a Lighthouse validator client via the HTTP API.")
|
.about("Utilities for managing a Lighthouse validator client via the HTTP API.")
|
||||||
.subcommand(validators::cli_app())
|
.subcommand(create_validators::cli_app())
|
||||||
|
.subcommand(import_validators::cli_app())
|
||||||
|
.subcommand(move_validators::cli_app())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Run the account manager, returning an error if the operation did not succeed.
|
/// Run the account manager, returning an error if the operation did not succeed.
|
||||||
@@ -58,8 +63,14 @@ pub fn run<'a, T: EthSpec>(matches: &'a ArgMatches<'a>, env: Environment<T>) ->
|
|||||||
.block_on_dangerous(
|
.block_on_dangerous(
|
||||||
async {
|
async {
|
||||||
match matches.subcommand() {
|
match matches.subcommand() {
|
||||||
(validators::CMD, Some(matches)) => {
|
(create_validators::CMD, Some(matches)) => {
|
||||||
validators::cli_run::<T>(matches, &spec, dump_config).await
|
create_validators::cli_run::<T>(matches, &spec, dump_config).await
|
||||||
|
}
|
||||||
|
(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
|
||||||
}
|
}
|
||||||
("", _) => Err("No command supplied. See --help.".to_string()),
|
("", _) => Err("No command supplied. See --help.".to_string()),
|
||||||
(unknown, _) => Err(format!(
|
(unknown, _) => Err(format!(
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ async fn run<'a>(config: MoveConfig) -> Result<(), String> {
|
|||||||
.filter(|v| !v.readonly.unwrap_or(true))
|
.filter(|v| !v.readonly.unwrap_or(true))
|
||||||
.map(|v| v.validating_pubkey)
|
.map(|v| v.validating_pubkey)
|
||||||
.collect();
|
.collect();
|
||||||
viable_pubkeys.sort_unstable_by_key(|pubkey| pubkey.serialize());
|
viable_pubkeys.sort_unstable_by_key(PublicKeyBytes::serialize);
|
||||||
viable_pubkeys
|
viable_pubkeys
|
||||||
.get(0..count)
|
.get(0..count)
|
||||||
.ok_or_else(|| {
|
.ok_or_else(|| {
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
pub mod common;
|
|
||||||
pub mod create_validators;
|
|
||||||
pub mod import_validators;
|
|
||||||
pub mod move_validators;
|
|
||||||
|
|
||||||
use crate::DumpConfig;
|
|
||||||
use clap::{App, ArgMatches};
|
|
||||||
use types::{ChainSpec, EthSpec};
|
|
||||||
|
|
||||||
pub const CMD: &str = "validators";
|
|
||||||
|
|
||||||
pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
|
|
||||||
App::new(CMD)
|
|
||||||
.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>(
|
|
||||||
matches: &'a ArgMatches<'a>,
|
|
||||||
spec: &ChainSpec,
|
|
||||||
dump_config: DumpConfig,
|
|
||||||
) -> Result<(), String> {
|
|
||||||
match matches.subcommand() {
|
|
||||||
(create_validators::CMD, Some(matches)) => {
|
|
||||||
create_validators::cli_run::<T>(matches, spec, dump_config).await
|
|
||||||
}
|
|
||||||
(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
|
|
||||||
)),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user