Merge pull request #3905 from ralexstokes/harmonize-electra-withdrawals

harmonize `process_withdrawals` spec with #3761
This commit is contained in:
Hsiao-Wei Wang 2024-08-29 17:39:47 +08:00 committed by GitHub
commit 0dd76d3e18
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 3 deletions

View File

@ -1022,10 +1022,9 @@ def get_expected_withdrawals(state: BeaconState) -> Tuple[Sequence[Withdrawal],
def process_withdrawals(state: BeaconState, payload: ExecutionPayload) -> None:
expected_withdrawals, partial_withdrawals_count = get_expected_withdrawals(state) # [Modified in Electra:EIP7251]
assert len(payload.withdrawals) == len(expected_withdrawals)
assert payload.withdrawals == expected_withdrawals
for expected_withdrawal, withdrawal in zip(expected_withdrawals, payload.withdrawals):
assert withdrawal == expected_withdrawal
for withdrawal in expected_withdrawals:
decrease_balance(state, withdrawal.validator_index, withdrawal.amount)
# Update pending partial withdrawals [New in Electra:EIP7251]