From 6d9ebe15bb299db1c0af2f4f36535fe2e45874d1 Mon Sep 17 00:00:00 2001 From: dapplion <35266934+dapplion@users.noreply.github.com> Date: Fri, 22 Mar 2024 14:11:25 +0900 Subject: [PATCH] set_compounding_withdrawal_credentials --- specs/_features/eip7251/beacon-chain.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/specs/_features/eip7251/beacon-chain.md b/specs/_features/eip7251/beacon-chain.md index e6e234580..5947de781 100644 --- a/specs/_features/eip7251/beacon-chain.md +++ b/specs/_features/eip7251/beacon-chain.md @@ -44,6 +44,7 @@ - [New `get_active_balance`](#new-get_active_balance) - [Beacon state mutators](#beacon-state-mutators) - [Updated `initiate_validator_exit`](#updated--initiate_validator_exit) + - [New `set_compounding_withdrawal_credentials`](#new-set_compounding_withdrawal_credentials) - [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) - [Updated `slash_validator`](#updated-slash_validator) @@ -419,6 +420,15 @@ def initiate_validator_exit(state: BeaconState, index: ValidatorIndex) -> None: validator.withdrawable_epoch = Epoch(validator.exit_epoch + MIN_VALIDATOR_WITHDRAWABILITY_DELAY) ``` +#### New `set_compounding_withdrawal_credentials` + +```python +def set_compounding_withdrawal_credentials(state: BeaconState, index: ValidatorIndex) -> None: + validator = state.validators[index] + if has_eth1_withdrawal_credential(validator): + validator.withdrawal_credentials[:1] = COMPOUNDING_WITHDRAWAL_PREFIX +``` + #### New `compute_exit_epoch_and_update_churn` @@ -579,6 +589,7 @@ def process_pending_consolidations(state: BeaconState) -> None: active_balance = get_active_balance(state, pending_consolidation.source_index) state.balances[pending_consolidation.source_index] -= active_balance state.balances[pending_consolidation.target_index] += active_balance + set_compounding_withdrawal_credentials(state, pending_consolidation.target_index) state.pending_consolidations = state.pending_consolidations[next_pending_consolidation:] ```