Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion genesis/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use solana_sdk::{
epoch_schedule::EpochSchedule,
fee_calculator::FeeRateGovernor,
genesis_config::{ClusterType, GenesisConfig},
inflation::Inflation,
native_token::sol_to_lamports,
poh_config::PohConfig,
pubkey::Pubkey,
Expand Down Expand Up @@ -270,6 +271,15 @@ fn main() -> Result<(), Box<dyn error::Error>> {
.help("percentage of collected fee to burn")
.validator(is_valid_percentage),
)
.arg(
Arg::with_name("vote_commission_percentage")
.long("vote-commission-percentage")
.value_name("NUMBER")
.takes_value(true)
.default_value("100")
.help("percentage of vote commission")
.validator(is_valid_percentage),
)
.arg(
Arg::with_name("target_signatures_per_slot")
.long("target-signatures-per-slot")
Expand Down Expand Up @@ -363,6 +373,14 @@ fn main() -> Result<(), Box<dyn error::Error>> {
.multiple(true)
.help("Install a BPF program at the given address"),
)
.arg(
Arg::with_name("inflation")
.required(false)
.long("inflation")
.takes_value(true)
.possible_values(&["pico", "full", "none"])
.help("Selects inflation"),
)
.get_matches();

let ledger_path = PathBuf::from(matches.value_of("ledger_path").unwrap());
Expand Down Expand Up @@ -491,6 +509,18 @@ fn main() -> Result<(), Box<dyn error::Error>> {
..GenesisConfig::default()
};

if let Ok(raw_inflation) = value_t!(matches, "inflation", String) {
let inflation = match raw_inflation.as_str() {
"pico" => Inflation::pico(),
"full" => Inflation::full(),
"none" => Inflation::new_disabled(),
_ => unreachable!(),
};
genesis_config.inflation = inflation;
}

let commission = value_t_or_exit!(matches, "vote_commission_percentage", u8);

let mut bootstrap_validator_pubkeys_iter = bootstrap_validator_pubkeys.iter();
loop {
let identity_pubkey = match bootstrap_validator_pubkeys_iter.next() {
Expand All @@ -509,7 +539,7 @@ fn main() -> Result<(), Box<dyn error::Error>> {
&identity_pubkey,
&identity_pubkey,
&identity_pubkey,
100,
commission,
VoteState::get_rent_exempt_reserve(&rent).max(1),
);

Expand Down
24 changes: 17 additions & 7 deletions ledger-tool/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1196,11 +1196,12 @@ fn main() {
which could be an epoch in a galaxy far far away"),
)
.arg(
Arg::with_name("enable_inflation")
Arg::with_name("inflation")
.required(false)
.long("enable-inflation")
.takes_value(false)
.help("Always enable inflation when warping even if it's disabled"),
.long("inflation")
.takes_value(true)
.possible_values(&["pico", "full", "none"])
.help("Overwrite inflation when warping"),
)
.arg(
Arg::with_name("enable_stake_program_v2")
Expand Down Expand Up @@ -2044,8 +2045,13 @@ fn main() {
exit(1);
}

if arg_matches.is_present("enable_inflation") {
let inflation = Inflation::pico();
if let Ok(raw_inflation) = value_t!(arg_matches, "inflation", String) {
let inflation = match raw_inflation.as_str() {
"pico" => Inflation::pico(),
"full" => Inflation::full(),
"none" => Inflation::new_disabled(),
_ => unreachable!(),
};
println!(
"Forcing to: {:?} (was: {:?})",
inflation,
Expand Down Expand Up @@ -2096,6 +2102,10 @@ fn main() {
force_enabled_count += 1;
}

if force_enabled_count == 0 {
warn!("Already stake_program_v2 is activated (or scheduled)");
}

let mut store_failed_count = 0;
if force_enabled_count >= 1 {
if base_bank
Expand Down Expand Up @@ -2488,7 +2498,7 @@ fn main() {
if arg_matches.is_present("recalculate_capitalization") {
eprintln!("Capitalization isn't verified because it's recalculated");
}
if arg_matches.is_present("enable_inflation") {
if arg_matches.is_present("inflation") {
eprintln!(
"Forcing inflation isn't meaningful because bank isn't warping"
);
Expand Down