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,
|
epoch_schedule::EpochSchedule,
|
||||||
fee_calculator::FeeRateGovernor,
|
fee_calculator::FeeRateGovernor,
|
||||||
genesis_config::{ClusterType, GenesisConfig},
|
genesis_config::{ClusterType, GenesisConfig},
|
||||||
|
inflation::Inflation,
|
||||||
native_token::sol_to_lamports,
|
native_token::sol_to_lamports,
|
||||||
poh_config::PohConfig,
|
poh_config::PohConfig,
|
||||||
pubkey::Pubkey,
|
pubkey::Pubkey,
|
||||||
|
@ -270,6 +271,15 @@ fn main() -> Result<(), Box<dyn error::Error>> {
|
||||||
.help("percentage of collected fee to burn")
|
.help("percentage of collected fee to burn")
|
||||||
.validator(is_valid_percentage),
|
.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(
|
||||||
Arg::with_name("target_signatures_per_slot")
|
Arg::with_name("target_signatures_per_slot")
|
||||||
.long("target-signatures-per-slot")
|
.long("target-signatures-per-slot")
|
||||||
|
@ -363,6 +373,14 @@ fn main() -> Result<(), Box<dyn error::Error>> {
|
||||||
.multiple(true)
|
.multiple(true)
|
||||||
.help("Install a BPF program at the given address"),
|
.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();
|
.get_matches();
|
||||||
|
|
||||||
let ledger_path = PathBuf::from(matches.value_of("ledger_path").unwrap());
|
let ledger_path = PathBuf::from(matches.value_of("ledger_path").unwrap());
|
||||||
|
@ -491,6 +509,18 @@ fn main() -> Result<(), Box<dyn error::Error>> {
|
||||||
..GenesisConfig::default()
|
..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();
|
let mut bootstrap_validator_pubkeys_iter = bootstrap_validator_pubkeys.iter();
|
||||||
loop {
|
loop {
|
||||||
let identity_pubkey = match bootstrap_validator_pubkeys_iter.next() {
|
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,
|
&identity_pubkey,
|
||||||
&identity_pubkey,
|
&identity_pubkey,
|
||||||
100,
|
commission,
|
||||||
VoteState::get_rent_exempt_reserve(&rent).max(1),
|
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"),
|
which could be an epoch in a galaxy far far away"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("enable_inflation")
|
Arg::with_name("inflation")
|
||||||
.required(false)
|
.required(false)
|
||||||
.long("enable-inflation")
|
.long("inflation")
|
||||||
.takes_value(false)
|
.takes_value(true)
|
||||||
.help("Always enable inflation when warping even if it's disabled"),
|
.possible_values(&["pico", "full", "none"])
|
||||||
|
.help("Overwrite inflation when warping"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("enable_stake_program_v2")
|
Arg::with_name("enable_stake_program_v2")
|
||||||
|
@ -2044,8 +2045,13 @@ fn main() {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if arg_matches.is_present("enable_inflation") {
|
if let Ok(raw_inflation) = value_t!(arg_matches, "inflation", String) {
|
||||||
let inflation = Inflation::pico();
|
let inflation = match raw_inflation.as_str() {
|
||||||
|
"pico" => Inflation::pico(),
|
||||||
|
"full" => Inflation::full(),
|
||||||
|
"none" => Inflation::new_disabled(),
|
||||||
|
_ => unreachable!(),
|
||||||
|
};
|
||||||
println!(
|
println!(
|
||||||
"Forcing to: {:?} (was: {:?})",
|
"Forcing to: {:?} (was: {:?})",
|
||||||
inflation,
|
inflation,
|
||||||
|
@ -2096,6 +2102,10 @@ fn main() {
|
||||||
force_enabled_count += 1;
|
force_enabled_count += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if force_enabled_count == 0 {
|
||||||
|
warn!("Already stake_program_v2 is activated (or scheduled)");
|
||||||
|
}
|
||||||
|
|
||||||
let mut store_failed_count = 0;
|
let mut store_failed_count = 0;
|
||||||
if force_enabled_count >= 1 {
|
if force_enabled_count >= 1 {
|
||||||
if base_bank
|
if base_bank
|
||||||
|
@ -2488,7 +2498,7 @@ fn main() {
|
||||||
if arg_matches.is_present("recalculate_capitalization") {
|
if arg_matches.is_present("recalculate_capitalization") {
|
||||||
eprintln!("Capitalization isn't verified because it's recalculated");
|
eprintln!("Capitalization isn't verified because it's recalculated");
|
||||||
}
|
}
|
||||||
if arg_matches.is_present("enable_inflation") {
|
if arg_matches.is_present("inflation") {
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"Forcing inflation isn't meaningful because bank isn't warping"
|
"Forcing inflation isn't meaningful because bank isn't warping"
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue