diff --git a/specs/capella/beacon-chain.md b/specs/capella/beacon-chain.md index 88777d1d6..87dacc643 100644 --- a/specs/capella/beacon-chain.md +++ b/specs/capella/beacon-chain.md @@ -324,9 +324,9 @@ def process_withdrawals(state: BeaconState, payload: ExecutionPayload) -> None: assert withdrawal == expected_withdrawal decrease_balance(state, withdrawal.validator_index, withdrawal.amount) if len(expected_withdrawals) > 0: - # `withdrawal` holds the last withdrawal object in the payload. - state.next_withdrawal_index = WithdrawalIndex(withdrawal.index + 1) - state.latest_withdrawal_validator_index = withdrawal.validator_index + latest_withdrawal = payload.withdrawals[-1] + state.next_withdrawal_index = WithdrawalIndex(latest_withdrawal.index + 1) + state.latest_withdrawal_validator_index = latest_withdrawal.validator_index ``` #### Modified `process_execution_payload` diff --git a/tests/core/pyspec/eth2spec/test/capella/sanity/test_blocks.py b/tests/core/pyspec/eth2spec/test/capella/sanity/test_blocks.py index 73a40e539..0636dd58f 100644 --- a/tests/core/pyspec/eth2spec/test/capella/sanity/test_blocks.py +++ b/tests/core/pyspec/eth2spec/test/capella/sanity/test_blocks.py @@ -141,7 +141,7 @@ def test_exit_and_bls_change(spec, state): assert spec.is_fully_withdrawable_validator(validator, balance, validator.withdrawable_epoch) -def _valid_withdrawl(spec, state): +def _valid_withdrawal(spec, state): fully_withdrawable_indices, partial_withdrawals_indices = prepare_expected_withdrawals( spec, state, num_partial_withdrawals=spec.MAX_WITHDRAWALS_PER_PAYLOAD * 4, num_full_withdrawals=spec.MAX_WITHDRAWALS_PER_PAYLOAD * 4) @@ -173,7 +173,7 @@ def _valid_withdrawl(spec, state): @with_capella_and_later @spec_state_test def test_withdrawal_success_two_blocks(spec, state): - pre_state, signed_block_1, pre_next_withdrawal_index = _valid_withdrawl(spec, state) + pre_state, signed_block_1, pre_next_withdrawal_index = _valid_withdrawal(spec, state) yield 'pre', pre_state @@ -190,7 +190,7 @@ def test_withdrawal_success_two_blocks(spec, state): @with_capella_and_later @spec_state_test def test_withdrawal_fail_second_block_payload_isnt_compatible(spec, state): - _valid_withdrawl(spec, state) + _valid_withdrawal(spec, state) # Block 2 block = build_empty_block_for_next_slot(spec, state)