|
2 | 2 | from eth2spec.test.context import ( |
3 | 3 | spec_state_test, |
4 | 4 | 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, |
5 | 11 | ) |
6 | 12 | from eth2spec.test.helpers.deposits import prepare_pending_deposit |
7 | 13 | from eth2spec.test.helpers.state import ( |
8 | 14 | next_epoch_with_full_participation, |
9 | 15 | advance_finality_to, |
10 | 16 | set_full_participation, |
11 | 17 | ) |
| 18 | +from eth2spec.test.helpers.constants import MINIMAL |
12 | 19 |
|
13 | 20 |
|
14 | 21 | def run_process_pending_deposits(spec, state): |
@@ -488,3 +495,26 @@ def test_process_pending_deposits_withdrawable_validator_not_churned(spec, state |
488 | 495 | assert state.pending_deposits == [ |
489 | 496 | prepare_pending_deposit(spec, validator_index=1, amount=amount) |
490 | 497 | ] |
| 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