Remove queue_entire_balance_and_reset_validator (#3951)

This commit is contained in:
Pop Chunhapanya 2024-10-01 06:29:49 +07:00 committed by GitHub
parent ecb4c2aa9c
commit 85e2452301
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 16 deletions

View File

@ -60,7 +60,6 @@
- [Modified `initiate_validator_exit`](#modified-initiate_validator_exit) - [Modified `initiate_validator_exit`](#modified-initiate_validator_exit)
- [New `switch_to_compounding_validator`](#new-switch_to_compounding_validator) - [New `switch_to_compounding_validator`](#new-switch_to_compounding_validator)
- [New `queue_excess_active_balance`](#new-queue_excess_active_balance) - [New `queue_excess_active_balance`](#new-queue_excess_active_balance)
- [New `queue_entire_balance_and_reset_validator`](#new-queue_entire_balance_and_reset_validator)
- [New `compute_exit_epoch_and_update_churn`](#new-compute_exit_epoch_and_update_churn) - [New `compute_exit_epoch_and_update_churn`](#new-compute_exit_epoch_and_update_churn)
- [New `compute_consolidation_epoch_and_update_churn`](#new-compute_consolidation_epoch_and_update_churn) - [New `compute_consolidation_epoch_and_update_churn`](#new-compute_consolidation_epoch_and_update_churn)
- [Modified `slash_validator`](#modified-slash_validator) - [Modified `slash_validator`](#modified-slash_validator)
@ -646,20 +645,6 @@ def queue_excess_active_balance(state: BeaconState, index: ValidatorIndex) -> No
) )
``` ```
#### New `queue_entire_balance_and_reset_validator`
```python
def queue_entire_balance_and_reset_validator(state: BeaconState, index: ValidatorIndex) -> None:
balance = state.balances[index]
state.balances[index] = 0
validator = state.validators[index]
validator.effective_balance = 0
validator.activation_eligibility_epoch = FAR_FUTURE_EPOCH
state.pending_balance_deposits.append(
PendingBalanceDeposit(index=index, amount=balance)
)
```
#### New `compute_exit_epoch_and_update_churn` #### New `compute_exit_epoch_and_update_churn`
```python ```python

View File

@ -152,7 +152,14 @@ def upgrade_to_electra(pre: deneb.BeaconState) -> BeaconState:
)) ))
for index in pre_activation: for index in pre_activation:
queue_entire_balance_and_reset_validator(post, ValidatorIndex(index)) balance = post.balances[index]
post.balances[index] = 0
validator = post.validators[index]
validator.effective_balance = 0
validator.activation_eligibility_epoch = FAR_FUTURE_EPOCH
post.pending_balance_deposits.append(
PendingBalanceDeposit(index=index, amount=balance)
)
# Ensure early adopters of compounding credentials go through the activation churn # Ensure early adopters of compounding credentials go through the activation churn
for index, validator in enumerate(post.validators): for index, validator in enumerate(post.validators):