Skip to content

Commit

Permalink
add some comments and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ralexstokes committed Apr 6, 2024
1 parent a6b4cf4 commit 9d94a64
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions specs/_features/eip7251/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,9 @@ def process_epoch(state: BeaconState) -> None:

#### Updated `process_registry_updates`

`process_registry_updates` uses the updated definition of `initiate_validator_exit`
and changes how the activation epochs are computed for eligible validators.

```python
def process_registry_updates(state: BeaconState) -> None:
# Process activation eligibility and ejections
Expand Down Expand Up @@ -693,6 +696,8 @@ def process_pending_consolidations(state: BeaconState) -> None:

#### Updated `process_effective_balance_updates`

`process_effective_balance_updates` is updated with a new limit for the maximum effective balance.

```python
def process_effective_balance_updates(state: BeaconState) -> None:
# Update effective balances with hysteresis
Expand Down Expand Up @@ -834,14 +839,16 @@ def process_operations(state: BeaconState, body: BeaconBlockBody) -> None:
for_ops(body.deposits, process_deposit) # [Modified in EIP7251]
for_ops(body.voluntary_exits, process_voluntary_exit) # [Modified in EIP7251]
for_ops(body.bls_to_execution_changes, process_bls_to_execution_change)
for_ops(body.execution_payload.withdraw_requests, process_execution_layer_withdraw_request) # New in EIP7251
for_ops(body.consolidations, process_consolidation) # New in EIP7251
for_ops(body.execution_payload.withdraw_requests, process_execution_layer_withdraw_request) # [New in EIP7251]
for_ops(body.consolidations, process_consolidation) # [New in EIP7251]
```

##### Deposits

###### Updated `apply_deposit`

*NOTE*: `process_deposit` is updated with a new definition of `apply_deposit`.

```python
def apply_deposit(state: BeaconState,
pubkey: BLSPubkey,
Expand Down Expand Up @@ -1044,7 +1051,7 @@ def process_voluntary_exit(state: BeaconState, signed_voluntary_exit: SignedVolu
assert get_current_epoch(state) >= voluntary_exit.epoch
# Verify the validator has been active long enough
assert get_current_epoch(state) >= validator.activation_epoch + SHARD_COMMITTEE_PERIOD
# Only exit validator if it has no pending withdrawals in the queue
# [New in EIP-7251] Only exit validator if it has no pending withdrawals in the queue
assert get_pending_balance_to_withdraw(state, voluntary_exit.validator_index) == 0 # [New in EIP7251]
# Verify signature
domain = compute_domain(DOMAIN_VOLUNTARY_EXIT, CAPELLA_FORK_VERSION, state.genesis_validators_root)
Expand Down

0 comments on commit 9d94a64

Please sign in to comment.