The --identity argument is now required
This commit is contained in:
parent
04d11ca6c6
commit
76ddc93358
10
run.sh
10
run.sh
|
@ -73,9 +73,9 @@ else
|
||||||
--hashes-per-tick sleep \
|
--hashes-per-tick sleep \
|
||||||
--faucet-lamports 500000000000000000 \
|
--faucet-lamports 500000000000000000 \
|
||||||
--bootstrap-validator \
|
--bootstrap-validator \
|
||||||
"$dataDir"/validator-identity.json \
|
"$validator_identity" \
|
||||||
"$dataDir"/validator-vote-account.json \
|
"$validator_vote_account" \
|
||||||
"$dataDir"/validator-stake-account.json \
|
"$validator_stake_account" \
|
||||||
--ledger "$ledgerDir" \
|
--ledger "$ledgerDir" \
|
||||||
--cluster-type "$SOLANA_RUN_SH_CLUSTER_TYPE" \
|
--cluster-type "$SOLANA_RUN_SH_CLUSTER_TYPE" \
|
||||||
$SPL_GENESIS_ARGS \
|
$SPL_GENESIS_ARGS \
|
||||||
|
@ -93,8 +93,8 @@ solana-faucet &
|
||||||
faucet=$!
|
faucet=$!
|
||||||
|
|
||||||
args=(
|
args=(
|
||||||
--identity "$dataDir"/validator-identity.json
|
--identity "$validator_identity"
|
||||||
--vote-account "$dataDir"/validator-vote-account.json
|
--vote-account "$validator_vote_account"
|
||||||
--ledger "$ledgerDir"
|
--ledger "$ledgerDir"
|
||||||
--gossip-port 8001
|
--gossip-port 8001
|
||||||
--rpc-port 8899
|
--rpc-port 8899
|
||||||
|
|
|
@ -73,12 +73,8 @@ use {
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
enum Operation {
|
enum Operation {
|
||||||
Exit,
|
|
||||||
Initialize,
|
Initialize,
|
||||||
Monitor,
|
|
||||||
Run,
|
Run,
|
||||||
SetLogFilter { filter: String },
|
|
||||||
WaitForRestartWindow { min_idle_time_in_minutes: usize },
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn wait_for_restart_window(
|
fn wait_for_restart_window(
|
||||||
|
@ -990,7 +986,7 @@ pub fn main() {
|
||||||
Arg::with_name("identity")
|
Arg::with_name("identity")
|
||||||
.short("i")
|
.short("i")
|
||||||
.long("identity")
|
.long("identity")
|
||||||
.value_name("PATH")
|
.value_name("KEYPAIR")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.validator(is_keypair_or_ask_keyword)
|
.validator(is_keypair_or_ask_keyword)
|
||||||
.help("Validator identity keypair"),
|
.help("Validator identity keypair"),
|
||||||
|
@ -998,7 +994,7 @@ pub fn main() {
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("authorized_voter_keypairs")
|
Arg::with_name("authorized_voter_keypairs")
|
||||||
.long("authorized-voter")
|
.long("authorized-voter")
|
||||||
.value_name("PATH")
|
.value_name("KEYPAIR")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.validator(is_keypair_or_ask_keyword)
|
.validator(is_keypair_or_ask_keyword)
|
||||||
.requires("vote_account")
|
.requires("vote_account")
|
||||||
|
@ -1010,7 +1006,7 @@ pub fn main() {
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("vote_account")
|
Arg::with_name("vote_account")
|
||||||
.long("vote-account")
|
.long("vote-account")
|
||||||
.value_name("PUBKEY")
|
.value_name("ADDRESS")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.validator(is_pubkey_or_keypair)
|
.validator(is_pubkey_or_keypair)
|
||||||
.requires("identity")
|
.requires("identity")
|
||||||
|
@ -1364,7 +1360,7 @@ pub fn main() {
|
||||||
Arg::with_name("trusted_validators")
|
Arg::with_name("trusted_validators")
|
||||||
.long("trusted-validator")
|
.long("trusted-validator")
|
||||||
.validator(is_pubkey)
|
.validator(is_pubkey)
|
||||||
.value_name("PUBKEY")
|
.value_name("VALIDATOR IDENTITY")
|
||||||
.multiple(true)
|
.multiple(true)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.help("A snapshot hash must be published in gossip by this validator to be accepted. \
|
.help("A snapshot hash must be published in gossip by this validator to be accepted. \
|
||||||
|
@ -1374,7 +1370,7 @@ pub fn main() {
|
||||||
Arg::with_name("debug_key")
|
Arg::with_name("debug_key")
|
||||||
.long("debug-key")
|
.long("debug-key")
|
||||||
.validator(is_pubkey)
|
.validator(is_pubkey)
|
||||||
.value_name("PUBKEY")
|
.value_name("ADDRESS")
|
||||||
.multiple(true)
|
.multiple(true)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.help("Log when transactions are processed which reference a given key."),
|
.help("Log when transactions are processed which reference a given key."),
|
||||||
|
@ -1389,7 +1385,7 @@ pub fn main() {
|
||||||
Arg::with_name("repair_validators")
|
Arg::with_name("repair_validators")
|
||||||
.long("repair-validator")
|
.long("repair-validator")
|
||||||
.validator(is_pubkey)
|
.validator(is_pubkey)
|
||||||
.value_name("PUBKEY")
|
.value_name("VALIDATOR IDENTITY")
|
||||||
.multiple(true)
|
.multiple(true)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.help("A list of validators to request repairs from. If specified, repair will not \
|
.help("A list of validators to request repairs from. If specified, repair will not \
|
||||||
|
@ -1399,7 +1395,7 @@ pub fn main() {
|
||||||
Arg::with_name("gossip_validators")
|
Arg::with_name("gossip_validators")
|
||||||
.long("gossip-validator")
|
.long("gossip-validator")
|
||||||
.validator(is_pubkey)
|
.validator(is_pubkey)
|
||||||
.value_name("PUBKEY")
|
.value_name("VALIDATOR IDENTITY")
|
||||||
.multiple(true)
|
.multiple(true)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.help("A list of validators to gossip with. If specified, gossip \
|
.help("A list of validators to gossip with. If specified, gossip \
|
||||||
|
@ -1701,31 +1697,68 @@ pub fn main() {
|
||||||
)
|
)
|
||||||
.get_matches();
|
.get_matches();
|
||||||
|
|
||||||
|
let ledger_path = PathBuf::from(matches.value_of("ledger_path").unwrap());
|
||||||
|
|
||||||
let operation = match matches.subcommand() {
|
let operation = match matches.subcommand() {
|
||||||
("", _) | ("run", _) => Operation::Run,
|
("", _) | ("run", _) => Operation::Run,
|
||||||
("exit", _) => Operation::Exit,
|
|
||||||
("init", _) => Operation::Initialize,
|
("init", _) => Operation::Initialize,
|
||||||
("monitor", _) => Operation::Monitor,
|
("exit", _) => {
|
||||||
("set-log-filter", Some(subcommand_matches)) => Operation::SetLogFilter {
|
let admin_client = admin_rpc_service::connect(&ledger_path);
|
||||||
filter: value_t_or_exit!(subcommand_matches, "filter", String),
|
admin_rpc_service::runtime()
|
||||||
},
|
.block_on(async move { admin_client.await?.exit().await })
|
||||||
("wait-for-restart-window", Some(subcommand_matches)) => Operation::WaitForRestartWindow {
|
.unwrap_or_else(|err| {
|
||||||
min_idle_time_in_minutes: value_t_or_exit!(
|
println!("exit request failed: {}", err);
|
||||||
subcommand_matches,
|
exit(1);
|
||||||
"min_idle_time_in_minutes",
|
});
|
||||||
usize
|
return;
|
||||||
),
|
}
|
||||||
},
|
("monitor", _) => {
|
||||||
|
let dashboard = Dashboard::new(&ledger_path, None, None).unwrap_or_else(|err| {
|
||||||
|
println!(
|
||||||
|
"Error: Unable to connect to validator at {}: {:?}",
|
||||||
|
ledger_path.display(),
|
||||||
|
err,
|
||||||
|
);
|
||||||
|
exit(1);
|
||||||
|
});
|
||||||
|
dashboard.run(Duration::from_secs(2));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
("set-log-filter", Some(subcommand_matches)) => {
|
||||||
|
let filter = value_t_or_exit!(subcommand_matches, "filter", String);
|
||||||
|
let admin_client = admin_rpc_service::connect(&ledger_path);
|
||||||
|
admin_rpc_service::runtime()
|
||||||
|
.block_on(async move { admin_client.await?.set_log_filter(filter).await })
|
||||||
|
.unwrap_or_else(|err| {
|
||||||
|
println!("set log filter failed: {}", err);
|
||||||
|
exit(1);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
("wait-for-restart-window", Some(subcommand_matches)) => {
|
||||||
|
let min_idle_time_in_minutes =
|
||||||
|
value_t_or_exit!(subcommand_matches, "min_idle_time_in_minutes", usize);
|
||||||
|
wait_for_restart_window(&ledger_path, min_idle_time_in_minutes).unwrap_or_else(|err| {
|
||||||
|
println!("{}", err);
|
||||||
|
exit(1);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let identity_keypair = Arc::new(keypair_of(&matches, "identity").unwrap_or_else(Keypair::new));
|
let identity_keypair = Arc::new(keypair_of(&matches, "identity").unwrap_or_else(|| {
|
||||||
|
clap::Error::with_description(
|
||||||
|
"The --identity <KEYPAIR> argument is required",
|
||||||
|
clap::ErrorKind::ArgumentNotFound,
|
||||||
|
)
|
||||||
|
.exit();
|
||||||
|
}));
|
||||||
|
|
||||||
let authorized_voter_keypairs = keypairs_of(&matches, "authorized_voter_keypairs")
|
let authorized_voter_keypairs = keypairs_of(&matches, "authorized_voter_keypairs")
|
||||||
.map(|keypairs| keypairs.into_iter().map(Arc::new).collect())
|
.map(|keypairs| keypairs.into_iter().map(Arc::new).collect())
|
||||||
.unwrap_or_else(|| vec![identity_keypair.clone()]);
|
.unwrap_or_else(|| vec![identity_keypair.clone()]);
|
||||||
|
|
||||||
let ledger_path = PathBuf::from(matches.value_of("ledger_path").unwrap());
|
|
||||||
let init_complete_file = matches.value_of("init_complete_file");
|
let init_complete_file = matches.value_of("init_complete_file");
|
||||||
|
|
||||||
let rpc_bootstrap_config = RpcBootstrapConfig {
|
let rpc_bootstrap_config = RpcBootstrapConfig {
|
||||||
|
@ -2070,50 +2103,6 @@ pub fn main() {
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
match operation {
|
|
||||||
Operation::Exit => {
|
|
||||||
let admin_client = admin_rpc_service::connect(&ledger_path);
|
|
||||||
admin_rpc_service::runtime()
|
|
||||||
.block_on(async move { admin_client.await?.exit().await })
|
|
||||||
.unwrap_or_else(|err| {
|
|
||||||
println!("exit request failed: {}", err);
|
|
||||||
exit(1);
|
|
||||||
});
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
Operation::SetLogFilter { filter } => {
|
|
||||||
let admin_client = admin_rpc_service::connect(&ledger_path);
|
|
||||||
admin_rpc_service::runtime()
|
|
||||||
.block_on(async move { admin_client.await?.set_log_filter(filter).await })
|
|
||||||
.unwrap_or_else(|err| {
|
|
||||||
println!("set log filter failed: {}", err);
|
|
||||||
exit(1);
|
|
||||||
});
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
Operation::Monitor => {
|
|
||||||
let dashboard = Dashboard::new(&ledger_path, None, None).unwrap_or_else(|err| {
|
|
||||||
println!(
|
|
||||||
"Error: Unable to connect to validator at {}: {:?}",
|
|
||||||
ledger_path.display(),
|
|
||||||
err,
|
|
||||||
);
|
|
||||||
exit(1);
|
|
||||||
});
|
|
||||||
dashboard.run(Duration::from_secs(2));
|
|
||||||
}
|
|
||||||
Operation::WaitForRestartWindow {
|
|
||||||
min_idle_time_in_minutes,
|
|
||||||
} => {
|
|
||||||
wait_for_restart_window(&ledger_path, min_idle_time_in_minutes).unwrap_or_else(|err| {
|
|
||||||
println!("{}", err);
|
|
||||||
exit(1);
|
|
||||||
});
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
Operation::Initialize | Operation::Run => {}
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut ledger_fd_lock = FdLock::new(fs::File::open(&ledger_path).unwrap());
|
let mut ledger_fd_lock = FdLock::new(fs::File::open(&ledger_path).unwrap());
|
||||||
let _ledger_lock = ledger_fd_lock.try_lock().unwrap_or_else(|_| {
|
let _ledger_lock = ledger_fd_lock.try_lock().unwrap_or_else(|_| {
|
||||||
println!(
|
println!(
|
||||||
|
|
Loading…
Reference in New Issue