From 2b246760a6f98e365a2eb1bd9837b739b62622cf Mon Sep 17 00:00:00 2001 From: hanako mumei <81144685+2501babe@users.noreply.github.com> Date: Mon, 3 Jun 2024 16:38:12 -0700 Subject: [PATCH] add move to omnibus instruction tests --- programs/stake/src/stake_instruction.rs | 60 +++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/programs/stake/src/stake_instruction.rs b/programs/stake/src/stake_instruction.rs index c9ef1d1b0b55e2..270f5f13ef8932 100644 --- a/programs/stake/src/stake_instruction.rs +++ b/programs/stake/src/stake_instruction.rs @@ -720,6 +720,26 @@ mod tests { ), Err(InstructionError::InvalidAccountData), ); + process_instruction_as_one_arg( + Arc::clone(&feature_set), + &instruction::move_stake( + &Pubkey::new_unique(), + &Pubkey::new_unique(), + &Pubkey::new_unique(), + 100, + ), + Err(InstructionError::InvalidAccountData), + ); + process_instruction_as_one_arg( + Arc::clone(&feature_set), + &instruction::move_lamports( + &Pubkey::new_unique(), + &Pubkey::new_unique(), + &Pubkey::new_unique(), + 100, + ), + Err(InstructionError::InvalidAccountData), + ); } #[test_case(feature_set_no_minimum_delegation(); "no_min_delegation")] @@ -848,6 +868,26 @@ mod tests { )[2], Err(InstructionError::InvalidAccountOwner), ); + process_instruction_as_one_arg( + Arc::clone(&feature_set), + &instruction::move_stake( + &spoofed_stake_state_pubkey(), + &Pubkey::new_unique(), + &Pubkey::new_unique(), + 100, + ), + Err(InstructionError::InvalidAccountOwner), + ); + process_instruction_as_one_arg( + Arc::clone(&feature_set), + &instruction::move_lamports( + &spoofed_stake_state_pubkey(), + &Pubkey::new_unique(), + &Pubkey::new_unique(), + 100, + ), + Err(InstructionError::InvalidAccountOwner), + ); } #[test_case(feature_set_no_minimum_delegation(); "no_min_delegation")] @@ -8079,6 +8119,26 @@ mod tests { )[2], Err(StakeError::EpochRewardsActive.into()), ); + process_instruction_as_one_arg( + Arc::clone(&feature_set), + &instruction::move_stake( + &Pubkey::new_unique(), + &Pubkey::new_unique(), + &Pubkey::new_unique(), + 100, + ), + Err(StakeError::EpochRewardsActive.into()), + ); + process_instruction_as_one_arg( + Arc::clone(&feature_set), + &instruction::move_lamports( + &Pubkey::new_unique(), + &Pubkey::new_unique(), + &Pubkey::new_unique(), + 100, + ), + Err(StakeError::EpochRewardsActive.into()), + ); // Only GetMinimumDelegation should not return StakeError::EpochRewardsActive process_instruction_as_one_arg(