@@ -787,6 +787,41 @@ def test_partial_withdrawal_activation_epoch_less_than_shard_committee_period(
787787 )
788788
789789
790+ @with_electra_and_later
791+ @spec_state_test
792+ def test_full_exit_request_has_partial_withdrawal (spec , state ):
793+ rng = random .Random (1361 )
794+ # move state forward SHARD_COMMITTEE_PERIOD epochs to allow for exit
795+ state .slot += spec .config .SHARD_COMMITTEE_PERIOD * spec .SLOTS_PER_EPOCH
796+
797+ current_epoch = spec .get_current_epoch (state )
798+ validator_index = rng .choice (spec .get_active_validator_indices (state , current_epoch ))
799+ validator_pubkey = state .validators [validator_index ].pubkey
800+ address = b"\x22 " * 20
801+ set_eth1_withdrawal_credential_with_balance (
802+ spec , state , validator_index , address = address
803+ )
804+ withdrawal_request = spec .WithdrawalRequest (
805+ source_address = address ,
806+ validator_pubkey = validator_pubkey ,
807+ amount = spec .FULL_EXIT_REQUEST_AMOUNT ,
808+ )
809+
810+ # Validator can only be exited if there's no pending partial withdrawals in state
811+ state .balances [validator_index ] = spec .MAX_EFFECTIVE_BALANCE_ELECTRA
812+ state .pending_partial_withdrawals .append (
813+ spec .PendingPartialWithdrawal (
814+ index = validator_index ,
815+ amount = 1 ,
816+ withdrawable_epoch = spec .compute_activation_exit_epoch (current_epoch ),
817+ )
818+ )
819+
820+ yield from run_withdrawal_request_processing (
821+ spec , state , withdrawal_request , success = False
822+ )
823+
824+
790825#
791826# Run processing
792827#
0 commit comments