Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up require_rent_exempt_split_destination feature #253

Merged
merged 2 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions programs/stake/src/stake_instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,12 +468,6 @@ mod tests {
feature_set
}

fn feature_set_without_require_rent_exempt_split_destination() -> Arc<FeatureSet> {
let mut feature_set = FeatureSet::all_enabled();
feature_set.deactivate(&feature_set::require_rent_exempt_split_destination::id());
Arc::new(feature_set)
}

fn create_default_account() -> AccountSharedData {
AccountSharedData::new(0, 0, &Pubkey::new_unique())
}
Expand Down Expand Up @@ -6013,7 +6007,6 @@ mod tests {
}
}

#[test_case(feature_set_without_require_rent_exempt_split_destination(), Ok(()); "without_require_rent_exempt_split_destination")]
#[test_case(feature_set_all_enabled(), Err(InstructionError::InsufficientFunds); "all_enabled")]
fn test_split_require_rent_exempt_destination(
feature_set: Arc<FeatureSet>,
Expand Down
12 changes: 2 additions & 10 deletions programs/stake/src/stake_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,15 +417,10 @@ pub fn split(
StakeStateV2::Stake(meta, mut stake, stake_flags) => {
meta.authorized.check(signers, StakeAuthorize::Staker)?;
let minimum_delegation = crate::get_minimum_delegation(&invoke_context.feature_set);
let is_active = if invoke_context
.feature_set
.is_active(&feature_set::require_rent_exempt_split_destination::id())
{
let is_active = {
let clock = invoke_context.get_sysvar_cache().get_clock()?;
let status = get_stake_status(invoke_context, &stake, &clock)?;
status.effective > 0
} else {
false
};
let validated_split_info = validate_split_amount(
invoke_context,
Expand Down Expand Up @@ -994,10 +989,7 @@ fn validate_split_amount(
// these criteria must be met:
// 1. the destination account must be prefunded with at least the rent-exempt reserve, or
// 2. the split must consume 100% of the source
if invoke_context
.feature_set
.is_active(&feature_set::require_rent_exempt_split_destination::id())
&& source_is_active
if source_is_active
CriesofCarrots marked this conversation as resolved.
Show resolved Hide resolved
&& source_remaining_balance != 0
&& destination_lamports < destination_rent_exempt_reserve
{
Expand Down
Loading