Skip to content
Open
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.

16 changes: 15 additions & 1 deletion clap-utils/src/input_parsers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ use {
},
chrono::DateTime,
clap::ArgMatches,
solana_bls_signatures::{Pubkey as BLSPubkey, PubkeyCompressed as BLSPubkeyCompressed},
solana_bls_signatures::{
ProofOfPossessionCompressed as BLSProofOfPossessionCompressed, Pubkey as BLSPubkey,
PubkeyCompressed as BLSPubkeyCompressed,
},
solana_clock::UnixTimestamp,
solana_cluster_type::ClusterType,
solana_commitment_config::CommitmentConfig,
Expand Down Expand Up @@ -123,6 +126,17 @@ pub fn bls_pubkeys_of(matches: &ArgMatches<'_>, name: &str) -> Option<Vec<BLSPub
})
}

pub fn bls_pubkey_of(matches: &ArgMatches<'_>, name: &str) -> Option<BLSPubkeyCompressed> {
value_of(matches, name)
}

pub fn bls_proof_of_possession_of(
matches: &ArgMatches<'_>,
name: &str,
) -> Option<BLSProofOfPossessionCompressed> {
value_of(matches, name)
}

// 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
22 changes: 22 additions & 0 deletions cli-output/src/cli_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2018,6 +2018,28 @@ impl fmt::Display for CliSignOnlyData {
}
}

#[derive(Serialize, Deserialize, Default, Debug, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct CliSignOnlyDataWithBLS {
#[serde(flatten)]
pub base: CliSignOnlyData,
pub bls_pubkey: String,
pub bls_proof_of_possession: String,
}

impl QuietDisplay for CliSignOnlyDataWithBLS {}
impl VerboseDisplay for CliSignOnlyDataWithBLS {}

impl fmt::Display for CliSignOnlyDataWithBLS {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(f)?;
write!(f, "{}", self.base)?;
writeln_name_value(f, "BLS Public Key:", &self.bls_pubkey)?;
writeln_name_value(f, "BLS Proof of Possession:", &self.bls_proof_of_possession)?;
Ok(())
}
}

#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliSignature {
Expand Down
8 changes: 4 additions & 4 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,15 @@ path = "src/main.rs"
[features]
default = ["remote-wallet-hidraw"]
agave-unstable-api = []
dev-context-only-utils = [
"solana-faucet/dev-context-only-utils",
"solana-client/dev-context-only-utils",
]
dev-context-only-utils = ["solana-faucet/dev-context-only-utils"]
remote-wallet-hidraw = ["solana-remote-wallet/linux-static-hidraw"]
remote-wallet-libusb = ["solana-remote-wallet/linux-static-libusb"]

[dependencies]
agave-feature-set = { workspace = true }
agave-logger = { workspace = true }
agave-syscalls = { workspace = true }
agave-votor-messages = { workspace = true }
bincode = { workspace = true }
bs58 = { workspace = true }
clap = { workspace = true }
Expand All @@ -50,6 +48,7 @@ serde_json = { workspace = true }
solana-account = "=3.2.0"
solana-account-decoder = { workspace = true }
solana-address-lookup-table-interface = { workspace = true }
solana-bls-signatures = { workspace = true }
solana-borsh = "=3.0.0"
solana-clap-utils = { workspace = true }
solana-cli-config = { workspace = true }
Expand Down Expand Up @@ -118,5 +117,6 @@ solana-rpc = { workspace = true }
solana-sha256-hasher = { workspace = true }
solana-test-validator = { workspace = true }
solana-tps-client = { workspace = true, features = ["dev-context-only-utils"] }
solana-vote-program = { workspace = true }
tempfile = { workspace = true }
test-case = { workspace = true }
80 changes: 79 additions & 1 deletion cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ use {
},
solana_transaction::versioned::VersionedTransaction,
solana_transaction_error::TransactionError,
solana_vote_program::vote_state::VoteAuthorize,
solana_vote_program::vote_state::{
VoteAuthorize, BLS_PROOF_OF_POSSESSION_COMPRESSED_SIZE, BLS_PUBLIC_KEY_COMPRESSED_SIZE,
},
std::{
collections::HashMap, error, io::stdout, rc::Rc, str::FromStr, sync::Arc, time::Duration,
},
Expand Down Expand Up @@ -406,6 +408,27 @@ pub enum CliCommand {
fee_payer: SignerIndex,
compute_unit_price: Option<u64>,
},
CreateVoteAccountV2 {
vote_account: SignerIndex,
seed: Option<String>,
identity_account: SignerIndex,
authorized_voter: Option<Pubkey>,
bls_pubkey: [u8; BLS_PUBLIC_KEY_COMPRESSED_SIZE],
bls_proof_of_possession: [u8; BLS_PROOF_OF_POSSESSION_COMPRESSED_SIZE],
authorized_withdrawer: Pubkey,
sign_only: bool,
dump_transaction_message: bool,
blockhash_query: BlockhashQuery,
nonce_account: Option<Pubkey>,
nonce_authority: SignerIndex,
memo: Option<String>,
fee_payer: SignerIndex,
compute_unit_price: Option<u64>,
inflation_rewards_commission_bps: Option<u16>,
block_revenue_commission_bps: Option<u16>,
inflation_rewards_collector: Option<Pubkey>,
block_revenue_collector: Option<Pubkey>,
},
// Wallet Commands
Address,
Airdrop {
Expand Down Expand Up @@ -757,6 +780,9 @@ pub fn parse_command(
("create-vote-account", Some(matches)) => {
parse_create_vote_account(matches, default_signer, wallet_manager)
}
("create-vote-account-with-bls", Some(matches)) => {
parse_create_vote_account_with_bls(matches, default_signer, wallet_manager)
}
("vote-update-validator", Some(matches)) => {
parse_vote_update_validator(matches, default_signer, wallet_manager)
}
Expand All @@ -770,6 +796,9 @@ pub fn parse_command(
VoteAuthorize::Voter,
!CHECKED,
),
("vote-authorize-voter-with-bls", Some(matches)) => {
parse_vote_authorize_with_bls(matches, default_signer, wallet_manager, !CHECKED)
}
("vote-authorize-withdrawer", Some(matches)) => parse_vote_authorize(
matches,
default_signer,
Expand All @@ -784,6 +813,9 @@ pub fn parse_command(
VoteAuthorize::Voter,
CHECKED,
),
("vote-authorize-voter-checked-with-bls", Some(matches)) => {
parse_vote_authorize_with_bls(matches, default_signer, wallet_manager, CHECKED)
}
("vote-authorize-withdrawer-checked", Some(matches)) => parse_vote_authorize(
matches,
default_signer,
Expand Down Expand Up @@ -1595,6 +1627,52 @@ pub async fn process_command(config: &CliConfig<'_>) -> ProcessResult {
)
.await
}
CliCommand::CreateVoteAccountV2 {
vote_account,
seed,
identity_account,
authorized_voter,
authorized_withdrawer,
bls_pubkey,
bls_proof_of_possession,
sign_only,
dump_transaction_message,
blockhash_query,
nonce_account,
nonce_authority,
memo,
fee_payer,
compute_unit_price,
inflation_rewards_commission_bps,
inflation_rewards_collector,
block_revenue_commission_bps,
block_revenue_collector,
} => {
process_create_vote_account_v2(
&rpc_client,
config,
*vote_account,
seed,
*identity_account,
authorized_voter,
*authorized_withdrawer,
*bls_pubkey,
*bls_proof_of_possession,
*sign_only,
*dump_transaction_message,
blockhash_query,
nonce_account.as_ref(),
*nonce_authority,
memo.as_ref(),
*fee_payer,
*compute_unit_price,
inflation_rewards_commission_bps,
inflation_rewards_collector,
block_revenue_commission_bps,
block_revenue_collector,
)
.await
}
CliCommand::ShowVoteAccount {
pubkey: vote_account_pubkey,
use_lamports_unit,
Expand Down
Loading
Loading