Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.
Closed
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
8 changes: 2 additions & 6 deletions cli/src/cluster_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,7 @@ use {
slot_history,
stake::{self, state::StakeState},
system_instruction,
sysvar::{
self,
slot_history::SlotHistory,
stake_history::{self},
},
sysvar::{self, slot_history::SlotHistory, stake_history},
transaction::Transaction,
},
solana_transaction_status::{
Expand Down Expand Up @@ -1109,7 +1105,7 @@ pub fn process_get_epoch_info(rpc_client: &RpcClient, config: &CliConfig) -> Pro
match config.output_format {
OutputFormat::Json | OutputFormat::JsonCompact => {}
_ => {
let epoch_info = cli_epoch_info.epoch_info.clone();
let epoch_info = &cli_epoch_info.epoch_info;
let average_slot_time_ms = rpc_client
.get_recent_performance_samples(Some(60))
.ok()
Expand Down
4 changes: 2 additions & 2 deletions cli/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ pub fn process_show_account(
use_lamports_unit: bool,
) -> ProcessResult {
let account = rpc_client.get_account(account_pubkey)?;
let data = account.data.clone();
let data = &account.data;
let cli_account = CliAccount::new(account_pubkey, &account, use_lamports_unit);

let mut account_string = config.output_format.formatted_string(&cli_account);
Expand All @@ -585,7 +585,7 @@ pub fn process_show_account(
OutputFormat::Display | OutputFormat::DisplayVerbose => {
if let Some(output_file) = output_file {
let mut f = File::create(output_file)?;
f.write_all(&data)?;
f.write_all(data)?;
writeln!(&mut account_string)?;
writeln!(&mut account_string, "Wrote account data to {output_file}")?;
} else if !data.is_empty() {
Expand Down
2 changes: 1 addition & 1 deletion core/src/broadcast_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ pub mod test {
let ticks_per_slot;
let slot;
{
let bank = broadcast_service.bank.clone();
let bank = broadcast_service.bank;
start_tick_height = bank.tick_height();
max_tick_height = bank.max_tick_height();
ticks_per_slot = bank.ticks_per_slot();
Expand Down
2 changes: 1 addition & 1 deletion core/src/broadcast_stage/broadcast_fake_shreds_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl BroadcastRun for BroadcastFakeShredsRun {
) -> Result<()> {
// 1) Pull entries from banking stage
let receive_results = broadcast_utils::recv_slot_entries(receiver)?;
let bank = receive_results.bank.clone();
let bank = receive_results.bank;
let last_tick_height = receive_results.last_tick_height;

let next_shred_index = blockstore
Expand Down
35 changes: 16 additions & 19 deletions core/src/tower_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,25 +241,22 @@ impl EtcdTowerStorage {
.unwrap();

let client = runtime
.block_on(async {
etcd_client::Client::connect(
endpoints,
tls_config.map(|tls_config| {
etcd_client::ConnectOptions::default().with_tls(
etcd_client::TlsOptions::new()
.domain_name(tls_config.domain_name)
.ca_certificate(etcd_client::Certificate::from_pem(
tls_config.ca_certificate,
))
.identity(etcd_client::Identity::from_pem(
tls_config.identity_certificate,
tls_config.identity_private_key,
)),
)
}),
)
.await
})
.block_on(etcd_client::Client::connect(
endpoints,
tls_config.map(|tls_config| {
etcd_client::ConnectOptions::default().with_tls(
etcd_client::TlsOptions::new()
.domain_name(tls_config.domain_name)
.ca_certificate(etcd_client::Certificate::from_pem(
tls_config.ca_certificate,
))
.identity(etcd_client::Identity::from_pem(
tls_config.identity_certificate,
tls_config.identity_private_key,
)),
)
}),
))
.map_err(Self::etdc_to_tower_error)?;

Ok(Self {
Expand Down
2 changes: 1 addition & 1 deletion ledger-tool/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ fn hardforks_of(matches: &ArgMatches<'_>, name: &str) -> Option<Vec<Slot>> {
fn get_accounts_db_config(ledger_path: &Path, arg_matches: &ArgMatches<'_>) -> AccountsDbConfig {
let accounts_index_bins = value_t!(arg_matches, "accounts_index_bins", usize).ok();
let accounts_index_index_limit_mb =
if let Some(limit) = value_t!(arg_matches, "accounts_index_memory_limit_mb", usize).ok() {
if let Ok(limit) = value_t!(arg_matches, "accounts_index_memory_limit_mb", usize) {
IndexLimitMb::Limit(limit)
} else if arg_matches.is_present("disable_accounts_disk_index") {
IndexLimitMb::InMemOnly
Expand Down
4 changes: 4 additions & 0 deletions ledger/src/bigtable_upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ pub async fn upload_confirmed_blocks(
}
Some(confirmed_block) => {
let bt = bigtable.clone();
// clippy 0.1.70 (4a04d08 2023-03-18) incorrectly suggests removal of this `async
// move` block. But it captures `bt`, so it is necessary.
// TODO Enable after upgrade to Rust 1.69.
// #[allow(clippy::redundant_async_block)]
Some(tokio::spawn(async move {
bt.upload_confirmed_block(slot, confirmed_block).await
}))
Expand Down
39 changes: 16 additions & 23 deletions program-test/tests/fuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,17 @@ fn simulate_fuzz() {
processor!(process_instruction),
);

let (mut banks_client, payer, last_blockhash) =
rt.block_on(async { program_test.start().await });
let (mut banks_client, payer, last_blockhash) = rt.block_on(program_test.start());

// the honggfuzz `fuzz!` macro does not allow for async closures,
// so we have to use the runtime directly to run async functions
rt.block_on(async {
run_fuzz_instructions(
&[1, 2, 3, 4, 5],
&mut banks_client,
&payer,
last_blockhash,
&program_id,
)
.await
});
rt.block_on(run_fuzz_instructions(
&[1, 2, 3, 4, 5],
&mut banks_client,
&payer,
last_blockhash,
&program_id,
));
}

#[test]
Expand All @@ -64,20 +60,17 @@ fn simulate_fuzz_with_context() {
processor!(process_instruction),
);

let mut context = rt.block_on(async { program_test.start_with_context().await });
let mut context = rt.block_on(program_test.start_with_context());

// the honggfuzz `fuzz!` macro does not allow for async closures,
// so we have to use the runtime directly to run async functions
rt.block_on(async {
run_fuzz_instructions(
&[1, 2, 3, 4, 5],
&mut context.banks_client,
&context.payer,
context.last_blockhash,
&program_id,
)
.await
});
rt.block_on(run_fuzz_instructions(
&[1, 2, 3, 4, 5],
&mut context.banks_client,
&context.payer,
context.last_blockhash,
&program_id,
));
}

async fn run_fuzz_instructions(
Expand Down
4 changes: 2 additions & 2 deletions quic-client/src/quic_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,14 @@ impl ClientConnection for QuicClientConnection {
let _lock = ASYNC_TASK_SEMAPHORE.acquire();
let inner = self.inner.clone();

let _handle = RUNTIME.spawn(async move { send_data_async(inner, data).await });
let _handle = RUNTIME.spawn(send_data_async(inner, data));
Ok(())
}

fn send_data_batch_async(&self, buffers: Vec<Vec<u8>>) -> TransportResult<()> {
let _lock = ASYNC_TASK_SEMAPHORE.acquire();
let inner = self.inner.clone();
let _handle = RUNTIME.spawn(async move { send_data_batch_async(inner, buffers).await });
let _handle = RUNTIME.spawn(send_data_batch_async(inner, buffers));
Ok(())
}

Expand Down
Loading