Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions specs/electra/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -816,27 +816,24 @@ def process_epoch(state: BeaconState) -> None:

#### Modified `process_registry_updates`

*Note*: The function `process_registry_updates` is modified to
use the updated definitions of `initiate_validator_exit` and `is_eligible_for_activation_queue`
and changes how the activation epochs are computed for eligible validators.
*Note*: The function `process_registry_updates` is modified to use the updated definitions of
`initiate_validator_exit` and `is_eligible_for_activation_queue`, changes how the activation epochs
are computed for eligible validators, and processes activations in the same loop as activation
eligibility updates and ejections.

```python
def process_registry_updates(state: BeaconState) -> None:
# Process activation eligibility and ejections
current_epoch = get_current_epoch(state)
activation_epoch = compute_activation_exit_epoch(current_epoch)

# Process activation eligibility, ejections, and activations
for index, validator in enumerate(state.validators):
if is_eligible_for_activation_queue(validator): # [Modified in Electra:EIP7251]
validator.activation_eligibility_epoch = get_current_epoch(state) + 1
validator.activation_eligibility_epoch = current_epoch + 1

if (
is_active_validator(validator, get_current_epoch(state))
and validator.effective_balance <= EJECTION_BALANCE
):
if is_active_validator(validator, current_epoch) and validator.effective_balance <= EJECTION_BALANCE:
initiate_validator_exit(state, ValidatorIndex(index)) # [Modified in Electra:EIP7251]

# Activate all eligible validators
# [Modified in Electra:EIP7251]
activation_epoch = compute_activation_exit_epoch(get_current_epoch(state))
for validator in state.validators:
if is_eligible_for_activation(state, validator):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these three ifs could also be elifs couldn't they, as they are mutually exclusive?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm yes they are mutually exclusive. Making those elif conditions is a good idea.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validator.activation_epoch = activation_epoch
```
Expand Down