Skip to content

Commit

Permalink
Raise minimum stake delegation to 1 SOL (#24603)
Browse files Browse the repository at this point in the history
  • Loading branch information
brooksprumo authored May 7, 2022
1 parent 8e37e36 commit e6c02f3
Show file tree
Hide file tree
Showing 4 changed files with 755 additions and 200 deletions.
20 changes: 13 additions & 7 deletions programs/stake/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
note = "Please use `solana_sdk::stake::program::id` or `solana_program::stake::program::id` instead"
)]
pub use solana_sdk::stake::program::{check_id, id};
use solana_sdk::{feature_set::FeatureSet, genesis_config::GenesisConfig};
use solana_sdk::{
feature_set::{self, FeatureSet},
genesis_config::GenesisConfig,
native_token::LAMPORTS_PER_SOL,
};

pub mod config;
pub mod stake_instruction;
Expand All @@ -19,10 +23,12 @@ pub fn add_genesis_accounts(genesis_config: &mut GenesisConfig) -> u64 {
/// NOTE: This is also used to calculate the minimum balance of a stake account, which is the
/// rent exempt reserve _plus_ the minimum stake delegation.
#[inline(always)]
pub fn get_minimum_delegation(_feature_set: &FeatureSet) -> u64 {
// If/when the minimum delegation amount is changed, the `feature_set` parameter will be used
// to chose the correct value. And since the MINIMUM_STAKE_DELEGATION constant cannot be
// removed, use it here as to not duplicate magic constants.
#[allow(deprecated)]
solana_sdk::stake::MINIMUM_STAKE_DELEGATION
pub fn get_minimum_delegation(feature_set: &FeatureSet) -> u64 {
if feature_set.is_active(&feature_set::stake_raise_minimum_delegation_to_1_sol::id()) {
const MINIMUM_DELEGATION_SOL: u64 = 1;
MINIMUM_DELEGATION_SOL * LAMPORTS_PER_SOL
} else {
#[allow(deprecated)]
solana_sdk::stake::MINIMUM_STAKE_DELEGATION
}
}
Loading

0 comments on commit e6c02f3

Please sign in to comment.