diff --git a/programs/stake/src/stake_instruction.rs b/programs/stake/src/stake_instruction.rs index 7eeb633ed71514..fb08caab16aa19 100644 --- a/programs/stake/src/stake_instruction.rs +++ b/programs/stake/src/stake_instruction.rs @@ -3886,7 +3886,10 @@ mod tests { ]; for (stake_delegation, expected_result) in &[ (minimum_delegation, Ok(())), - (minimum_delegation - 1, Err(StakeError::InsufficientStake)), + ( + minimum_delegation - 1, + Err(StakeError::InsufficientDelegation), + ), ] { for stake_state in &[ StakeState::Initialized(meta), @@ -7029,7 +7032,7 @@ mod tests { fn test_behavior_withdrawal_then_redelegate_with_less_than_minimum_stake_delegation() { do_test_behavior_withdrawal_then_redelegate_with_less_than_minimum_stake_delegation( new_feature_set(), - Err(StakeError::InsufficientStake.into()), + Err(StakeError::InsufficientDelegation.into()), ); } #[test] diff --git a/programs/stake/src/stake_state.rs b/programs/stake/src/stake_state.rs index bbe7f9e8311f77..24ab07d14c3615 100644 --- a/programs/stake/src/stake_state.rs +++ b/programs/stake/src/stake_state.rs @@ -1034,7 +1034,7 @@ fn validate_delegated_amount( || feature_set.is_active(&feature_set::stake_raise_minimum_delegation_to_1_sol::id())) && stake_amount < crate::get_minimum_delegation(feature_set) { - return Err(StakeError::InsufficientStake.into()); + return Err(StakeError::InsufficientDelegation.into()); } Ok(ValidatedDelegatedInfo { stake_amount }) } diff --git a/sdk/program/src/stake/instruction.rs b/sdk/program/src/stake/instruction.rs index 13b0c2378a663d..9a7601a640807f 100644 --- a/sdk/program/src/stake/instruction.rs +++ b/sdk/program/src/stake/instruction.rs @@ -57,6 +57,9 @@ pub enum StakeError { "stake account has not been delinquent for the minimum epochs required for deactivation" )] MinimumDelinquentEpochsForDeactivationNotMet, + + #[error("delegation amount is less than the minimum")] + InsufficientDelegation, } impl DecodeError for StakeError {