Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions clap-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ name = "solana_clap_utils"
chrono = { workspace = true, features = ["default"] }
clap = "2.33.0"
rpassword = { workspace = true }
solana-bls-signatures = { workspace = true }
solana-clock = { workspace = true }
solana-cluster-type = { workspace = true }
solana-commitment-config = { workspace = true }
Expand Down
32 changes: 32 additions & 0 deletions clap-utils/src/input_parsers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use {
},
chrono::DateTime,
clap::ArgMatches,
solana_bls_signatures::Pubkey as BLSPubkey,
solana_clock::UnixTimestamp,
solana_cluster_type::ClusterType,
solana_commitment_config::CommitmentConfig,
Expand Down Expand Up @@ -104,6 +105,19 @@ pub fn pubkeys_of(matches: &ArgMatches<'_>, name: &str) -> Option<Vec<Pubkey>> {
})
}

pub fn bls_pubkeys_of(matches: &ArgMatches<'_>, name: &str) -> Option<Vec<BLSPubkey>> {
matches.values_of(name).map(|values| {
values
.map(|value| {
BLSPubkey::from_str(value).unwrap_or_else(|_| {
//TODO(wen): support reading BLS keypair files
panic!("Failed to parse BLS public key from value: {value}")
})
})
.collect()
})
}

// Return pubkey/signature pairs for a string of the form pubkey=signature
pub fn pubkeys_sigs_of(matches: &ArgMatches<'_>, name: &str) -> Option<Vec<(Pubkey, Signature)>> {
matches.values_of(name).map(|values| {
Expand Down Expand Up @@ -253,6 +267,7 @@ mod tests {
use {
super::*,
clap::{App, Arg},
solana_bls_signatures::{keypair::Keypair as BLSKeypair, Pubkey as BLSPubkey},
solana_keypair::write_keypair_file,
std::fs,
};
Expand Down Expand Up @@ -416,6 +431,23 @@ mod tests {
assert_ne!(lamports_of_sol(&matches, "single"), Some(502_500_000));
}

#[test]
fn test_bls_pubkeys_of() {
let bls_pubkey1: BLSPubkey = BLSKeypair::new().public;
let bls_pubkey2: BLSPubkey = BLSKeypair::new().public;
let matches = app().get_matches_from(vec![
"test",
"--multiple",
&bls_pubkey1.to_string(),
"--multiple",
&bls_pubkey2.to_string(),
]);
assert_eq!(
bls_pubkeys_of(&matches, "multiple"),
Some(vec![bls_pubkey1, bls_pubkey2])
);
}

#[test]
fn test_lamports_of_sol() {
let matches = app().get_matches_from(vec!["test", "--single", "50"]);
Expand Down
1 change: 1 addition & 0 deletions genesis/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ serde_json = { workspace = true }
serde_yaml = { workspace = true }
solana-account = "=3.1.0"
solana-accounts-db = { workspace = true }
solana-bls-signatures = { workspace = true }
solana-clap-utils = { workspace = true }
solana-cli-config = { workspace = true }
solana-clock = "=3.0.0"
Expand Down
1 change: 1 addition & 0 deletions genesis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ pub struct StakedValidatorAccountInfo {
pub identity_account: String,
pub vote_account: String,
pub stake_account: String,
pub bls_pubkey: Option<String>,
}
Loading
Loading