Skip to content

Commit

Permalink
check pending deposits before adding voluntary exit to block
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfyone committed Jan 21, 2025
1 parent 9a0b3ef commit 13fb42b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions specs/electra/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
- [New `get_activation_exit_churn_limit`](#new-get_activation_exit_churn_limit)
- [New `get_consolidation_churn_limit`](#new-get_consolidation_churn_limit)
- [New `get_pending_balance_to_withdraw`](#new-get_pending_balance_to_withdraw)
- [New `get_pending_deposits_for_validator`](#new-get_pending_deposits_for_validator)
- [Modified `get_attesting_indices`](#modified-get_attesting_indices)
- [Modified `get_next_sync_committee_indices`](#modified-get_next_sync_committee_indices)
- [Beacon state mutators](#beacon-state-mutators)
Expand Down Expand Up @@ -593,6 +594,17 @@ def get_pending_balance_to_withdraw(state: BeaconState, validator_index: Validat
)
```

#### New `new-get_pending_deposits_for_validator`

```python
def get_pending_deposits_for_validator(state: BeaconState, pubkey: BLSPubkey) -> Gwei:
return sum(
deposit.amount for deposit in state.pending_deposits
if deposit.pubkey == pubkey
)
```


#### Modified `get_attesting_indices`

*Note*: The function `get_attesting_indices` is modified to support EIP7549.
Expand Down Expand Up @@ -1498,6 +1510,7 @@ def process_voluntary_exit(state: BeaconState, signed_voluntary_exit: SignedVolu
assert get_current_epoch(state) >= validator.activation_epoch + SHARD_COMMITTEE_PERIOD
# 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 Electra:EIP7251]
assert get_pending_deposits_for_validator(state, voluntary_exit.pubkey) == 0 # [New in Electra:EIP7251]
# Verify signature
domain = compute_domain(DOMAIN_VOLUNTARY_EXIT, CAPELLA_FORK_VERSION, state.genesis_validators_root)
signing_root = compute_signing_root(voluntary_exit, domain)
Expand Down

0 comments on commit 13fb42b

Please sign in to comment.