genesis, ledger-tool: --inflation/--vote-commission-percentaage (#13989)

This commit is contained in:
Ryo Onodera
2020-12-08 01:21:16 +09:00
committed by GitHub
parent 2f374df494
commit 82c75c3786
2 changed files with 48 additions and 8 deletions

View File

@ -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),
);