Add new inflation feature-ids (#13671) (#13736)

* Add new inflation feature-ids, and full_inflation default values

* Compute inflation start from full_inflation activation

* Include pico_inflation in inflation start computation

* Add full-inflation constructor

* Align inflation taper with rewards accrual start and catch overflow edge case

(cherry picked from commit c75d97e3f2)

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
This commit is contained in:
mergify[bot]
2020-11-20 18:08:57 +00:00
committed by GitHub
parent f5ef999b31
commit 3743e44fb3
3 changed files with 184 additions and 11 deletions

View File

@@ -19,11 +19,11 @@ pub mod consistent_recent_blockhashes_sysvar {
}
pub mod pico_inflation {
solana_sdk::declare_id!("GaBtBJvmS4Arjj5W1NmFcyvPjsHN38UGYDq2MDwbs9Qu");
solana_sdk::declare_id!("4RWNif6C2WCNiKVW7otP4G7dkmkHGyKQWRpuZ1pxKU5m");
}
pub mod inflation_kill_switch {
solana_sdk::declare_id!("SECCKV5UVUsr8sTVSVAzULjdm87r7mLPaqH2FGZjevR");
pub mod full_inflation {
solana_sdk::declare_id!("DT4n6ABDqs6w4bnfwrXT9rsprcPf6cdDga1egctaPkLC");
}
pub mod spl_token_v2_multisig_fix {
@@ -97,7 +97,7 @@ lazy_static! {
(secp256k1_program_enabled::id(), "secp256k1 program"),
(consistent_recent_blockhashes_sysvar::id(), "consistent recentblockhashes sysvar"),
(pico_inflation::id(), "pico-inflation"),
(inflation_kill_switch::id(), "inflation kill switch"),
(full_inflation::id(), "full-inflation"),
(spl_token_v2_multisig_fix::id(), "spl-token multisig fix"),
(bpf_loader2_program::id(), "bpf_loader2 program"),
(bpf_compute_budget_balancing::id(), "compute budget balancing"),

View File

@@ -69,6 +69,17 @@ impl Inflation {
Self::new_fixed(0.0001) // 0.01% inflation
}
pub fn full() -> Self {
Self {
initial: DEFAULT_INITIAL,
terminal: DEFAULT_TERMINAL,
taper: DEFAULT_TAPER,
foundation: 0.0,
foundation_term: 0.0,
__unused: 0.0,
}
}
/// inflation rate at year
pub fn total(&self, year: f64) -> f64 {
assert!(year >= 0.0);