From 2dca82690b8e40bcf17f5c17f6c014a05069238e Mon Sep 17 00:00:00 2001 From: Brooks Prumo Date: Wed, 13 Apr 2022 17:16:10 -0500 Subject: [PATCH] Deprecate `MINIMUM_STAKE_DELEGATION` --- programs/stake/src/lib.rs | 1 + sdk/program/src/stake/deprecated.rs | 5 +++++ sdk/program/src/stake/mod.rs | 7 +++---- 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 sdk/program/src/stake/deprecated.rs diff --git a/programs/stake/src/lib.rs b/programs/stake/src/lib.rs index 65f83524ae0b01..1041288fdb2d7c 100644 --- a/programs/stake/src/lib.rs +++ b/programs/stake/src/lib.rs @@ -23,5 +23,6 @@ pub(crate) 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 } diff --git a/sdk/program/src/stake/deprecated.rs b/sdk/program/src/stake/deprecated.rs new file mode 100644 index 00000000000000..c50dba9a35eee2 --- /dev/null +++ b/sdk/program/src/stake/deprecated.rs @@ -0,0 +1,5 @@ +#[deprecated( + since = "1.11.0", + note = "please use `solana_program::stake::tools::get_minimum_delegation()` instead" +)] +pub const MINIMUM_STAKE_DELEGATION: u64 = 1; diff --git a/sdk/program/src/stake/mod.rs b/sdk/program/src/stake/mod.rs index 5366b112b8b2cc..6c743ae6d36b27 100644 --- a/sdk/program/src/stake/mod.rs +++ b/sdk/program/src/stake/mod.rs @@ -3,10 +3,9 @@ pub mod instruction; pub mod state; pub mod tools; +mod deprecated; +pub use deprecated::*; + pub mod program { crate::declare_id!("Stake11111111111111111111111111111111111111"); } - -// NOTE: This constant will be deprecated soon; if possible, use -// `solana_stake_program::get_minimum_delegation()` instead. -pub const MINIMUM_STAKE_DELEGATION: u64 = 1;