@@ -562,6 +562,39 @@ def test_switch_to_compounding_with_pending_consolidations_at_limit(spec, state)
562
562
# Tests that should fail
563
563
564
564
565
+ @with_electra_and_later
566
+ @with_presets ([MINIMAL ], "need sufficient consolidation churn limit" )
567
+ @with_custom_state (
568
+ balances_fn = scaled_churn_balances_exceed_activation_exit_churn_limit ,
569
+ threshold_fn = default_activation_threshold ,
570
+ )
571
+ @spec_test
572
+ @single_phase
573
+ def test_incorrect_same_source_target (spec , state ):
574
+ # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for consolidation
575
+ state .slot += spec .config .SHARD_COMMITTEE_PERIOD * spec .SLOTS_PER_EPOCH
576
+
577
+ # Set up an otherwise correct consolidation
578
+ current_epoch = spec .get_current_epoch (state )
579
+ source_index = spec .get_active_validator_indices (state , current_epoch )[0 ]
580
+ # Set source and target to be the same
581
+ target_index = source_index
582
+ source_address = b"\x22 " * 20
583
+ # Make source/target a compounding validator (0x02) so this request isn't a
584
+ # valid switch to compounding request. To be a valid switch to compounding
585
+ # request, the source validator must be an eth1 validator (0x01).
586
+ set_compounding_withdrawal_credential_with_balance (
587
+ spec , state , target_index , address = source_address
588
+ )
589
+ consolidation = spec .ConsolidationRequest (
590
+ source_address = source_address ,
591
+ source_pubkey = state .validators [source_index ].pubkey ,
592
+ target_pubkey = state .validators [target_index ].pubkey ,
593
+ )
594
+
595
+ yield from run_consolidation_processing (spec , state , consolidation , success = False )
596
+
597
+
565
598
@with_electra_and_later
566
599
@with_presets ([MINIMAL ], "need sufficient consolidation churn limit" )
567
600
@with_custom_state (
0 commit comments