Remove active features stake program v3 and v4 (#22612)

Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
This commit is contained in:
Brooks Prumo
2022-01-21 19:27:53 -06:00
committed by GitHub
parent 0cf886302d
commit a7f2fff219
5 changed files with 77 additions and 389 deletions

View File

@ -123,9 +123,6 @@ pub fn process_instruction(
}
}
StakeInstruction::DelegateStake => {
let can_reverse_deactivation = invoke_context
.feature_set
.is_active(&feature_set::stake_program_v4::id());
let vote = keyed_account_at_index(keyed_accounts, first_instruction_account + 1)?;
me.delegate(
@ -143,7 +140,6 @@ pub fn process_instruction(
first_instruction_account + 4,
)?)?,
&signers,
can_reverse_deactivation,
)
}
StakeInstruction::Split(lamports) => {
@ -154,9 +150,6 @@ pub fn process_instruction(
StakeInstruction::Merge => {
let source_stake =
&keyed_account_at_index(keyed_accounts, first_instruction_account + 1)?;
let can_merge_expired_lockups = invoke_context
.feature_set
.is_active(&feature_set::stake_program_v4::id());
me.merge(
invoke_context,
source_stake,
@ -169,7 +162,6 @@ pub fn process_instruction(
first_instruction_account + 3,
)?)?,
&signers,
can_merge_expired_lockups,
)
}
StakeInstruction::Withdraw(lamports) => {
@ -187,9 +179,6 @@ pub fn process_instruction(
)?)?,
keyed_account_at_index(keyed_accounts, first_instruction_account + 4)?,
keyed_account_at_index(keyed_accounts, first_instruction_account + 5).ok(),
invoke_context
.feature_set
.is_active(&feature_set::stake_program_v4::id()),
)
}
StakeInstruction::Deactivate => me.deactivate(
@ -200,15 +189,8 @@ pub fn process_instruction(
&signers,
),
StakeInstruction::SetLockup(lockup) => {
let clock = if invoke_context
.feature_set
.is_active(&feature_set::stake_program_v4::id())
{
Some(invoke_context.get_sysvar_cache().get_clock()?)
} else {
None
};
me.set_lockup(&lockup, &signers, clock.as_deref())
let clock = invoke_context.get_sysvar_cache().get_clock()?;
me.set_lockup(&lockup, &signers, &clock)
}
StakeInstruction::InitializeChecked => {
if invoke_context
@ -326,8 +308,8 @@ pub fn process_instruction(
epoch: lockup_checked.epoch,
custodian,
};
let clock = Some(invoke_context.get_sysvar_cache().get_clock()?);
me.set_lockup(&lockup, &signers, clock.as_deref())
let clock = invoke_context.get_sysvar_cache().get_clock()?;
me.set_lockup(&lockup, &signers, &clock)
} else {
Err(InstructionError::InvalidInstructionData)
}

File diff suppressed because it is too large Load Diff