Skip to content

Commit

Permalink
Fix capella/block_processing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hwwhww committed Nov 3, 2022
1 parent a09d617 commit 0b1f32e
Show file tree
Hide file tree
Showing 2 changed files with 234 additions and 43 deletions.
10 changes: 5 additions & 5 deletions specs/capella/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def get_expected_withdrawals(state: BeaconState) -> Sequence[Withdrawal]:
amount=balance - MAX_EFFECTIVE_BALANCE,
))
withdrawal_index = WithdrawalIndex(withdrawal_index + 1)
if len(ret) == MAX_WITHDRAWALS_PER_PAYLOAD:
if len(withdrawals) == MAX_WITHDRAWALS_PER_PAYLOAD:
break
return withdrawals
```
Expand All @@ -320,12 +320,12 @@ def process_withdrawals(state: BeaconState, payload: ExecutionPayload) -> None:
expected_withdrawals = get_expected_withdrawals(state)
assert len(payload.withdrawals) == len(expected_withdrawals)

for expected_withdrawal, withdrawal in zip(get_expected_withdrawals(state), payload.withdrawals):
for expected_withdrawal, withdrawal in zip(expected_withdrawals, payload.withdrawals):
assert withdrawal == expected_withdrawal
decrease_balance(state, withdrawal.validator_index, withdrawal.amount)

state.next_withdrawal_index = WithdrawalIndex(withdrawal.index + 1)
state.last_withdrawal_validator_index = withdrawal.validator_index
if len(expected_withdrawals) > 0:
state.next_withdrawal_index = WithdrawalIndex(withdrawal.index + 1)
state.last_withdrawal_validator_index = withdrawal.validator_index
```

#### Modified `process_execution_payload`
Expand Down
Loading

0 comments on commit 0b1f32e

Please sign in to comment.