From 48a085c28f90d720e2b31248a4389eee3d37e66a Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Sun, 8 Dec 2019 14:08:35 -0700 Subject: [PATCH] Add argument to configure the authorized pubkey for the bootstrap leader's stake (#7362) automerge --- genesis/src/main.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/genesis/src/main.rs b/genesis/src/main.rs index 8e2647d103..f801ed7dd9 100644 --- a/genesis/src/main.rs +++ b/genesis/src/main.rs @@ -164,7 +164,6 @@ fn main() -> Result<(), Box> { ) .arg( Arg::with_name("bootstrap_vote_pubkey_file") - .short("s") .long("bootstrap-vote-pubkey") .value_name("BOOTSTRAP VOTE PUBKEY") .takes_value(true) @@ -173,13 +172,19 @@ fn main() -> Result<(), Box> { ) .arg( Arg::with_name("bootstrap_stake_pubkey_file") - .short("k") .long("bootstrap-stake-pubkey") .value_name("BOOTSTRAP STAKE PUBKEY") .takes_value(true) .required(true) .help("Path to file containing the bootstrap leader's staking pubkey"), ) + .arg( + Arg::with_name("bootstrap_stake_authorized_pubkey_file") + .long("bootstrap-stake-authorized-pubkey") + .value_name("BOOTSTRAP STAKE AUTHORIZED PUBKEY") + .takes_value(true) + .help("Path to file containing the pubkey authorized to manage the bootstrap leader's stake [default: --bootstrap-leader-pubkey]"), + ) .arg( Arg::with_name("bootstrap_storage_pubkey_file") .long("bootstrap-storage-pubkey") @@ -326,6 +331,8 @@ fn main() -> Result<(), Box> { let bootstrap_leader_pubkey = required_pubkey(&matches, "bootstrap_leader_pubkey_file")?; let bootstrap_vote_pubkey = required_pubkey(&matches, "bootstrap_vote_pubkey_file")?; let bootstrap_stake_pubkey = required_pubkey(&matches, "bootstrap_stake_pubkey_file")?; + let bootstrap_stake_authorized_pubkey = + pubkey_of(&matches, "bootstrap_stake_authorized_pubkey_file"); let bootstrap_storage_pubkey = pubkey_of(&matches, "bootstrap_storage_pubkey_file"); let faucet_pubkey = pubkey_of(&matches, "faucet_pubkey_file"); @@ -339,7 +346,9 @@ fn main() -> Result<(), Box> { vote_state::create_account(&bootstrap_vote_pubkey, &bootstrap_leader_pubkey, 0, 1); let bootstrap_leader_stake_account = stake_state::create_account( - &bootstrap_leader_pubkey, + bootstrap_stake_authorized_pubkey + .as_ref() + .unwrap_or(&bootstrap_leader_pubkey), &bootstrap_vote_pubkey, &bootstrap_leader_vote_account, &rent, @@ -457,7 +466,8 @@ fn main() -> Result<(), Box> { create_new_ledger(&ledger_path, &genesis_config)?; println!( - "Genesis mode: {:?} hashes per tick: {:?} slots_per_epoch: {} capitalization: {}SOL in {} accounts", + "Genesis hash: {}\nOperating mode: {:?}\nHashes per tick: {:?}\nSlots per epoch: {}\nCapitalization: {} SOL in {} accounts", + genesis_config.hash(), operating_mode, genesis_config.poh_config.hashes_per_tick, slots_per_epoch,