Skip to content

Commit

Permalink
Add more pending deposit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mkalinin committed Oct 18, 2024
1 parent 84d7ba2 commit a2f9b88
Showing 1 changed file with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@
from eth2spec.test.context import (
spec_state_test,
with_electra_and_later,
with_presets,
spec_test,
single_phase,
with_custom_state,
scaled_churn_balances_exceed_activation_exit_churn_limit,
default_activation_threshold,
)
from eth2spec.test.helpers.deposits import prepare_pending_deposit
from eth2spec.test.helpers.state import (
next_epoch_with_full_participation,
advance_finality_to,
set_full_participation,
)
from eth2spec.test.helpers.constants import MINIMAL


def run_process_pending_deposits(spec, state):
Expand Down Expand Up @@ -488,3 +495,26 @@ def test_process_pending_deposits_withdrawable_validator_not_churned(spec, state
assert state.pending_deposits == [
prepare_pending_deposit(spec, validator_index=1, amount=amount)
]


@with_electra_and_later
@with_presets([MINIMAL], "need sufficient consolidation churn limit")
@with_custom_state(
balances_fn=scaled_churn_balances_exceed_activation_exit_churn_limit,
threshold_fn=default_activation_threshold,
)
@spec_test
@single_phase
def test_process_pending_deposits_scaled_churn(spec, state):
index = 0
amount = spec.get_activation_exit_churn_limit(state)
state.pending_deposits.append(
prepare_pending_deposit(spec, index, amount)
)
pre_balance = state.balances[index]

yield from run_process_pending_deposits(spec, state)

assert state.balances[index] == pre_balance + amount
assert state.deposit_balance_to_consume == 0
assert state.pending_deposits == []

0 comments on commit a2f9b88

Please sign in to comment.