Skip to content

Commit 7f95950

Browse files
Clean up require_rent_exempt_split_destination feature (pyth-network#253)
* Clean up require_rent_exempt_split_destination feature * Clean up comment
1 parent dcc6f1e commit 7f95950

File tree

2 files changed

+3
-19
lines changed

2 files changed

+3
-19
lines changed

programs/stake/src/stake_instruction.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -468,12 +468,6 @@ mod tests {
468468
feature_set
469469
}
470470

471-
fn feature_set_without_require_rent_exempt_split_destination() -> Arc<FeatureSet> {
472-
let mut feature_set = FeatureSet::all_enabled();
473-
feature_set.deactivate(&feature_set::require_rent_exempt_split_destination::id());
474-
Arc::new(feature_set)
475-
}
476-
477471
fn create_default_account() -> AccountSharedData {
478472
AccountSharedData::new(0, 0, &Pubkey::new_unique())
479473
}
@@ -6013,7 +6007,6 @@ mod tests {
60136007
}
60146008
}
60156009

6016-
#[test_case(feature_set_without_require_rent_exempt_split_destination(), Ok(()); "without_require_rent_exempt_split_destination")]
60176010
#[test_case(feature_set_all_enabled(), Err(InstructionError::InsufficientFunds); "all_enabled")]
60186011
fn test_split_require_rent_exempt_destination(
60196012
feature_set: Arc<FeatureSet>,

programs/stake/src/stake_state.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -417,15 +417,10 @@ pub fn split(
417417
StakeStateV2::Stake(meta, mut stake, stake_flags) => {
418418
meta.authorized.check(signers, StakeAuthorize::Staker)?;
419419
let minimum_delegation = crate::get_minimum_delegation(&invoke_context.feature_set);
420-
let is_active = if invoke_context
421-
.feature_set
422-
.is_active(&feature_set::require_rent_exempt_split_destination::id())
423-
{
420+
let is_active = {
424421
let clock = invoke_context.get_sysvar_cache().get_clock()?;
425422
let status = get_stake_status(invoke_context, &stake, &clock)?;
426423
status.effective > 0
427-
} else {
428-
false
429424
};
430425
let validated_split_info = validate_split_amount(
431426
invoke_context,
@@ -990,14 +985,10 @@ fn validate_split_amount(
990985
let rent = invoke_context.get_sysvar_cache().get_rent()?;
991986
let destination_rent_exempt_reserve = rent.minimum_balance(destination_data_len);
992987

993-
// As of feature `require_rent_exempt_split_destination`, if the source is active stake, one of
994-
// these criteria must be met:
988+
// If the source is active stake, one of these criteria must be met:
995989
// 1. the destination account must be prefunded with at least the rent-exempt reserve, or
996990
// 2. the split must consume 100% of the source
997-
if invoke_context
998-
.feature_set
999-
.is_active(&feature_set::require_rent_exempt_split_destination::id())
1000-
&& source_is_active
991+
if source_is_active
1001992
&& source_remaining_balance != 0
1002993
&& destination_lamports < destination_rent_exempt_reserve
1003994
{

0 commit comments

Comments
 (0)