Skip to content

Commit bbb506e

Browse files
authored
Merge pull request #3741 from ethereum/fix-test_process_consolidation
Add decorator to all "invalid" test cases
2 parents 331f1e9 + beea123 commit bbb506e

File tree

1 file changed

+70
-11
lines changed

1 file changed

+70
-11
lines changed

tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_consolidation.py

Lines changed: 70 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from eth2spec.test.helpers.constants import MINIMAL
22
from eth2spec.test.context import (
3-
spec_state_test,
43
with_electra_and_later,
54
with_presets,
65
always_bls,
@@ -407,7 +406,13 @@ def test_consolidation_balance_through_two_churn_epochs(spec, state):
407406
# Failing tests
408407

409408
@with_electra_and_later
410-
@spec_state_test
409+
@with_presets([MINIMAL], "need sufficient consolidation churn limit")
410+
@with_custom_state(
411+
balances_fn=scaled_churn_balances_exceed_activation_exit_churn_limit,
412+
threshold_fn=default_activation_threshold,
413+
)
414+
@spec_test
415+
@single_phase
411416
def test_invalid_source_equals_target(spec, state):
412417
current_epoch = spec.get_current_epoch(state)
413418
validator_index = spec.get_active_validator_indices(state, current_epoch)[0]
@@ -433,7 +438,13 @@ def test_invalid_source_equals_target(spec, state):
433438

434439

435440
@with_electra_and_later
436-
@spec_state_test
441+
@with_presets([MINIMAL], "need sufficient consolidation churn limit")
442+
@with_custom_state(
443+
balances_fn=scaled_churn_balances_exceed_activation_exit_churn_limit,
444+
threshold_fn=default_activation_threshold,
445+
)
446+
@spec_test
447+
@single_phase
437448
def test_invalid_exceed_pending_consolidations_limit(spec, state):
438449
state.pending_consolidations = [
439450
spec.PendingConsolidation(source_index=0, target_index=1)
@@ -457,7 +468,13 @@ def test_invalid_exceed_pending_consolidations_limit(spec, state):
457468

458469

459470
@with_electra_and_later
460-
@spec_state_test
471+
@with_presets([MINIMAL], "need sufficient consolidation churn limit")
472+
@with_custom_state(
473+
balances_fn=scaled_churn_balances_exceed_activation_exit_churn_limit,
474+
threshold_fn=default_activation_threshold,
475+
)
476+
@spec_test
477+
@single_phase
461478
def test_invalid_not_enough_consolidation_churn_available(spec, state):
462479
state.validators = state.validators[0:2]
463480
state.pending_consolidations = [
@@ -482,7 +499,13 @@ def test_invalid_not_enough_consolidation_churn_available(spec, state):
482499

483500

484501
@with_electra_and_later
485-
@spec_state_test
502+
@with_presets([MINIMAL], "need sufficient consolidation churn limit")
503+
@with_custom_state(
504+
balances_fn=scaled_churn_balances_exceed_activation_exit_churn_limit,
505+
threshold_fn=default_activation_threshold,
506+
)
507+
@spec_test
508+
@single_phase
486509
def test_invalid_exited_source(spec, state):
487510
current_epoch = spec.get_current_epoch(state)
488511
source_privkey = pubkey_to_privkey[state.validators[0].pubkey]
@@ -504,7 +527,13 @@ def test_invalid_exited_source(spec, state):
504527

505528

506529
@with_electra_and_later
507-
@spec_state_test
530+
@with_presets([MINIMAL], "need sufficient consolidation churn limit")
531+
@with_custom_state(
532+
balances_fn=scaled_churn_balances_exceed_activation_exit_churn_limit,
533+
threshold_fn=default_activation_threshold,
534+
)
535+
@spec_test
536+
@single_phase
508537
def test_invalid_exited_target(spec, state):
509538
current_epoch = spec.get_current_epoch(state)
510539
source_privkey = pubkey_to_privkey[state.validators[0].pubkey]
@@ -527,7 +556,13 @@ def test_invalid_exited_target(spec, state):
527556

528557

529558
@with_electra_and_later
530-
@spec_state_test
559+
@with_presets([MINIMAL], "need sufficient consolidation churn limit")
560+
@with_custom_state(
561+
balances_fn=scaled_churn_balances_exceed_activation_exit_churn_limit,
562+
threshold_fn=default_activation_threshold,
563+
)
564+
@spec_test
565+
@single_phase
531566
def test_invalid_inactive_source(spec, state):
532567
current_epoch = spec.get_current_epoch(state)
533568
source_privkey = pubkey_to_privkey[state.validators[0].pubkey]
@@ -549,7 +584,13 @@ def test_invalid_inactive_source(spec, state):
549584

550585

551586
@with_electra_and_later
552-
@spec_state_test
587+
@with_presets([MINIMAL], "need sufficient consolidation churn limit")
588+
@with_custom_state(
589+
balances_fn=scaled_churn_balances_exceed_activation_exit_churn_limit,
590+
threshold_fn=default_activation_threshold,
591+
)
592+
@spec_test
593+
@single_phase
553594
def test_invalid_inactive_target(spec, state):
554595
current_epoch = spec.get_current_epoch(state)
555596
source_privkey = pubkey_to_privkey[state.validators[0].pubkey]
@@ -572,7 +613,13 @@ def test_invalid_inactive_target(spec, state):
572613

573614

574615
@with_electra_and_later
575-
@spec_state_test
616+
@with_presets([MINIMAL], "need sufficient consolidation churn limit")
617+
@with_custom_state(
618+
balances_fn=scaled_churn_balances_exceed_activation_exit_churn_limit,
619+
threshold_fn=default_activation_threshold,
620+
)
621+
@spec_test
622+
@single_phase
576623
def test_invalid_no_execution_withdrawal_credential(spec, state):
577624
current_epoch = spec.get_current_epoch(state)
578625
source_privkey = pubkey_to_privkey[state.validators[0].pubkey]
@@ -590,7 +637,13 @@ def test_invalid_no_execution_withdrawal_credential(spec, state):
590637

591638

592639
@with_electra_and_later
593-
@spec_state_test
640+
@with_presets([MINIMAL], "need sufficient consolidation churn limit")
641+
@with_custom_state(
642+
balances_fn=scaled_churn_balances_exceed_activation_exit_churn_limit,
643+
threshold_fn=default_activation_threshold,
644+
)
645+
@spec_test
646+
@single_phase
594647
def test_invalid_different_credentials(spec, state):
595648
current_epoch = spec.get_current_epoch(state)
596649
source_privkey = pubkey_to_privkey[state.validators[0].pubkey]
@@ -731,7 +784,13 @@ def test_invalid_target_signature(spec, state):
731784

732785

733786
@with_electra_and_later
734-
@spec_state_test
787+
@with_presets([MINIMAL], "need sufficient consolidation churn limit")
788+
@with_custom_state(
789+
balances_fn=scaled_churn_balances_exceed_activation_exit_churn_limit,
790+
threshold_fn=default_activation_threshold,
791+
)
792+
@spec_test
793+
@single_phase
735794
def test_invalid_before_specified_epoch(spec, state):
736795
current_epoch = spec.get_current_epoch(state)
737796
source_privkey = pubkey_to_privkey[state.validators[0].pubkey]

0 commit comments

Comments
 (0)