Skip to content

Commit

Permalink
Rename MAX_PENDING_DEPOSITS_PER_EPOCH_PROCESSING to MAX_PENDING_DEPOS…
Browse files Browse the repository at this point in the history
…ITS_PER_EPOCH
  • Loading branch information
mkalinin committed Sep 5, 2024
1 parent 8c726ff commit 67cc3a5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion presets/mainnet/electra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP: 8
# Pending deposits processing
# ---------------------------------------------------------------
# 2**4 ( = 4) pending deposits
MAX_PENDING_DEPOSITS_PER_EPOCH_PROCESSING: 16
MAX_PENDING_DEPOSITS_PER_EPOCH: 16
2 changes: 1 addition & 1 deletion presets/minimal/electra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP: 1
# Pending deposits processing
# ---------------------------------------------------------------
# 2**4 ( = 4) pending deposits
MAX_PENDING_DEPOSITS_PER_EPOCH_PROCESSING: 16
MAX_PENDING_DEPOSITS_PER_EPOCH: 16
6 changes: 3 additions & 3 deletions specs/electra/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ The following values are (non-configurable) constants used throughout the specif
### Pending deposits processing
| Name | Value | Description |
| - | - | - |
| `MAX_PENDING_DEPOSITS_PER_EPOCH_PROCESSING` | `uint64(2**4)` (= 16)| *[New in Electra:EIP6110]* Maximum number of pending deposits to process per epoch |
| `MAX_PENDING_DEPOSITS_PER_EPOCH` | `uint64(2**4)` (= 16)| *[New in Electra:EIP6110]* Maximum number of pending deposits to process per epoch |

## Configuration

Expand Down Expand Up @@ -896,7 +896,7 @@ def apply_pending_deposit(state: BeaconState, deposit: PendingDeposit) -> None:
Iterating over `pending_deposits` queue this function runs the following checks before applying pending deposit:
1. All Eth1 bridge deposits are processed before the first deposit request gets processed.
2. Deposit position in the queue is finalized.
3. Deposit does not exceed the `MAX_PENDING_DEPOSITS_PER_EPOCH_PROCESSING` limit.
3. Deposit does not exceed the `MAX_PENDING_DEPOSITS_PER_EPOCH` limit.
4. Deposit does not exceed the activation churn limit.

```python
Expand Down Expand Up @@ -924,7 +924,7 @@ def process_pending_deposits(state: BeaconState) -> None:
break

# Check if number of processed deposits has not reached the limit, otherwise, stop processing.
if next_deposit_index >= MAX_PENDING_DEPOSITS_PER_EPOCH_PROCESSING:
if next_deposit_index >= MAX_PENDING_DEPOSITS_PER_EPOCH:
break

# Read validator state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def test_process_pending_deposits_not_finalized(spec, state):
def test_process_pending_deposits_limit_is_reached(spec, state):
# set pending deposits to the maximum
amount = spec.EFFECTIVE_BALANCE_INCREMENT * 1
for i in range(spec.MAX_PENDING_DEPOSITS_PER_EPOCH_PROCESSING + 2):
for i in range(spec.MAX_PENDING_DEPOSITS_PER_EPOCH + 2):
wc = state.validators[i].withdrawal_credentials
pd = prepare_pending_deposit(spec, i, amount, withdrawal_credentials=wc, signed=True)
state.pending_deposits.append(pd)
Expand All @@ -209,10 +209,10 @@ def test_process_pending_deposits_limit_is_reached(spec, state):
# deposit_balance_to_consume was reset to 0
assert state.deposit_balance_to_consume == 0
# no deposits above limit were processed
assert state.pending_deposits == new_pending_deposits[spec.MAX_PENDING_DEPOSITS_PER_EPOCH_PROCESSING:]
for i in range(spec.MAX_PENDING_DEPOSITS_PER_EPOCH_PROCESSING):
assert state.pending_deposits == new_pending_deposits[spec.MAX_PENDING_DEPOSITS_PER_EPOCH:]
for i in range(spec.MAX_PENDING_DEPOSITS_PER_EPOCH):
assert state.balances[i] == pre_balances[i] + amount
for i in range(spec.MAX_PENDING_DEPOSITS_PER_EPOCH_PROCESSING, spec.MAX_PENDING_DEPOSITS_PER_EPOCH_PROCESSING + 2):
for i in range(spec.MAX_PENDING_DEPOSITS_PER_EPOCH, spec.MAX_PENDING_DEPOSITS_PER_EPOCH + 2):
assert state.balances[i] == pre_balances[i]


Expand Down

0 comments on commit 67cc3a5

Please sign in to comment.