Skip to content

Commit 31df250

Browse files
authoredJan 3, 2025··
Electra: Update spec definition for process_registry_updates (#14767)
* Electra: review process_registry_updates * Update CHANGELOG.md
1 parent 8a439a6 commit 31df250

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed
 

‎CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve
3131
- Limit consolidating by validator's effective balance.
3232
- Use 16-bit random value for proposer and sync committee selection filter.
3333
- Re-organize the content of the `*.proto` files (No functional change).
34+
- Updated spec definition electra `process_registry_updates`.
3435
- Updated Electra spec definition for `process_epoch`.
3536
- Update our `go-libp2p-pubsub` dependency.
3637
- Re-organize the content of files to ease the creation of a new fork boilerplate.

‎beacon-chain/core/electra/registry_updates.go

+17-16
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,24 @@ import (
1818
//
1919
// Spec pseudocode definition:
2020
//
21-
// def process_registry_updates(state: BeaconState) -> None:
22-
// # Process activation eligibility and ejections
23-
// for index, validator in enumerate(state.validators):
24-
// if is_eligible_for_activation_queue(validator):
25-
// validator.activation_eligibility_epoch = get_current_epoch(state) + 1
21+
// def process_registry_updates(state: BeaconState) -> None:
22+
// # Process activation eligibility and ejections
23+
// for index, validator in enumerate(state.validators):
24+
// if is_eligible_for_activation_queue(validator): # [Modified in Electra:EIP7251]
25+
// validator.activation_eligibility_epoch = get_current_epoch(state) + 1
2626
//
27-
// if (
28-
// is_active_validator(validator, get_current_epoch(state))
29-
// and validator.effective_balance <= EJECTION_BALANCE
30-
// ):
31-
// initiate_validator_exit(state, ValidatorIndex(index))
27+
// if (
28+
// is_active_validator(validator, get_current_epoch(state))
29+
// and validator.effective_balance <= EJECTION_BALANCE
30+
// ):
31+
// initiate_validator_exit(state, ValidatorIndex(index)) # [Modified in Electra:EIP7251]
3232
//
33-
// # Activate all eligible validators
34-
// activation_epoch = compute_activation_exit_epoch(get_current_epoch(state))
35-
// for validator in state.validators:
36-
// if is_eligible_for_activation(state, validator):
37-
// validator.activation_epoch = activation_epoch
33+
// # Activate all eligible validators
34+
// # [Modified in Electra:EIP7251]
35+
// activation_epoch = compute_activation_exit_epoch(get_current_epoch(state))
36+
// for validator in state.validators:
37+
// if is_eligible_for_activation(state, validator):
38+
// validator.activation_epoch = activation_epoch
3839
func ProcessRegistryUpdates(ctx context.Context, st state.BeaconState) error {
3940
currentEpoch := time.CurrentEpoch(st)
4041
ejectionBal := params.BeaconConfig().EjectionBalance
@@ -90,8 +91,8 @@ func ProcessRegistryUpdates(ctx context.Context, st state.BeaconState) error {
9091
}
9192
}
9293

94+
// Activate all eligible validators.
9395
for _, idx := range eligibleForActivation {
94-
// Activate all eligible validators.
9596
v, err := st.ValidatorAtIndex(idx)
9697
if err != nil {
9798
return err

0 commit comments

Comments
 (0)
Please sign in to comment.