diff --git a/specs/capella/beacon-chain.md b/specs/capella/beacon-chain.md index c93eaf150..36da72d72 100644 --- a/specs/capella/beacon-chain.md +++ b/specs/capella/beacon-chain.md @@ -221,7 +221,7 @@ class BeaconState(Container): latest_execution_payload_header: ExecutionPayloadHeader # Withdrawals next_withdrawal_index: WithdrawalIndex # [New in Capella] - last_withdrawal_validator_index: ValidatorIndex # [New in Capella] + latest_withdrawal_validator_index: ValidatorIndex # [New in Capella] ``` ## Helpers @@ -286,7 +286,7 @@ def process_block(state: BeaconState, block: BeaconBlock) -> None: def get_expected_withdrawals(state: BeaconState) -> Sequence[Withdrawal]: epoch = get_current_epoch(state) withdrawal_index = state.next_withdrawal_index - index = state.last_withdrawal_validator_index + index = state.latest_withdrawal_validator_index withdrawals: List[Withdrawal] = [] for _ in range(len(state.validators)): index = ValidatorIndex((index + 1) % len(state.validators)) @@ -325,7 +325,7 @@ def process_withdrawals(state: BeaconState, payload: ExecutionPayload) -> None: decrease_balance(state, withdrawal.validator_index, withdrawal.amount) if len(expected_withdrawals) > 0: state.next_withdrawal_index = WithdrawalIndex(withdrawal.index + 1) - state.last_withdrawal_validator_index = withdrawal.validator_index + state.latest_withdrawal_validator_index = withdrawal.validator_index ``` #### Modified `process_execution_payload` diff --git a/specs/capella/fork.md b/specs/capella/fork.md index 27e2afcac..1ea43b463 100644 --- a/specs/capella/fork.md +++ b/specs/capella/fork.md @@ -129,7 +129,8 @@ def upgrade_to_capella(pre: bellatrix.BeaconState) -> BeaconState: # Execution-layer latest_execution_payload_header=latest_execution_payload_header, # Withdrawals - last_withdrawal_validator_index=ValidatorIndex(0), + next_withdrawal_index=WithdrawalIndex(0), + latest_withdrawal_validator_index=ValidatorIndex(0), ) return post diff --git a/tests/core/pyspec/eth2spec/test/capella/block_processing/test_process_withdrawals.py b/tests/core/pyspec/eth2spec/test/capella/block_processing/test_process_withdrawals.py index ca8753f1b..7f3e16cca 100644 --- a/tests/core/pyspec/eth2spec/test/capella/block_processing/test_process_withdrawals.py +++ b/tests/core/pyspec/eth2spec/test/capella/block_processing/test_process_withdrawals.py @@ -745,7 +745,7 @@ def run_random_partial_withdrawals_test(spec, state, rng): randomize_state(spec, state, rng) num_validators = len(state.validators) - state.last_withdrawal_validator_index = rng.randint(0, num_validators - 1) + state.latest_withdrawal_validator_index = rng.randint(0, num_validators - 1) num_partially_withdrawable = rng.randint(0, num_validators - 1) partially_withdrawable_indices = rng.sample(range(num_validators), num_partially_withdrawable)