genesis, ledger-tool: --inflation/--vote-commission-percentaage (#13989)
This commit is contained in:
parent
2f374df494
commit
82c75c3786
|
@ -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,
|
||||
|
@ -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")
|
||||
|
@ -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());
|
||||
|
@ -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() {
|
||||
|
@ -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),
|
||||
);
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue