From dc772a6dca031ea41e8b8976822c3a84a49d907a Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Tue, 22 Oct 2024 13:33:00 -0500 Subject: [PATCH] Add test_fork_pending_deposits_are_sorted test --- .../electra/fork/test_electra_fork_basic.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/core/pyspec/eth2spec/test/electra/fork/test_electra_fork_basic.py b/tests/core/pyspec/eth2spec/test/electra/fork/test_electra_fork_basic.py index e569be35e..bf97746db 100644 --- a/tests/core/pyspec/eth2spec/test/electra/fork/test_electra_fork_basic.py +++ b/tests/core/pyspec/eth2spec/test/electra/fork/test_electra_fork_basic.py @@ -94,6 +94,27 @@ def test_fork_pre_activation(spec, phases, state): assert len(post_state.pending_deposits) > 0 +@with_phases(phases=[DENEB], other_phases=[ELECTRA]) +@spec_test +@with_state +@with_meta_tags(ELECTRA_FORK_TEST_META_TAGS) +def test_fork_pending_deposits_are_sorted(spec, phases, state): + post_spec = phases[ELECTRA] + state.validators[0].activation_epoch = spec.FAR_FUTURE_EPOCH + state.validators[0].activation_eligibility_epoch = 2 + state.validators[1].activation_epoch = spec.FAR_FUTURE_EPOCH + state.validators[1].activation_eligibility_epoch = 3 + state.validators[2].activation_epoch = spec.FAR_FUTURE_EPOCH + state.validators[2].activation_eligibility_epoch = 2 + + post_state = yield from run_fork_test(post_spec, state) + + assert len(post_state.pending_deposits) == 3 + assert post_state.pending_deposits[0].pubkey == state.validators[0].pubkey + assert post_state.pending_deposits[1].pubkey == state.validators[2].pubkey + assert post_state.pending_deposits[2].pubkey == state.validators[1].pubkey + + @with_phases(phases=[DENEB], other_phases=[ELECTRA]) @spec_test @with_state