@@ -850,6 +850,36 @@ def test_full_exit_request_has_partial_withdrawal(spec, state):
850850 spec , state , withdrawal_request , success = False
851851 )
852852
853+
854+ @with_electra_and_later
855+ @spec_state_test
856+ def test_incorrect_inactive_validator (spec , state ):
857+ rng = random .Random (1361 )
858+ # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit
859+ state .slot += spec .config .SHARD_COMMITTEE_PERIOD * spec .SLOTS_PER_EPOCH
860+
861+ current_epoch = spec .get_current_epoch (state )
862+ validator_index = rng .choice (spec .get_active_validator_indices (state , current_epoch ))
863+ validator_pubkey = state .validators [validator_index ].pubkey
864+ address = b"\x22 " * 20
865+ incorrect_address = b"\x33 " * 20
866+ set_eth1_withdrawal_credential_with_balance (
867+ spec , state , validator_index , address = address
868+ )
869+ withdrawal_request = spec .WithdrawalRequest (
870+ source_address = incorrect_address ,
871+ validator_pubkey = validator_pubkey ,
872+ amount = spec .FULL_EXIT_REQUEST_AMOUNT ,
873+ )
874+
875+ # set validator as not yet activated
876+ state .validators [validator_index ].activation_epoch = spec .FAR_FUTURE_EPOCH
877+ assert not spec .is_active_validator (state .validators [validator_index ], current_epoch )
878+
879+ yield from run_withdrawal_request_processing (
880+ spec , state , withdrawal_request , success = False
881+ )
882+
853883#
854884# Run processing
855885#
0 commit comments