Skip to content

Commit 0301d55

Browse files
committed
Add "all" to exit all validators
1 parent d9c423d commit 0301d55

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

validator_manager/src/exit_validators.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,14 @@ impl ExitConfig {
7777
fn from_cli(matches: &ArgMatches) -> Result<Self, String> {
7878
let validators_to_exit_str = clap_utils::parse_required::<String>(matches, VALIDATOR_FLAG)?;
7979

80-
let validators_to_exit = validators_to_exit_str
81-
.split(',')
82-
.map(|s| s.trim().parse())
83-
.collect::<Result<Vec<PublicKeyBytes>, _>>()?;
80+
let validators_to_exit = if validators_to_exit_str.trim() == "all" {
81+
Vec::new()
82+
} else {
83+
validators_to_exit_str
84+
.split(',')
85+
.map(|s| s.trim().parse())
86+
.collect::<Result<Vec<PublicKeyBytes>, _>>()?
87+
};
8488

8589
Ok(Self {
8690
vc_url: clap_utils::parse_required(matches, VC_URL_FLAG)?,
@@ -106,13 +110,16 @@ async fn run(config: ExitConfig) -> Result<(), String> {
106110
let ExitConfig {
107111
vc_url,
108112
vc_token_path,
109-
validators_to_exit,
113+
mut validators_to_exit,
110114
beacon_url,
111115
exit_epoch,
112116
} = config;
113117

114118
let (http_client, validators) = vc_http_client(vc_url.clone(), &vc_token_path).await?;
115119

120+
if validators_to_exit.is_empty() {
121+
validators_to_exit = validators.iter().map(|v| v.validating_pubkey).collect();
122+
}
116123
// Check that the validators_to_exit is in the validator client
117124
for validator_to_exit in &validators_to_exit {
118125
if !validators

0 commit comments

Comments
 (0)