Skip to content

Commit 6845546

Browse files
authored
Merge pull request #3679 from ralexstokes/electra/restore-partial-withdrawals-handling
Electra:EIP-7002/7251: clarify pending partial withdrawals handling
2 parents b02be79 + 8213308 commit 6845546

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

presets/mainnet/electra.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,8 @@ MAX_CONSOLIDATIONS: 1
3838
MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD: 8192
3939
# 2**4 (= 16) withdrawal requests
4040
MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: 16
41+
42+
# Withdrawals processing
43+
# ---------------------------------------------------------------
44+
# 2**3 ( = 8) pending withdrawals
45+
MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP: 8

presets/minimal/electra.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,8 @@ MAX_CONSOLIDATIONS: 1
3838
MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD: 4
3939
# [customized] 2**1 (= 2) withdrawal requests
4040
MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: 2
41+
42+
# Withdrawals processing
43+
# ---------------------------------------------------------------
44+
# 2**0 ( = 1) pending withdrawals
45+
MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP: 1

specs/electra/beacon-chain.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
- [State list lengths](#state-list-lengths)
2020
- [Max operations per block](#max-operations-per-block)
2121
- [Execution](#execution)
22+
- [Withdrawals processing](#withdrawals-processing)
2223
- [Configuration](#configuration)
2324
- [Validator cycle](#validator-cycle)
2425
- [Containers](#containers)
@@ -174,6 +175,12 @@ The following values are (non-configurable) constants used throughout the specif
174175
| `MAX_ATTESTATIONS_ELECTRA` | `2**3` (= 8) | *[New in Electra:EIP7549]* |
175176
| `MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD` | `uint64(2**4)` (= 16)| *[New in Electra:EIP7002]* Maximum number of execution layer withdrawal requests in each payload |
176177

178+
### Withdrawals processing
179+
180+
| Name | Value | Description |
181+
| - | - | - |
182+
| `MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP` | `uint64(2**3)` (= 8)| *[New in Electra:EIP7002]* Maximum number of pending partial withdrawals to process per payload |
183+
177184
## Configuration
178185

179186
### Validator cycle
@@ -881,7 +888,7 @@ def get_expected_withdrawals(state: BeaconState) -> Tuple[Sequence[Withdrawal],
881888

882889
# [New in Electra:EIP7251] Consume pending partial withdrawals
883890
for withdrawal in state.pending_partial_withdrawals:
884-
if withdrawal.withdrawable_epoch > epoch or len(withdrawals) == MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD:
891+
if withdrawal.withdrawable_epoch > epoch or len(withdrawals) == MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP:
885892
break
886893

887894
validator = state.validators[withdrawal.index]

tests/core/pyspec/eth2spec/test/electra/unittests/test_config_invariants.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@
88
@with_electra_and_later
99
@spec_test
1010
@single_phase
11-
def test_withdrawals(spec):
12-
assert spec.MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD < spec.MAX_WITHDRAWALS_PER_PAYLOAD
11+
def test_processing_pending_partial_withdrawals(spec):
12+
assert (
13+
spec.MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP
14+
< spec.MAX_WITHDRAWALS_PER_PAYLOAD
15+
)

0 commit comments

Comments
 (0)