Introduce MAX_PARTIAL_WITHDRAWALS_PER_PAYLOAD

This commit is contained in:
Mikhail Kalinin 2024-03-20 13:53:42 +06:00
parent fe35d6659c
commit 98f38c7f07
3 changed files with 15 additions and 1 deletions

View File

@ -21,3 +21,7 @@ MIN_SLASHING_PENALTY_QUOTIENT_EIP7251: 65536
# ---------------------------------------------------------------
MAX_CONSOLIDATIONS: 1
# Execution
# ---------------------------------------------------------------
# 2**3 (= 8) partial withdrawals
MAX_PARTIAL_WITHDRAWALS_PER_PAYLOAD: 16

View File

@ -23,3 +23,7 @@ MIN_SLASHING_PENALTY_QUOTIENT_EIP7251: 65536
# ---------------------------------------------------------------
MAX_CONSOLIDATIONS: 1
# Execution
# ---------------------------------------------------------------
# [customized] 2**1 (= 2)
MAX_PARTIAL_WITHDRAWALS_PER_PAYLOAD: 2

View File

@ -116,6 +116,12 @@ The following values are (non-configurable) constants used throughout the specif
| - | - |
| `MAX_CONSOLIDATIONS` | `uint64(1)` |
### Execution
| Name | Value | Description |
| - | - | - |
| `MAX_PARTIAL_WITHDRAWALS_PER_PAYLOAD` | `uint64(2**3)` (= 8) | Maximum amount of partial withdrawals allowed in each payload |
### State list lengths
| Name | Value | Unit |
@ -620,7 +626,7 @@ def get_expected_withdrawals(state: BeaconState) -> Tuple[Sequence[Withdrawal],
# [New in EIP7251] Consume pending partial withdrawals
for withdrawal in state.pending_partial_withdrawals:
if withdrawal.withdrawable_epoch > epoch or len(withdrawals) == MAX_WITHDRAWALS_PER_PAYLOAD // 2:
if withdrawal.withdrawable_epoch > epoch or len(withdrawals) == MAX_PARTIAL_WITHDRAWALS_PER_PAYLOAD:
break
validator = state.validators[withdrawal.index]