Skip to content

Commit

Permalink
Add explicit comment about get_stake_account
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyera Eulberg committed Jul 28, 2022
1 parent b660ac5 commit f747344
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions programs/stake/src/stake_instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,20 @@ pub fn process_instruction(
Err(InstructionError::InvalidInstructionData)
}
}
// In order to prevent consensus issues, any new StakeInstruction variant added before the
// `add_get_minimum_delegation_instruction_to_stake_program` is activated needs to check
// the validity of the stake account by calling the `get_stake_account()` method outside
// its own feature gate, as per the following pattern:
// ```
// Ok(StakeInstruction::Variant) -> {
// let mut me = get_stake_account()?;
// if invoke_context
// .feature_set
// .is_active(&feature_set::stake_variant_feature::id()) { .. }
// }
// ```
// TODO: Remove this comment when `add_get_minimum_delegation_instruction_to_stake_program`
// is cleaned up
Err(err) => {
if !invoke_context.feature_set.is_active(
&feature_set::add_get_minimum_delegation_instruction_to_stake_program::id(),
Expand Down

0 comments on commit f747344

Please sign in to comment.