Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion specs/capella/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -384,13 +384,15 @@ def get_validators_sweep_withdrawals(
epoch = get_current_epoch(state)
validators_limit = min(len(state.validators), MAX_VALIDATORS_PER_WITHDRAWALS_SWEEP)
withdrawals_limit = MAX_WITHDRAWALS_PER_PAYLOAD
# There must be at least one space reserved for validator sweep withdrawals
assert len(prior_withdrawals) < withdrawals_limit

processed_count: uint64 = 0
withdrawals: List[Withdrawal] = []
validator_index = state.next_withdrawal_validator_index
for _ in range(validators_limit):
all_withdrawals = prior_withdrawals + withdrawals
has_reached_limit = len(all_withdrawals) == withdrawals_limit
has_reached_limit = len(all_withdrawals) >= withdrawals_limit
if has_reached_limit:
break

Expand Down
7 changes: 5 additions & 2 deletions specs/electra/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -1234,13 +1234,14 @@ def get_pending_partial_withdrawals(
len(prior_withdrawals) + MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP,
MAX_WITHDRAWALS_PER_PAYLOAD - 1,
)
assert len(prior_withdrawals) <= withdrawals_limit

processed_count: uint64 = 0
withdrawals: List[Withdrawal] = []
for withdrawal in state.pending_partial_withdrawals:
all_withdrawals = prior_withdrawals + withdrawals
is_withdrawable = withdrawal.withdrawable_epoch <= epoch
has_reached_limit = len(all_withdrawals) == withdrawals_limit
has_reached_limit = len(all_withdrawals) >= withdrawals_limit
if not is_withdrawable or has_reached_limit:
break

Expand Down Expand Up @@ -1278,13 +1279,15 @@ def get_validators_sweep_withdrawals(
epoch = get_current_epoch(state)
validators_limit = min(len(state.validators), MAX_VALIDATORS_PER_WITHDRAWALS_SWEEP)
withdrawals_limit = MAX_WITHDRAWALS_PER_PAYLOAD
# There must be at least one space reserved for validator sweep withdrawals
assert len(prior_withdrawals) < withdrawals_limit

processed_count: uint64 = 0
withdrawals: List[Withdrawal] = []
validator_index = state.next_withdrawal_validator_index
for _ in range(validators_limit):
all_withdrawals = prior_withdrawals + withdrawals
has_reached_limit = len(all_withdrawals) == withdrawals_limit
has_reached_limit = len(all_withdrawals) >= withdrawals_limit
if has_reached_limit:
break

Expand Down
10 changes: 6 additions & 4 deletions specs/gloas/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -861,13 +861,14 @@ def get_builder_withdrawals(
withdrawal_index: WithdrawalIndex,
prior_withdrawals: Sequence[Withdrawal],
) -> Tuple[Sequence[Withdrawal], WithdrawalIndex, uint64]:
withdrawals_limit = MAX_WITHDRAWALS_PER_PAYLOAD
withdrawals_limit = MAX_WITHDRAWALS_PER_PAYLOAD - 1
assert len(prior_withdrawals) <= withdrawals_limit

processed_count: uint64 = 0
withdrawals: List[Withdrawal] = []
for withdrawal in state.builder_pending_withdrawals:
all_withdrawals = prior_withdrawals + withdrawals
has_reached_limit = len(all_withdrawals) == withdrawals_limit
has_reached_limit = len(all_withdrawals) >= withdrawals_limit
if has_reached_limit:
break

Expand Down Expand Up @@ -896,14 +897,15 @@ def get_builders_sweep_withdrawals(
) -> Tuple[Sequence[Withdrawal], WithdrawalIndex, uint64]:
epoch = get_current_epoch(state)
builders_limit = min(len(state.builders), MAX_BUILDERS_PER_WITHDRAWALS_SWEEP)
withdrawals_limit = MAX_WITHDRAWALS_PER_PAYLOAD
withdrawals_limit = MAX_WITHDRAWALS_PER_PAYLOAD - 1
assert len(prior_withdrawals) <= withdrawals_limit

processed_count: uint64 = 0
withdrawals: List[Withdrawal] = []
builder_index = state.next_withdrawal_builder_index
for _ in range(builders_limit):
all_withdrawals = prior_withdrawals + withdrawals
has_reached_limit = len(all_withdrawals) == withdrawals_limit
has_reached_limit = len(all_withdrawals) >= withdrawals_limit
if has_reached_limit:
break

Expand Down