Skip to content

Commit

Permalink
Refactor process_registry_updates()
Browse files Browse the repository at this point in the history
  • Loading branch information
EchoAlice committed Apr 22, 2024
1 parent 4488417 commit d696fa0
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions ethereum-consensus/src/electra/epoch_processing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ pub fn process_registry_updates<
>,
context: &Context,
) -> Result<()> {
// Process activation eligibility and ejections
let current_epoch = get_current_epoch(state, context);
for i in 0..state.validators.len() {
let validator = &mut state.validators[i];
Expand All @@ -49,21 +48,14 @@ pub fn process_registry_updates<
}
}

// Note: Name changed from `activation_exit_epoch` (Deneb) to `activation_epoch` (Electra) in
// spec.
let activation_epoch = compute_activation_exit_epoch(current_epoch, context);
let mut eligible_val_indices = Vec::new();
for i in 0..state.validators.len() {
let validator = &state.validators[i];
if is_eligible_for_activation(state, validator) {
eligible_val_indices.push(i);
let validator = &mut state.validators[i];
validator.activation_epoch = activation_epoch;
}
}

for i in eligible_val_indices.iter() {
let validator = &mut state.validators[*i];
validator.activation_epoch = activation_epoch;
}

Ok(())
}

0 comments on commit d696fa0

Please sign in to comment.