Skip to content

Commit a2f9b88

Browse files
committed
Add more pending deposit tests
1 parent 84d7ba2 commit a2f9b88

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/core/pyspec/eth2spec/test/electra/epoch_processing/pending_deposits/test_process_pending_deposits.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@
22
from eth2spec.test.context import (
33
spec_state_test,
44
with_electra_and_later,
5+
with_presets,
6+
spec_test,
7+
single_phase,
8+
with_custom_state,
9+
scaled_churn_balances_exceed_activation_exit_churn_limit,
10+
default_activation_threshold,
511
)
612
from eth2spec.test.helpers.deposits import prepare_pending_deposit
713
from eth2spec.test.helpers.state import (
814
next_epoch_with_full_participation,
915
advance_finality_to,
1016
set_full_participation,
1117
)
18+
from eth2spec.test.helpers.constants import MINIMAL
1219

1320

1421
def run_process_pending_deposits(spec, state):
@@ -488,3 +495,26 @@ def test_process_pending_deposits_withdrawable_validator_not_churned(spec, state
488495
assert state.pending_deposits == [
489496
prepare_pending_deposit(spec, validator_index=1, amount=amount)
490497
]
498+
499+
500+
@with_electra_and_later
501+
@with_presets([MINIMAL], "need sufficient consolidation churn limit")
502+
@with_custom_state(
503+
balances_fn=scaled_churn_balances_exceed_activation_exit_churn_limit,
504+
threshold_fn=default_activation_threshold,
505+
)
506+
@spec_test
507+
@single_phase
508+
def test_process_pending_deposits_scaled_churn(spec, state):
509+
index = 0
510+
amount = spec.get_activation_exit_churn_limit(state)
511+
state.pending_deposits.append(
512+
prepare_pending_deposit(spec, index, amount)
513+
)
514+
pre_balance = state.balances[index]
515+
516+
yield from run_process_pending_deposits(spec, state)
517+
518+
assert state.balances[index] == pre_balance + amount
519+
assert state.deposit_balance_to_consume == 0
520+
assert state.pending_deposits == []

0 commit comments

Comments
 (0)