queue_excess_active_balance
This commit is contained in:
parent
45f98d6a67
commit
ebdb513ec8
|
@ -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))
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in New Issue