Remove legacy inflation activation code
This commit is contained in:
parent
bb183938d9
commit
c4aee8c0a0
|
@ -7,50 +7,14 @@ extern crate solana_exchange_program;
|
|||
#[macro_use]
|
||||
extern crate solana_vest_program;
|
||||
|
||||
use log::*;
|
||||
use solana_runtime::bank::{Bank, EnteredEpochCallback};
|
||||
use solana_sdk::{
|
||||
clock::{Epoch, GENESIS_EPOCH},
|
||||
entrypoint_native::{ErasedProcessInstructionWithContext, ProcessInstructionWithContext},
|
||||
genesis_config::ClusterType,
|
||||
inflation::Inflation,
|
||||
pubkey::Pubkey,
|
||||
};
|
||||
|
||||
pub fn get_inflation(cluster_type: ClusterType, epoch: Epoch) -> Option<Inflation> {
|
||||
match cluster_type {
|
||||
ClusterType::Development => match epoch {
|
||||
0 => Some(Inflation::default()),
|
||||
_ => None,
|
||||
},
|
||||
ClusterType::Devnet => match epoch {
|
||||
0 => Some(Inflation::default()),
|
||||
_ => None,
|
||||
},
|
||||
ClusterType::Testnet => match epoch {
|
||||
// No inflation at epoch 0
|
||||
0 => Some(Inflation::new_disabled()),
|
||||
// testnet enabled inflation at epoch 44:
|
||||
// https://github.com/solana-labs/solana/commit/d8e885f4259e6c7db420cce513cb34ebf961073d
|
||||
44 => Some(Inflation::default()),
|
||||
// Completely disable inflation prior to ship the inflation fix at epoch 68
|
||||
68 => Some(Inflation::new_disabled()),
|
||||
// Enable again after the inflation fix has landed:
|
||||
// https://github.com/solana-labs/solana/commit/7cc2a6801bed29a816ef509cfc26a6f2522e46ff
|
||||
74 => Some(Inflation::default()),
|
||||
_ => None,
|
||||
},
|
||||
ClusterType::MainnetBeta => match epoch {
|
||||
// No inflation at epoch 0
|
||||
0 => Some(Inflation::new_disabled()),
|
||||
// Inflation starts The epoch of Epoch::MAX is a placeholder and is
|
||||
// expected to be reduced in a future hard fork.
|
||||
Epoch::MAX => Some(Inflation::default()),
|
||||
_ => None,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
enum Program {
|
||||
Native((String, Pubkey)),
|
||||
BuiltinLoader((String, Pubkey, ProcessInstructionWithContext)),
|
||||
|
@ -144,10 +108,6 @@ pub fn get_entered_epoch_callback(cluster_type: ClusterType) -> EnteredEpochCall
|
|||
// In other words, this callback initializes some skip(serde) fields, regardless
|
||||
// frozen or not
|
||||
|
||||
if let Some(inflation) = get_inflation(cluster_type, bank.epoch()) {
|
||||
info!("Entering new epoch with inflation {:?}", inflation);
|
||||
bank.set_inflation(inflation);
|
||||
}
|
||||
for (program, start_epoch) in get_programs(cluster_type) {
|
||||
let should_populate =
|
||||
initial && bank.epoch() >= start_epoch || !initial && bank.epoch() == start_epoch;
|
||||
|
@ -206,15 +166,6 @@ mod tests {
|
|||
do_test_uniqueness(get_programs(ClusterType::MainnetBeta));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_development_inflation() {
|
||||
assert_eq!(
|
||||
get_inflation(ClusterType::Development, 0).unwrap(),
|
||||
Inflation::default()
|
||||
);
|
||||
assert_eq!(get_inflation(ClusterType::Development, 1), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_development_programs() {
|
||||
assert_eq!(get_programs(ClusterType::Development).len(), 5);
|
||||
|
@ -227,20 +178,6 @@ mod tests {
|
|||
3
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_softlaunch_inflation() {
|
||||
assert_eq!(
|
||||
get_inflation(ClusterType::MainnetBeta, 0).unwrap(),
|
||||
Inflation::new_disabled()
|
||||
);
|
||||
assert_eq!(get_inflation(ClusterType::MainnetBeta, 1), None);
|
||||
assert_eq!(
|
||||
get_inflation(ClusterType::MainnetBeta, std::u64::MAX).unwrap(),
|
||||
Inflation::default()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_softlaunch_programs() {
|
||||
assert!(!get_programs(ClusterType::MainnetBeta).is_empty());
|
||||
|
|
|
@ -464,13 +464,11 @@ fn main() -> Result<(), Box<dyn error::Error>> {
|
|||
|
||||
let native_instruction_processors =
|
||||
solana_genesis_programs::get_native_programs_for_genesis(cluster_type);
|
||||
let inflation = solana_genesis_programs::get_inflation(cluster_type, 0).unwrap();
|
||||
|
||||
let mut genesis_config = GenesisConfig {
|
||||
native_instruction_processors,
|
||||
ticks_per_slot,
|
||||
epoch_schedule,
|
||||
inflation,
|
||||
fee_rate_governor,
|
||||
rent,
|
||||
poh_config,
|
||||
|
|
|
@ -179,9 +179,6 @@ impl LocalCluster {
|
|||
_ => (),
|
||||
}
|
||||
|
||||
genesis_config.inflation =
|
||||
solana_genesis_programs::get_inflation(genesis_config.cluster_type, 0).unwrap();
|
||||
|
||||
genesis_config
|
||||
.native_instruction_processors
|
||||
.extend_from_slice(&config.native_instruction_processors);
|
||||
|
|
Loading…
Reference in New Issue