queue_excess_active_balance

This commit is contained in:
dapplion 2024-03-22 14:04:03 +09:00
parent 45f98d6a67
commit ebdb513ec8
1 changed files with 14 additions and 0 deletions

View File

@ -127,5 +127,19 @@ def upgrade_to_eip7251(pre: deneb.BeaconState) -> BeaconState:
pending_partial_withdrawals=[], pending_partial_withdrawals=[],
pending_consolidations=[], pending_consolidations=[],
) )
# Ensure early adopters of compounding credentials go through the activation churn
queue_excess_active_balance(post)
return post return post
``` ```
```python
def queue_excess_active_balance(state: BeaconState):
for index, validator in enumerate(state.validators):
balance = state.balances[index]
if has_compounding_withdrawal_credential(validator) and balance > MAX_EFFECTIVE_BALANCE:
excess_balance = balance - MAX_EFFECTIVE_BALANCE
state.balances[index] = balance - excess_balance
state.pending_balance_deposits.append(PendingBalanceDeposit(index, excess_balance))
```