Fix Nightly Clippy Warnings (backport #18065) (#18070)

* chore: cargo +nightly clippy --fix -Z unstable-options

(cherry picked from commit 6514096a67)

# Conflicts:
#	core/src/banking_stage.rs
#	core/src/cost_model.rs
#	core/src/cost_tracker.rs
#	core/src/execute_cost_table.rs
#	core/src/replay_stage.rs
#	core/src/tvu.rs
#	ledger-tool/src/main.rs
#	programs/bpf_loader/build.rs
#	rbpf-cli/src/main.rs
#	sdk/cargo-build-bpf/src/main.rs
#	sdk/cargo-test-bpf/src/main.rs
#	sdk/src/secp256k1_instruction.rs

* chore: cargo fmt

(cherry picked from commit 789f33e8db)

* Updates BPF program assert_instruction_count tests.

(cherry picked from commit c1e03f3410)

# Conflicts:
#	programs/bpf/tests/programs.rs

* Resolve conflicts

Co-authored-by: Alexander Meißner <AlexanderMeissner@gmx.net>
Co-authored-by: Michael Vines <mvines@gmail.com>
This commit is contained in:
mergify[bot]
2021-06-18 20:02:48 +00:00
committed by GitHub
parent c330016109
commit 0e7512a225
173 changed files with 1250 additions and 1056 deletions

View File

@@ -1000,7 +1000,7 @@ fn process_airdrop(
let result = request_and_confirm_airdrop(rpc_client, config, &pubkey, lamports);
if let Ok(signature) = result {
let signature_cli_message = log_instruction_custom_error::<SystemError>(result, &config)?;
let signature_cli_message = log_instruction_custom_error::<SystemError>(result, config)?;
println!("{}", signature_cli_message);
let current_balance = rpc_client.get_balance(&pubkey)?;
@@ -1013,7 +1013,7 @@ fn process_airdrop(
Ok(build_balance_message(current_balance, false, true))
}
} else {
log_instruction_custom_error::<SystemError>(result, &config)
log_instruction_custom_error::<SystemError>(result, config)
}
}
@@ -1098,7 +1098,7 @@ fn process_confirm(
#[allow(clippy::unnecessary_wraps)]
fn process_decode_transaction(config: &CliConfig, transaction: &Transaction) -> ProcessResult {
let sigverify_status = CliSignatureVerificationStatus::verify_transaction(&transaction);
let sigverify_status = CliSignatureVerificationStatus::verify_transaction(transaction);
let decode_transaction = CliTransaction {
decoded_transaction: transaction.clone(),
transaction: EncodedTransaction::encode(transaction.clone(), UiTransactionEncoding::Json),
@@ -1269,7 +1269,7 @@ fn process_transfer(
} else {
rpc_client.send_and_confirm_transaction_with_spinner(&tx)
};
log_instruction_custom_error::<SystemError>(result, &config)
log_instruction_custom_error::<SystemError>(result, config)
}
}
@@ -1324,7 +1324,7 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
from_pubkey,
seed,
program_id,
} => process_create_address_with_seed(config, from_pubkey.as_ref(), &seed, &program_id),
} => process_create_address_with_seed(config, from_pubkey.as_ref(), seed, program_id),
CliCommand::Fees { ref blockhash } => process_fees(&rpc_client, config, blockhash.as_ref()),
CliCommand::Feature(feature_subcommand) => {
process_feature_subcommand(&rpc_client, config, feature_subcommand)
@@ -1347,8 +1347,8 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
CliCommand::LeaderSchedule { epoch } => {
process_leader_schedule(&rpc_client, config, *epoch)
}
CliCommand::LiveSlots => process_live_slots(&config),
CliCommand::Logs { filter } => process_logs(&config, filter),
CliCommand::LiveSlots => process_live_slots(config),
CliCommand::Logs { filter } => process_logs(config, filter),
CliCommand::Ping {
lamports,
interval,
@@ -1453,7 +1453,7 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
),
// Get the current nonce
CliCommand::GetNonce(nonce_account_pubkey) => {
process_get_nonce(&rpc_client, config, &nonce_account_pubkey)
process_get_nonce(&rpc_client, config, nonce_account_pubkey)
}
// Get a new nonce
CliCommand::NewNonce {
@@ -1474,7 +1474,7 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
} => process_show_nonce_account(
&rpc_client,
config,
&nonce_account_pubkey,
nonce_account_pubkey,
*use_lamports_unit,
),
// Withdraw lamports from a nonce account
@@ -1487,10 +1487,10 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
} => process_withdraw_from_nonce_account(
&rpc_client,
config,
&nonce_account,
nonce_account,
*nonce_authority,
memo.as_ref(),
&destination_account_pubkey,
destination_account_pubkey,
*lamports,
),
@@ -1564,7 +1564,7 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
} => process_deactivate_stake_account(
&rpc_client,
config,
&stake_account_pubkey,
stake_account_pubkey,
*stake_authority,
*sign_only,
*dump_transaction_message,
@@ -1590,8 +1590,8 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
} => process_delegate_stake(
&rpc_client,
config,
&stake_account_pubkey,
&vote_account_pubkey,
stake_account_pubkey,
vote_account_pubkey,
*stake_authority,
*force,
*sign_only,
@@ -1618,7 +1618,7 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
} => process_split_stake(
&rpc_client,
config,
&stake_account_pubkey,
stake_account_pubkey,
*stake_authority,
*sign_only,
*dump_transaction_message,
@@ -1645,8 +1645,8 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
} => process_merge_stake(
&rpc_client,
config,
&stake_account_pubkey,
&source_stake_account_pubkey,
stake_account_pubkey,
source_stake_account_pubkey,
*stake_authority,
*sign_only,
*dump_transaction_message,
@@ -1663,7 +1663,7 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
} => process_show_stake_account(
&rpc_client,
config,
&stake_account_pubkey,
stake_account_pubkey,
*use_lamports_unit,
*with_rewards,
),
@@ -1686,7 +1686,7 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
} => process_stake_authorize(
&rpc_client,
config,
&stake_account_pubkey,
stake_account_pubkey,
new_authorizations,
*custodian,
*sign_only,
@@ -1712,7 +1712,7 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
} => process_stake_set_lockup(
&rpc_client,
config,
&stake_account_pubkey,
stake_account_pubkey,
&mut lockup,
*custodian,
*sign_only,
@@ -1740,8 +1740,8 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
} => process_withdraw_stake(
&rpc_client,
config,
&stake_account_pubkey,
&destination_account_pubkey,
stake_account_pubkey,
destination_account_pubkey,
*amount,
*withdraw_authority,
*custodian,
@@ -1769,7 +1769,7 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
} => process_set_validator_info(
&rpc_client,
config,
&validator_info,
validator_info,
*force_keybase,
*info_pubkey,
),
@@ -1803,7 +1803,7 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
} => process_show_vote_account(
&rpc_client,
config,
&vote_account_pubkey,
vote_account_pubkey,
*use_lamports_unit,
*with_rewards,
),
@@ -1830,8 +1830,8 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
} => process_vote_authorize(
&rpc_client,
config,
&vote_account_pubkey,
&new_authorized_pubkey,
vote_account_pubkey,
new_authorized_pubkey,
*vote_authorize,
memo.as_ref(),
),
@@ -1843,7 +1843,7 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
} => process_vote_update_validator(
&rpc_client,
config,
&vote_account_pubkey,
vote_account_pubkey,
*new_identity_account,
*withdraw_authority,
memo.as_ref(),
@@ -1856,7 +1856,7 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
} => process_vote_update_commission(
&rpc_client,
config,
&vote_account_pubkey,
vote_account_pubkey,
*commission,
*withdraw_authority,
memo.as_ref(),
@@ -1872,7 +1872,7 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
CliCommand::Balance {
pubkey,
use_lamports_unit,
} => process_balance(&rpc_client, config, &pubkey, *use_lamports_unit),
} => process_balance(&rpc_client, config, pubkey, *use_lamports_unit),
// Confirm the last client transaction by signature
CliCommand::Confirm(signature) => process_confirm(&rpc_client, config, signature),
CliCommand::DecodeTransaction(transaction) => {
@@ -1889,13 +1889,7 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
pubkey,
output_file,
use_lamports_unit,
} => process_show_account(
&rpc_client,
config,
&pubkey,
&output_file,
*use_lamports_unit,
),
} => process_show_account(&rpc_client, config, pubkey, output_file, *use_lamports_unit),
CliCommand::Transfer {
amount,
to,

View File

@@ -122,7 +122,7 @@ impl ClusterQuerySubCommands for App<'_, '_> {
.long("our-localhost")
.takes_value(false)
.value_name("PORT")
.default_value(&DEFAULT_RPC_PORT_STR)
.default_value(DEFAULT_RPC_PORT_STR)
.validator(is_port)
.help("Guess Identity pubkey and validator rpc node assuming local (possibly private) validator"),
)

View File

@@ -102,7 +102,7 @@ fn process_rewards(
rewards_epoch: Option<Epoch>,
) -> ProcessResult {
let rewards = rpc_client
.get_inflation_reward(&addresses, rewards_epoch)
.get_inflation_reward(addresses, rewards_epoch)
.map_err(|err| {
if let Some(epoch) = rewards_epoch {
format!("Rewards not available for epoch {}", epoch)

View File

@@ -184,7 +184,7 @@ pub fn parse_args<'a>(
let CliCommandInfo {
command,
mut signers,
} = parse_command(&matches, &default_signer, &mut wallet_manager)?;
} = parse_command(matches, &default_signer, &mut wallet_manager)?;
if signers.is_empty() {
if let Ok(signer_info) =
@@ -257,7 +257,7 @@ fn main() -> Result<(), Box<dyn error::Error>> {
.global(true)
.help("Configuration file to use");
if let Some(ref config_file) = *CONFIG_FILE {
arg.default_value(&config_file)
arg.default_value(config_file)
} else {
arg
}
@@ -411,10 +411,10 @@ fn main() -> Result<(), Box<dyn error::Error>> {
}
fn do_main(matches: &ArgMatches<'_>) -> Result<(), Box<dyn error::Error>> {
if parse_settings(&matches)? {
if parse_settings(matches)? {
let mut wallet_manager = None;
let (mut config, signers) = parse_args(&matches, &mut wallet_manager)?;
let (mut config, signers) = parse_args(matches, &mut wallet_manager)?;
config.signers = signers.iter().map(|s| s.as_ref()).collect();
let result = process_command(&config)?;
println!("{}", result);

View File

@@ -364,7 +364,7 @@ pub fn process_authorize_nonce_account(
config.commitment,
)?;
let result = rpc_client.send_and_confirm_transaction_with_spinner(&tx);
log_instruction_custom_error::<NonceError>(result, &config)
log_instruction_custom_error::<NonceError>(result, config)
}
pub fn process_create_nonce_account(
@@ -449,7 +449,7 @@ pub fn process_create_nonce_account(
let mut tx = Transaction::new_unsigned(message);
tx.try_sign(&config.signers, recent_blockhash)?;
let result = rpc_client.send_and_confirm_transaction_with_spinner(&tx);
log_instruction_custom_error::<SystemError>(result, &config)
log_instruction_custom_error::<SystemError>(result, config)
}
pub fn process_get_nonce(
@@ -474,10 +474,10 @@ pub fn process_new_nonce(
) -> ProcessResult {
check_unique_pubkeys(
(&config.signers[0].pubkey(), "cli keypair".to_string()),
(&nonce_account, "nonce_account_pubkey".to_string()),
(nonce_account, "nonce_account_pubkey".to_string()),
)?;
if let Err(err) = rpc_client.get_account(&nonce_account) {
if let Err(err) = rpc_client.get_account(nonce_account) {
return Err(CliError::BadParameter(format!(
"Unable to advance nonce account {}. error: {}",
nonce_account, err
@@ -487,7 +487,7 @@ pub fn process_new_nonce(
let nonce_authority = config.signers[nonce_authority];
let ixs = vec![advance_nonce_account(
&nonce_account,
nonce_account,
&nonce_authority.pubkey(),
)]
.with_memo(memo);
@@ -503,7 +503,7 @@ pub fn process_new_nonce(
config.commitment,
)?;
let result = rpc_client.send_and_confirm_transaction_with_spinner(&tx);
log_instruction_custom_error::<SystemError>(result, &config)
log_instruction_custom_error::<SystemError>(result, config)
}
pub fn process_show_nonce_account(
@@ -522,7 +522,7 @@ pub fn process_show_nonce_account(
use_lamports_unit,
..CliNonceAccount::default()
};
if let Some(ref data) = data {
if let Some(data) = data {
nonce_account.nonce = Some(data.blockhash.to_string());
nonce_account.lamports_per_signature = Some(data.fee_calculator.lamports_per_signature);
nonce_account.authority = Some(data.authority.to_string());
@@ -566,7 +566,7 @@ pub fn process_withdraw_from_nonce_account(
config.commitment,
)?;
let result = rpc_client.send_and_confirm_transaction_with_spinner(&tx);
log_instruction_custom_error::<NonceError>(result, &config)
log_instruction_custom_error::<NonceError>(result, config)
}
#[cfg(test)]

View File

@@ -767,7 +767,7 @@ fn process_program_deploy(
};
let upgrade_authority_signer = config.signers[upgrade_authority_signer_index];
let default_program_keypair = get_default_program_keypair(&program_location);
let default_program_keypair = get_default_program_keypair(program_location);
let (program_signer, program_pubkey) = if let Some(i) = program_signer_index {
(Some(config.signers[i]), config.signers[i].pubkey())
} else if let Some(program_pubkey) = program_pubkey {
@@ -843,7 +843,7 @@ fn process_program_deploy(
};
let (program_data, program_len) = if let Some(program_location) = program_location {
let program_data = read_and_verify_elf(&program_location)?;
let program_data = read_and_verify_elf(program_location)?;
let program_len = program_data.len();
(program_data, program_len)
} else if buffer_provided {
@@ -1259,7 +1259,7 @@ fn process_dump(
UpgradeableLoaderState::programdata_data_offset().unwrap_or(0);
let program_data = &programdata_account.data[offset..];
let mut f = File::create(output_location)?;
f.write_all(&program_data)?;
f.write_all(program_data)?;
Ok(format!("Wrote program to {}", output_location))
} else {
Err(
@@ -1279,7 +1279,7 @@ fn process_dump(
let offset = UpgradeableLoaderState::buffer_data_offset().unwrap_or(0);
let program_data = &account.data[offset..];
let mut f = File::create(output_location)?;
f.write_all(&program_data)?;
f.write_all(program_data)?;
Ok(format!("Wrote program to {}", output_location))
} else {
Err(format!(
@@ -1310,8 +1310,8 @@ fn close(
let mut tx = Transaction::new_unsigned(Message::new(
&[bpf_loader_upgradeable::close(
&account_pubkey,
&recipient_pubkey,
account_pubkey,
recipient_pubkey,
&authority_signer.pubkey(),
)],
Some(&config.signers[0].pubkey()),
@@ -1420,7 +1420,7 @@ fn process_close(
if close(
rpc_client,
config,
&address,
address,
&recipient_pubkey,
authority_signer,
)
@@ -1521,7 +1521,7 @@ fn do_process_program_write_and_deploy(
.value
{
complete_partial_program_init(
&loader_id,
loader_id,
&config.signers[0].pubkey(),
buffer_pubkey,
&account,
@@ -1551,7 +1551,7 @@ fn do_process_program_write_and_deploy(
buffer_pubkey,
minimum_balance,
buffer_data_len as u64,
&loader_id,
loader_id,
)],
minimum_balance,
)
@@ -1579,7 +1579,7 @@ fn do_process_program_write_and_deploy(
} else {
loader_instruction::write(
buffer_pubkey,
&loader_id,
loader_id,
(i * DATA_CHUNK_SIZE) as u32,
chunk.to_vec(),
)
@@ -1623,7 +1623,7 @@ fn do_process_program_write_and_deploy(
)
} else {
Message::new(
&[loader_instruction::finalize(buffer_pubkey, &loader_id)],
&[loader_instruction::finalize(buffer_pubkey, loader_id)],
Some(&config.signers[0].pubkey()),
)
};
@@ -1749,8 +1749,8 @@ fn do_process_program_upgrade(
// Create and add final message
let final_message = Message::new(
&[bpf_loader_upgradeable::upgrade(
&program_id,
&buffer_pubkey,
program_id,
buffer_pubkey,
&upgrade_authority.pubkey(),
&config.signers[0].pubkey(),
)],
@@ -1818,7 +1818,7 @@ fn complete_partial_program_init(
account_data_len as u64,
));
if account.owner != *loader_id {
instructions.push(system_instruction::assign(elf_pubkey, &loader_id));
instructions.push(system_instruction::assign(elf_pubkey, loader_id));
}
}
if account.lamports < minimum_balance {
@@ -1890,7 +1890,7 @@ fn send_deploy_messages(
initial_transaction.try_sign(&[payer_signer], blockhash)?;
}
let result = rpc_client.send_and_confirm_transaction_with_spinner(&initial_transaction);
log_instruction_custom_error::<SystemError>(result, &config)
log_instruction_custom_error::<SystemError>(result, config)
.map_err(|err| format!("Account allocation failed: {}", err))?;
} else {
return Err("Buffer account not created yet, must provide a key pair".into());

View File

@@ -92,7 +92,7 @@ where
Ok((message, spend))
} else {
let from_balance = rpc_client
.get_balance_with_commitment(&from_pubkey, commitment)?
.get_balance_with_commitment(from_pubkey, commitment)?
.value;
let (message, SpendAndFee { spend, fee }) = resolve_spend_message(
amount,

View File

@@ -972,7 +972,7 @@ pub fn process_create_stake_account(
) -> ProcessResult {
let stake_account = config.signers[stake_account];
let stake_account_address = if let Some(seed) = seed {
Pubkey::create_with_seed(&stake_account.pubkey(), &seed, &stake::program::id())?
Pubkey::create_with_seed(&stake_account.pubkey(), seed, &stake::program::id())?
} else {
stake_account.pubkey()
};
@@ -1085,7 +1085,7 @@ pub fn process_create_stake_account(
} else {
tx.try_sign(&config.signers, recent_blockhash)?;
let result = rpc_client.send_and_confirm_transaction_with_spinner(&tx);
log_instruction_custom_error::<SystemError>(result, &config)
log_instruction_custom_error::<SystemError>(result, config)
}
}
@@ -1172,7 +1172,7 @@ pub fn process_stake_authorize(
} else {
rpc_client.send_and_confirm_transaction_with_spinner(&tx)
};
log_instruction_custom_error::<StakeError>(result, &config)
log_instruction_custom_error::<StakeError>(result, config)
}
}
@@ -1196,7 +1196,7 @@ pub fn process_deactivate_stake_account(
let stake_authority = config.signers[stake_authority];
let stake_account_address = if let Some(seed) = seed {
Pubkey::create_with_seed(&stake_account_pubkey, seed, &stake::program::id())?
Pubkey::create_with_seed(stake_account_pubkey, seed, &stake::program::id())?
} else {
*stake_account_pubkey
};
@@ -1248,7 +1248,7 @@ pub fn process_deactivate_stake_account(
config.commitment,
)?;
let result = rpc_client.send_and_confirm_transaction_with_spinner(&tx);
log_instruction_custom_error::<StakeError>(result, &config)
log_instruction_custom_error::<StakeError>(result, config)
}
}
@@ -1274,7 +1274,7 @@ pub fn process_withdraw_stake(
let custodian = custodian.map(|index| config.signers[index]);
let stake_account_address = if let Some(seed) = seed {
Pubkey::create_with_seed(&stake_account_pubkey, seed, &stake::program::id())?
Pubkey::create_with_seed(stake_account_pubkey, seed, &stake::program::id())?
} else {
*stake_account_pubkey
};
@@ -1347,7 +1347,7 @@ pub fn process_withdraw_stake(
config.commitment,
)?;
let result = rpc_client.send_and_confirm_transaction_with_spinner(&tx);
log_instruction_custom_error::<SystemError>(result, &config)
log_instruction_custom_error::<SystemError>(result, config)
}
}
@@ -1382,10 +1382,10 @@ pub fn process_split_stake(
}
check_unique_pubkeys(
(&fee_payer.pubkey(), "fee-payer keypair".to_string()),
(&stake_account_pubkey, "stake_account".to_string()),
(stake_account_pubkey, "stake_account".to_string()),
)?;
check_unique_pubkeys(
(&stake_account_pubkey, "stake_account".to_string()),
(stake_account_pubkey, "stake_account".to_string()),
(
&split_stake_account.pubkey(),
"split_stake_account".to_string(),
@@ -1395,7 +1395,7 @@ pub fn process_split_stake(
let stake_authority = config.signers[stake_authority];
let split_stake_account_address = if let Some(seed) = split_stake_account_seed {
Pubkey::create_with_seed(&split_stake_account.pubkey(), &seed, &stake::program::id())?
Pubkey::create_with_seed(&split_stake_account.pubkey(), seed, &stake::program::id())?
} else {
split_stake_account.pubkey()
};
@@ -1433,7 +1433,7 @@ pub fn process_split_stake(
let ixs = if let Some(seed) = split_stake_account_seed {
stake_instruction::split_with_seed(
&stake_account_pubkey,
stake_account_pubkey,
&stake_authority.pubkey(),
lamports,
&split_stake_account_address,
@@ -1443,7 +1443,7 @@ pub fn process_split_stake(
.with_memo(memo)
} else {
stake_instruction::split(
&stake_account_pubkey,
stake_account_pubkey,
&stake_authority.pubkey(),
lamports,
&split_stake_account_address,
@@ -1492,7 +1492,7 @@ pub fn process_split_stake(
config.commitment,
)?;
let result = rpc_client.send_and_confirm_transaction_with_spinner(&tx);
log_instruction_custom_error::<StakeError>(result, &config)
log_instruction_custom_error::<StakeError>(result, config)
}
}
@@ -1515,19 +1515,19 @@ pub fn process_merge_stake(
check_unique_pubkeys(
(&fee_payer.pubkey(), "fee-payer keypair".to_string()),
(&stake_account_pubkey, "stake_account".to_string()),
(stake_account_pubkey, "stake_account".to_string()),
)?;
check_unique_pubkeys(
(&fee_payer.pubkey(), "fee-payer keypair".to_string()),
(
&source_stake_account_pubkey,
source_stake_account_pubkey,
"source_stake_account".to_string(),
),
)?;
check_unique_pubkeys(
(&stake_account_pubkey, "stake_account".to_string()),
(stake_account_pubkey, "stake_account".to_string()),
(
&source_stake_account_pubkey,
source_stake_account_pubkey,
"source_stake_account".to_string(),
),
)?;
@@ -1552,8 +1552,8 @@ pub fn process_merge_stake(
blockhash_query.get_blockhash_and_fee_calculator(rpc_client, config.commitment)?;
let ixs = stake_instruction::merge(
&stake_account_pubkey,
&source_stake_account_pubkey,
stake_account_pubkey,
source_stake_account_pubkey,
&stake_authority.pubkey(),
)
.with_memo(memo);
@@ -1603,7 +1603,7 @@ pub fn process_merge_stake(
config.commitment,
config.send_transaction_config,
);
log_instruction_custom_error::<StakeError>(result, &config)
log_instruction_custom_error::<StakeError>(result, config)
}
}
@@ -1674,7 +1674,7 @@ pub fn process_stake_set_lockup(
config.commitment,
)?;
let result = rpc_client.send_and_confirm_transaction_with_spinner(&tx);
log_instruction_custom_error::<StakeError>(result, &config)
log_instruction_custom_error::<StakeError>(result, config)
}
}
@@ -2076,7 +2076,7 @@ pub fn process_delegate_stake(
config.commitment,
)?;
let result = rpc_client.send_and_confirm_transaction_with_spinner(&tx);
log_instruction_custom_error::<StakeError>(result, &config)
log_instruction_custom_error::<StakeError>(result, config)
}
}

View File

@@ -119,7 +119,7 @@ fn parse_validator_info(
let key_list: ConfigKeys = deserialize(&account.data)?;
if !key_list.keys.is_empty() {
let (validator_pubkey, _) = key_list.keys[1];
let validator_info_string: String = deserialize(&get_config_data(&account.data)?)?;
let validator_info_string: String = deserialize(get_config_data(&account.data)?)?;
let validator_info: Map<_, _> = serde_json::from_str(&validator_info_string)?;
Ok((validator_pubkey, validator_info))
} else {
@@ -246,7 +246,7 @@ pub fn process_set_validator_info(
) -> ProcessResult {
// Validate keybase username
if let Some(string) = validator_info.get("keybaseUsername") {
let result = verify_keybase(&config.signers[0].pubkey(), &string);
let result = verify_keybase(&config.signers[0].pubkey(), string);
if result.is_err() {
if force_keybase {
println!("--force supplied, ignoring: {:?}", result);
@@ -272,7 +272,7 @@ pub fn process_set_validator_info(
},
)
.find(|(pubkey, account)| {
let (validator_pubkey, _) = parse_validator_info(&pubkey, &account).unwrap();
let (validator_pubkey, _) = parse_validator_info(pubkey, account).unwrap();
validator_pubkey == config.signers[0].pubkey()
});
@@ -393,7 +393,7 @@ pub fn process_get_validator_info(
}
for (validator_info_pubkey, validator_info_account) in validator_info.iter() {
let (validator_pubkey, validator_info) =
parse_validator_info(&validator_info_pubkey, &validator_info_account)?;
parse_validator_info(validator_info_pubkey, validator_info_account)?;
validator_info_list.push(CliValidatorInfo {
identity_pubkey: validator_pubkey.to_string(),
info_pubkey: validator_info_pubkey.to_string(),
@@ -451,7 +451,7 @@ mod tests {
"name": "Alice",
"keybaseUsername": "alice_keybase",
});
assert_eq!(parse_args(&matches), expected);
assert_eq!(parse_args(matches), expected);
}
#[test]

View File

@@ -468,7 +468,7 @@ pub fn process_create_vote_account(
let vote_account = config.signers[vote_account];
let vote_account_pubkey = vote_account.pubkey();
let vote_account_address = if let Some(seed) = seed {
Pubkey::create_with_seed(&vote_account_pubkey, &seed, &solana_vote_program::id())?
Pubkey::create_with_seed(&vote_account_pubkey, seed, &solana_vote_program::id())?
} else {
vote_account_pubkey
};
@@ -549,7 +549,7 @@ pub fn process_create_vote_account(
let mut tx = Transaction::new_unsigned(message);
tx.try_sign(&config.signers, recent_blockhash)?;
let result = rpc_client.send_and_confirm_transaction_with_spinner(&tx);
log_instruction_custom_error::<SystemError>(result, &config)
log_instruction_custom_error::<SystemError>(result, config)
}
pub fn process_vote_authorize(
@@ -592,7 +592,7 @@ pub fn process_vote_authorize(
config.commitment,
)?;
let result = rpc_client.send_and_confirm_transaction_with_spinner(&tx);
log_instruction_custom_error::<VoteError>(result, &config)
log_instruction_custom_error::<VoteError>(result, config)
}
pub fn process_vote_update_validator(
@@ -629,7 +629,7 @@ pub fn process_vote_update_validator(
config.commitment,
)?;
let result = rpc_client.send_and_confirm_transaction_with_spinner(&tx);
log_instruction_custom_error::<VoteError>(result, &config)
log_instruction_custom_error::<VoteError>(result, config)
}
pub fn process_vote_update_commission(
@@ -660,7 +660,7 @@ pub fn process_vote_update_commission(
config.commitment,
)?;
let result = rpc_client.send_and_confirm_transaction_with_spinner(&tx);
log_instruction_custom_error::<VoteError>(result, &config)
log_instruction_custom_error::<VoteError>(result, config)
}
fn get_vote_account(
@@ -763,7 +763,7 @@ pub fn process_withdraw_from_vote_account(
let (recent_blockhash, fee_calculator) = rpc_client.get_recent_blockhash()?;
let withdraw_authority = config.signers[withdraw_authority];
let current_balance = rpc_client.get_balance(&vote_account_pubkey)?;
let current_balance = rpc_client.get_balance(vote_account_pubkey)?;
let minimum_balance = rpc_client.get_minimum_balance_for_rent_exemption(VoteState::size_of())?;
let lamports = match withdraw_amount {
@@ -798,7 +798,7 @@ pub fn process_withdraw_from_vote_account(
config.commitment,
)?;
let result = rpc_client.send_and_confirm_transaction_with_spinner(&transaction);
log_instruction_custom_error::<VoteError>(result, &config)
log_instruction_custom_error::<VoteError>(result, config)
}
#[cfg(test)]