Skip to content

Commit 6938dcc

Browse files
committed
simplify name of helper get_validator_max_effective_balance
1 parent 2b4d94a commit 6938dcc

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

specs/electra/beacon-chain.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
- [Modified `is_partially_withdrawable_validator`](#modified-is_partially_withdrawable_validator)
5151
- [Misc](#misc-1)
5252
- [New `get_committee_indices`](#new-get_committee_indices)
53-
- [New `get_validator_max_effective_balance`](#new-get_validator_max_effective_balance)
53+
- [New `get_max_effective_balance`](#new-get_max_effective_balance)
5454
- [Beacon state accessors](#beacon-state-accessors)
5555
- [New `get_balance_churn_limit`](#new-get_balance_churn_limit)
5656
- [New `get_activation_exit_churn_limit`](#new-get_activation_exit_churn_limit)
@@ -512,14 +512,14 @@ def is_fully_withdrawable_validator(validator: Validator, balance: Gwei, epoch:
512512

513513
#### Modified `is_partially_withdrawable_validator`
514514

515-
*Note*: The function `is_partially_withdrawable_validator` is modified to use `get_validator_max_effective_balance` instead of `MAX_EFFECTIVE_BALANCE` and `has_execution_withdrawal_credential` instead of `has_eth1_withdrawal_credential`.
515+
*Note*: The function `is_partially_withdrawable_validator` is modified to use `get_max_effective_balance` instead of `MAX_EFFECTIVE_BALANCE` and `has_execution_withdrawal_credential` instead of `has_eth1_withdrawal_credential`.
516516

517517
```python
518518
def is_partially_withdrawable_validator(validator: Validator, balance: Gwei) -> bool:
519519
"""
520520
Check if ``validator`` is partially withdrawable.
521521
"""
522-
max_effective_balance = get_validator_max_effective_balance(validator)
522+
max_effective_balance = get_max_effective_balance(validator)
523523
has_max_effective_balance = validator.effective_balance == max_effective_balance # [Modified in Electra:EIP7251]
524524
has_excess_balance = balance > max_effective_balance # [Modified in Electra:EIP7251]
525525
return (
@@ -538,10 +538,10 @@ def get_committee_indices(committee_bits: Bitvector) -> Sequence[CommitteeIndex]
538538
return [CommitteeIndex(index) for index, bit in enumerate(committee_bits) if bit]
539539
```
540540

541-
#### New `get_validator_max_effective_balance`
541+
#### New `get_max_effective_balance`
542542

543543
```python
544-
def get_validator_max_effective_balance(validator: Validator) -> Gwei:
544+
def get_max_effective_balance(validator: Validator) -> Gwei:
545545
"""
546546
Get max effective balance for ``validator``.
547547
"""
@@ -588,7 +588,7 @@ def get_consolidation_churn_limit(state: BeaconState) -> Gwei:
588588

589589
```python
590590
def get_active_balance(state: BeaconState, validator_index: ValidatorIndex) -> Gwei:
591-
max_effective_balance = get_validator_max_effective_balance(state.validators[validator_index])
591+
max_effective_balance = get_max_effective_balance(state.validators[validator_index])
592592
return min(state.balances[validator_index], max_effective_balance)
593593
```
594594

@@ -875,7 +875,7 @@ def process_pending_balance_deposits(state: BeaconState) -> None:
875875
if processed_amount + deposit.amount > available_for_processing:
876876
break
877877
# Deposit fits in the churn, process it. Increase balance and consume churn.
878-
else:
878+
else:
879879
increase_balance(state, deposit.index, deposit.amount)
880880
processed_amount += deposit.amount
881881
# Regardless of how the deposit was handled, we move on in the queue.
@@ -1005,7 +1005,7 @@ def get_expected_withdrawals(state: BeaconState) -> Tuple[Sequence[Withdrawal],
10051005
index=withdrawal_index,
10061006
validator_index=validator_index,
10071007
address=ExecutionAddress(validator.withdrawal_credentials[12:]),
1008-
amount=balance - get_validator_max_effective_balance(validator), # [Modified in Electra:EIP7251]
1008+
amount=balance - get_max_effective_balance(validator), # [Modified in Electra:EIP7251]
10091009
))
10101010
withdrawal_index += WithdrawalIndex(1)
10111011
if len(withdrawals) == MAX_WITHDRAWALS_PER_PAYLOAD:
@@ -1495,7 +1495,7 @@ def initialize_beacon_state_from_eth1(eth1_block_hash: Hash32,
14951495
balance = state.balances[index]
14961496
# [Modified in Electra:EIP7251]
14971497
validator.effective_balance = min(
1498-
balance - balance % EFFECTIVE_BALANCE_INCREMENT, get_validator_max_effective_balance(validator))
1498+
balance - balance % EFFECTIVE_BALANCE_INCREMENT, get_max_effective_balance(validator))
14991499
if validator.effective_balance >= MIN_ACTIVATION_BALANCE:
15001500
validator.activation_eligibility_epoch = GENESIS_EPOCH
15011501
validator.activation_epoch = GENESIS_EPOCH

0 commit comments

Comments
 (0)