From ebdb513ec8789c0b3d5a4a8289e2f62814147a93 Mon Sep 17 00:00:00 2001 From: dapplion <35266934+dapplion@users.noreply.github.com> Date: Fri, 22 Mar 2024 14:04:03 +0900 Subject: [PATCH] queue_excess_active_balance --- specs/_features/eip7251/fork.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/specs/_features/eip7251/fork.md b/specs/_features/eip7251/fork.md index 666c7c368..2e501fc6b 100644 --- a/specs/_features/eip7251/fork.md +++ b/specs/_features/eip7251/fork.md @@ -127,5 +127,19 @@ def upgrade_to_eip7251(pre: deneb.BeaconState) -> BeaconState: pending_partial_withdrawals=[], pending_consolidations=[], ) + + # Ensure early adopters of compounding credentials go through the activation churn + queue_excess_active_balance(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)) +```