@@ -106,6 +106,7 @@ impl ExitConfig {
106106 fn from_cli ( matches : & ArgMatches ) -> Result < Self , String > {
107107 let validators_to_exit_str = clap_utils:: parse_required :: < String > ( matches, VALIDATOR_FLAG ) ?;
108108
109+ // Keyword "all" to exit all validators, vector to be created later
109110 let validators_to_exit = if validators_to_exit_str. trim ( ) == "all" {
110111 Vec :: new ( )
111112 } else {
@@ -153,7 +154,6 @@ async fn run<E: EthSpec>(config: ExitConfig) -> Result<(), String> {
153154
154155 let ( http_client, validators) = vc_http_client ( vc_url. clone ( ) , & vc_token_path) . await ?;
155156
156- // Exit all validators on the VC
157157 if validators_to_exit. is_empty ( ) {
158158 validators_to_exit = validators. iter ( ) . map ( |v| v. validating_pubkey ) . collect ( ) ;
159159 }
@@ -180,7 +180,7 @@ async fn run<E: EthSpec>(config: ExitConfig) -> Result<(), String> {
180180 }
181181 }
182182
183- // only publish the voluntary exit if the --beacon-node flag is present
183+ // Only publish the voluntary exit if the --beacon-node flag is present
184184 if beacon_url. is_some ( ) {
185185 let beacon_node = if let Some ( ref beacon_url) = beacon_url {
186186 BeaconNodeHttpClient :: new (
@@ -238,32 +238,29 @@ async fn run<E: EthSpec>(config: ExitConfig) -> Result<(), String> {
238238 . ok_or ( "Failed to get current epoch. Please check your system time" ) ?;
239239
240240 // Check if validator is eligible for exit
241- if !exit_status {
242- if validator_data. status == ValidatorStatus :: ActiveOngoing
243- && current_epoch < activation_epoch + spec. shard_committee_period
244- {
245- eprintln ! (
241+ if validator_data. status == ValidatorStatus :: ActiveOngoing
242+ && current_epoch < activation_epoch + spec. shard_committee_period
243+ {
244+ eprintln ! (
246245 "Validator {} is not eligible for exit. It will become eligible at epoch {}" ,
247246 validator_to_exit,
248247 activation_epoch + spec. shard_committee_period
249248 )
250- } else if validator_data. status != ValidatorStatus :: ActiveOngoing {
251- eprintln ! (
252- "Validator {} is not eligible for exit. Validator status is: {:?}" ,
253- validator_to_exit, validator_data. status
254- )
255- } else {
256- // Only publish voluntary exit if validator status is ActiveOngoing
257- beacon_node
258- . post_beacon_pool_voluntary_exits ( & exit_message. data )
259- . await
260- . map_err ( |e| format ! ( "Failed to publish voluntary exit: {}" , e) ) ?;
261- // tokio::time::sleep(std::time::Duration::from_secs(1)).await; // Provides nicer UX.
262- eprintln ! (
263- "Successfully validated and published voluntary exit for validator {}" ,
264- validator_to_exit
265- ) ;
266- }
249+ } else if validator_data. status != ValidatorStatus :: ActiveOngoing {
250+ eprintln ! (
251+ "Validator {} is not eligible for exit. Validator status is: {:?}" ,
252+ validator_to_exit, validator_data. status
253+ )
254+ } else {
255+ // Only publish voluntary exit if validator status is ActiveOngoing
256+ beacon_node
257+ . post_beacon_pool_voluntary_exits ( & exit_message. data )
258+ . await
259+ . map_err ( |e| format ! ( "Failed to publish voluntary exit: {}" , e) ) ?;
260+ eprintln ! (
261+ "Successfully validated and published voluntary exit for validator {}" ,
262+ validator_to_exit
263+ ) ;
267264 }
268265
269266 // Check validator status after publishing voluntary exit
@@ -332,6 +329,7 @@ fn get_current_epoch<E: EthSpec>(genesis_time: u64, spec: &ChainSpec) -> Option<
332329 ) ;
333330 slot_clock. now ( ) . map ( |s| s. epoch ( E :: slots_per_epoch ( ) ) )
334331}
332+
335333#[ cfg( not( debug_assertions) ) ]
336334#[ cfg( test) ]
337335mod test {
0 commit comments