Skip to content

Commit 5cd884d

Browse files
committed
Consider builder pending payments for pending balance to withdraw
The helper function to keep track of pending balances to withdraw should take into account any pending payments and pending withdrawals from builders. [] - Add regression test for a payload with a withdrawal request from the current builder, that would invalidate a builder pending payment otherwise.
1 parent 133c2e4 commit 5cd884d

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

specs/gloas/beacon-chain.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
- [New `is_valid_indexed_payload_attestation`](#new-is_valid_indexed_payload_attestation)
3838
- [New `is_parent_block_full`](#new-is_parent_block_full)
3939
- [Misc](#misc-2)
40+
- [Modified `get_pending_balance_to_withdraw`](#modified-get_pending_balance_to_withdraw)
4041
- [New `remove_flag`](#new-remove_flag)
4142
- [New `compute_balance_weighted_selection`](#new-compute_balance_weighted_selection)
4243
- [New `compute_balance_weighted_acceptance`](#new-compute_balance_weighted_acceptance)
@@ -436,6 +437,32 @@ def is_parent_block_full(state: BeaconState) -> bool:
436437

437438
### Misc
438439

440+
#### Modified `get_pending_balance_to_withdraw`
441+
442+
*Note*: `get_pending_balance_to_withdraw` is modified to account for pending
443+
builder payments.
444+
445+
```python
446+
def get_pending_balance_to_withdraw(state: BeaconState, validator_index: ValidatorIndex) -> Gwei:
447+
return (
448+
sum(
449+
withdrawal.amount
450+
for withdrawal in state.pending_partial_withdrawals
451+
if withdrawal.validator_index == validator_index
452+
)
453+
+ sum(
454+
withdrawal.amount
455+
for withdrawal in state.builder_pending_withdrawals
456+
if withdrawal.builder_index == validator_index
457+
)
458+
+ sum(
459+
payment.withdrawal.amount
460+
for payment in state.builder_pending_payment
461+
if payment.withdrawal.builder_index == validator_index
462+
)
463+
)
464+
```
465+
439466
#### New `remove_flag`
440467

441468
```python

0 commit comments

Comments
 (0)