get rid of process_deploy call in transaction-dos (#28448)

This commit is contained in:
kirill lykov 2022-10-19 11:02:51 +02:00 committed by GitHub
parent 58e27d45dc
commit c201fe2bec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 13 deletions

View File

@ -1,11 +1,15 @@
#![allow(clippy::integer_arithmetic)] #![allow(clippy::integer_arithmetic)]
use { use {
clap::{crate_description, crate_name, value_t, values_t_or_exit, App, Arg}, clap::{crate_description, crate_name, value_t, values_t_or_exit, App, Arg},
log::*, log::*,
rand::{thread_rng, Rng}, rand::{thread_rng, Rng},
rayon::prelude::*, rayon::prelude::*,
solana_clap_utils::input_parsers::pubkey_of, solana_clap_utils::input_parsers::pubkey_of,
solana_cli::{cli::CliConfig, program::process_deploy}, solana_cli::{
cli::{process_command, CliCommand, CliConfig},
program::ProgramCliCommand,
},
solana_client::transaction_executor::TransactionExecutor, solana_client::transaction_executor::TransactionExecutor,
solana_faucet::faucet::{request_airdrop_transaction, FAUCET_PORT}, solana_faucet::faucet::{request_airdrop_transaction, FAUCET_PORT},
solana_gossip::gossip_service::discover, solana_gossip::gossip_service::discover,
@ -228,24 +232,27 @@ fn run_transactions_dos(
if program_account.is_err() { if program_account.is_err() {
let mut config = CliConfig::default(); let mut config = CliConfig::default();
let (program_keypair, program_location) = program_options let (program_keypair, program_location) = program_options
.as_ref()
.expect("If the program doesn't exist, need to provide program keypair to deploy"); .expect("If the program doesn't exist, need to provide program keypair to deploy");
info!( info!(
"processing deploy: {:?} key: {}", "processing deploy: {:?} key: {}",
program_account, program_account,
program_keypair.pubkey() program_keypair.pubkey()
); );
config.signers = vec![payer_keypairs[0], program_keypair]; config.signers = vec![payer_keypairs[0], &program_keypair];
process_deploy( config.command = CliCommand::Program(ProgramCliCommand::Deploy {
client.clone(), program_location: Some(program_location),
&config, program_signer_index: Some(1),
program_location, program_pubkey: None,
Some(1), buffer_signer_index: None,
false, buffer_pubkey: None,
true, allow_excessive_balance: true,
true, /* skip_fee_check */ upgrade_authority_signer_index: 0,
) is_final: true,
.expect("deploy didn't pass"); max_len: None,
skip_fee_check: true, // skip_fee_check
});
process_command(&config).expect("deploy didn't pass");
} else { } else {
info!("Found program account. Skipping deploy.."); info!("Found program account. Skipping deploy..");
assert!(program_account.unwrap().executable); assert!(program_account.unwrap().executable);