Skip to content
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
6 changes: 3 additions & 3 deletions accounts-bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ fn main() {
);
time_store.stop();
if results != results_store {
error!("results different: \n{:?}\n{:?}", results, results_store);
error!("results different: \n{results:?}\n{results_store:?}");
}
println!(
"hash,{},{},{},{}%",
Expand All @@ -150,9 +150,9 @@ fn main() {
}

for x in elapsed {
info!("update_accounts_hash(us),{}", x);
info!("update_accounts_hash(us),{x}");
}
for x in elapsed_store {
info!("calculate_accounts_hash_from_storages(us),{}", x);
info!("calculate_accounts_hash_from_storages(us),{x}");
}
}
74 changes: 30 additions & 44 deletions accounts-cluster-bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ pub fn poll_slot_height(client: &RpcClient) -> Slot {
return slot;
} else {
num_retries -= 1;
warn!(
"get_slot_height failure: {:?}. remaining retries {}",
response, num_retries
);
warn!("get_slot_height failure: {response:?}. remaining retries {num_retries}");
}
if num_retries == 0 {
panic!("failed to get_slot_height(), rpc node down?")
Expand All @@ -81,10 +78,7 @@ pub fn poll_get_latest_blockhash(client: &RpcClient) -> Option<Hash> {
return Some(blockhash);
} else {
num_retries -= 1;
warn!(
"get_latest_blockhash failure: {:?}. remaining retries {}",
response, num_retries
);
warn!("get_latest_blockhash failure: {response:?}. remaining retries {num_retries}");
}
if num_retries == 0 {
panic!("failed to get_latest_blockhash(), rpc node down?")
Expand All @@ -102,10 +96,7 @@ pub fn poll_get_fee_for_message(client: &RpcClient, message: &mut Message) -> (O
return (Some(fee), message.recent_blockhash);
} else {
num_retries -= 1;
warn!(
"get_fee_for_message failure: {:?}. remaining retries {}",
response, num_retries
);
warn!("get_fee_for_message failure: {response:?}. remaining retries {num_retries}");

let blockhash = poll_get_latest_blockhash(client).expect("blockhash");
message.recent_blockhash = blockhash;
Expand All @@ -119,7 +110,7 @@ pub fn poll_get_fee_for_message(client: &RpcClient, message: &mut Message) -> (O

fn airdrop_lamports(client: &RpcClient, id: &Keypair, desired_balance: u64) -> bool {
let starting_balance = client.get_balance(&id.pubkey()).unwrap_or(0);
info!("starting balance {}", starting_balance);
info!("starting balance {starting_balance}");

if starting_balance < desired_balance {
let airdrop_amount = desired_balance - starting_balance;
Expand All @@ -143,7 +134,7 @@ fn airdrop_lamports(client: &RpcClient, id: &Keypair, desired_balance: u64) -> b
let current_balance = client.get_balance(&id.pubkey()).unwrap_or_else(|e| {
panic!("airdrop error {e}");
});
info!("current balance {}...", current_balance);
info!("current balance {current_balance}...");

if current_balance - starting_balance != airdrop_amount {
info!(
Expand Down Expand Up @@ -396,10 +387,10 @@ fn process_get_multiple_accounts(
stats.total_errors_time_us += rpc_time.as_us();
stats.errors += 1;
if last_error.elapsed().as_secs() > 2 {
info!("error: {:?}", e);
info!("error: {e:?}");
*last_error = Instant::now();
}
debug!("error: {:?}", e);
debug!("error: {e:?}");
}
}
}
Expand Down Expand Up @@ -519,7 +510,7 @@ fn run_rpc_bench_loop(
stats.total_errors_time_us += rpc_time.as_us();
stats.errors += 1;
if last_error.elapsed().as_secs() > 2 {
info!("get_account_info error: {:?}", e);
info!("get_account_info error: {e:?}");
last_error = Instant::now();
}
}
Expand All @@ -545,7 +536,7 @@ fn run_rpc_bench_loop(
stats.total_errors_time_us += rpc_time.as_us();
stats.errors += 1;
if last_error.elapsed().as_secs() > 2 {
info!("get_block error: {:?}", e);
info!("get_block error: {e:?}");
last_error = Instant::now();
}
}
Expand All @@ -569,7 +560,7 @@ fn run_rpc_bench_loop(
stats.total_errors_time_us += rpc_time.as_us();
stats.errors += 1;
if last_error.elapsed().as_secs() > 2 {
info!("get_blocks error: {:?}", e);
info!("get_blocks error: {e:?}");
last_error = Instant::now();
}
}
Expand All @@ -588,7 +579,7 @@ fn run_rpc_bench_loop(
stats.total_errors_time_us += rpc_time.as_us();
stats.errors += 1;
if last_error.elapsed().as_secs() > 2 {
info!("get_first_available_block error: {:?}", e);
info!("get_first_available_block error: {e:?}");
last_error = Instant::now();
}
}
Expand All @@ -607,7 +598,7 @@ fn run_rpc_bench_loop(
stats.total_errors_time_us += rpc_time.as_us();
stats.errors += 1;
if last_error.elapsed().as_secs() > 2 {
info!("get_slot error: {:?}", e);
info!("get_slot error: {e:?}");
last_error = Instant::now();
}
}
Expand All @@ -626,7 +617,7 @@ fn run_rpc_bench_loop(
stats.total_errors_time_us += rpc_time.as_us();
stats.errors += 1;
if last_error.elapsed().as_secs() > 2 {
info!("get_token_supply error: {:?}", e);
info!("get_token_supply error: {e:?}");
last_error = Instant::now();
}
}
Expand Down Expand Up @@ -659,7 +650,7 @@ fn run_rpc_bench_loop(
stats.errors += 1;
stats.total_errors_time_us += rpc_time.as_us();
if last_error.elapsed().as_secs() > 2 {
info!("get-program-accounts error: {:?}", e);
info!("get-program-accounts error: {e:?}");
last_error = Instant::now();
}
}
Expand All @@ -679,7 +670,7 @@ fn run_rpc_bench_loop(
stats.errors += 1;
stats.total_errors_time_us += rpc_time.as_us();
if last_error.elapsed().as_secs() > 2 {
info!("get-token-accounts-by-delegate error: {:?}", e);
info!("get-token-accounts-by-delegate error: {e:?}");
last_error = Instant::now();
}
}
Expand All @@ -699,7 +690,7 @@ fn run_rpc_bench_loop(
stats.errors += 1;
stats.total_errors_time_us += rpc_time.as_us();
if last_error.elapsed().as_secs() > 2 {
info!("get-token-accounts-by-owner error: {:?}", e);
info!("get-token-accounts-by-owner error: {e:?}");
last_error = Instant::now();
}
}
Expand Down Expand Up @@ -781,7 +772,7 @@ fn make_rpc_bench_threads(
let transaction_signature_tracker = transaction_signature_tracker.clone();
let mint = *mint;
Builder::new()
.name(format!("rpc-bench-{}", thread))
.name(format!("rpc-bench-{thread}"))
.spawn(move || {
start_bench.wait();
run_rpc_bench_loop(
Expand Down Expand Up @@ -853,7 +844,7 @@ fn run_accounts_bench(
let transaction_signature_tracker =
TransactionSignatureTracker(Arc::new(RwLock::new(VecDeque::with_capacity(5000))));

info!("Starting balance(s): {:?}", balances);
info!("Starting balance(s): {balances:?}");

let executor = TransactionExecutor::new_with_rpc_client(client.clone());

Expand Down Expand Up @@ -917,10 +908,7 @@ fn run_accounts_bench(
}
last_balance = Instant::now();
if *balance < lamports * 2 {
info!(
"Balance {} is less than needed: {}, doing airdrop...",
balance, lamports
);
info!("Balance {balance} is less than needed: {lamports}, doing airdrop...");
if !airdrop_lamports(&client, payer_keypairs[i], lamports * 100_000) {
warn!("failed airdrop, exiting");
return;
Expand All @@ -934,7 +922,7 @@ fn run_accounts_bench(
if sigs_len < batch_size {
let num_to_create = batch_size - sigs_len;
if num_to_create >= payer_keypairs.len() {
info!("creating {} new", num_to_create);
info!("creating {num_to_create} new");
let chunk_size = num_to_create / payer_keypairs.len();
if chunk_size > 0 {
for (i, keypair) in payer_keypairs.iter().enumerate() {
Expand Down Expand Up @@ -1018,8 +1006,7 @@ fn run_accounts_bench(
|| max_accounts_met
{
info!(
"total_accounts_created: {} total_accounts_closed: {} tx_sent_count: {} loop_count: {} balance(s): {:?}",
total_accounts_created, total_accounts_closed, tx_sent_count, count, balances
"total_accounts_created: {total_accounts_created} total_accounts_closed: {total_accounts_closed} tx_sent_count: {tx_sent_count} loop_count: {count} balance(s): {balances:?}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is significantly longer than 100 characters. Granted it was longer than 100 characters before too...

);
last_log = Instant::now();
}
Expand Down Expand Up @@ -1061,9 +1048,9 @@ fn run_accounts_bench(
(max_created_seed - max_closed_seed) as usize,
);
if num_to_close >= payer_keypairs.len() {
info!("closing {} accounts", num_to_close);
info!("closing {num_to_close} accounts");
let chunk_size = num_to_close / payer_keypairs.len();
info!("{:?} chunk_size", chunk_size);
info!("{chunk_size:?} chunk_size");
if chunk_size > 0 {
for (i, keypair) in payer_keypairs.iter().enumerate() {
let txs: Vec<_> = (0..chunk_size)
Expand Down Expand Up @@ -1101,8 +1088,7 @@ fn run_accounts_bench(
count += 1;
if last_log.elapsed().as_millis() > 3000 || max_closed_seed >= max_created_seed {
info!(
"total_accounts_closed: {} tx_sent_count: {} loop_count: {} balance(s): {:?}",
total_accounts_closed, tx_sent_count, count, balances
"total_accounts_closed: {total_accounts_closed} tx_sent_count: {tx_sent_count} loop_count: {count} balance(s): {balances:?}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Longer than 100 characters now, where as it wasn't before.

);
last_log = Instant::now();
}
Expand Down Expand Up @@ -1333,7 +1319,7 @@ fn main() {
Some(
solana_net_utils::get_cluster_shred_version(&entrypoint_addr).unwrap_or_else(
|err| {
eprintln!("Failed to get shred version: {}", err);
eprintln!("Failed to get shred version: {err}");
exit(1);
},
),
Expand All @@ -1344,7 +1330,7 @@ fn main() {
};

let rpc_addr = if !skip_gossip {
info!("Finding cluster entry: {:?}", entrypoint_addr);
info!("Finding cluster entry: {entrypoint_addr:?}");
let (gossip_nodes, _validators) = discover(
None, // keypair
Some(&entrypoint_addr),
Expand All @@ -1364,7 +1350,7 @@ fn main() {
info!("done found {} nodes", gossip_nodes.len());
gossip_nodes[0].rpc().unwrap()
} else {
info!("Using {:?} as the RPC address", entrypoint_addr);
info!("Using {entrypoint_addr:?} as the RPC address");
entrypoint_addr
};

Expand Down Expand Up @@ -1500,7 +1486,7 @@ pub mod test {
);
let post_txs = client.get_transaction_count().unwrap();
start.stop();
info!("{} pre {} post {}", start, pre_txs, post_txs);
info!("{start} pre {pre_txs} post {post_txs}");
}

#[test]
Expand Down Expand Up @@ -1550,7 +1536,7 @@ pub mod test {
);
let post_txs = client.get_transaction_count().unwrap();
start.stop();
info!("{} pre {} post {}", start, pre_txs, post_txs);
info!("{start} pre {pre_txs} post {post_txs}");
}

#[test]
Expand Down Expand Up @@ -1649,6 +1635,6 @@ pub mod test {
0,
);
start.stop();
info!("{}", start);
info!("{start}");
}
}
4 changes: 2 additions & 2 deletions accounts-db/src/account_storage_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ mod tests {

// Generate a seed from entropy and log the original seed
let seed: u64 = rand::random();
info!("Generated seed: {}", seed);
info!("Generated seed: {seed}");

// Use a seedable RNG with the generated seed for reproducibility
let mut rng = StdRng::seed_from_u64(seed);
Expand Down Expand Up @@ -343,7 +343,7 @@ mod tests {

// Generate a seed from entropy and log the original seed
let seed: u64 = rand::random();
info!("Generated seed: {}", seed);
info!("Generated seed: {seed}");

// Use a seedable RNG with the generated seed for reproducibility
let mut rng = StdRng::seed_from_u64(seed);
Expand Down
2 changes: 1 addition & 1 deletion accounts-db/src/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1417,7 +1417,7 @@ mod tests {
accounts.add_root_and_flush_write_cache(i);

if i % 1_000 == 0 {
info!(" store {}", i);
info!(" store {i}");
}
}
info!("done..cleaning..");
Expand Down
17 changes: 8 additions & 9 deletions accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2048,7 +2048,7 @@ impl AccountsDb {
MarkAccountsObsolete::No,
);
measure.stop();
debug!("{}", measure);
debug!("{measure}");
self.clean_accounts_stats
.clean_old_root_reclaim_us
.fetch_add(measure.as_us(), Ordering::Relaxed);
Expand Down Expand Up @@ -3757,7 +3757,7 @@ impl AccountsDb {
}
let mut unique_accounts =
self.get_unique_accounts_from_storage_for_shrink(&store, &self.shrink_stats);
debug!("do_shrink_slot_store: slot: {}", slot);
debug!("do_shrink_slot_store: slot: {slot}");
let shrink_collect = self.shrink_collect::<AliveAccounts<'_>>(
&store,
&mut unique_accounts,
Expand Down Expand Up @@ -3939,7 +3939,7 @@ impl AccountsDb {
// Reads all accounts in given slot's AppendVecs and filter only to alive,
// then create a minimum AppendVec filled with the alive.
fn shrink_slot_forced(&self, slot: Slot) {
debug!("shrink_slot_forced: slot: {}", slot);
debug!("shrink_slot_forced: slot: {slot}");

if let Some(store) = self
.storage
Expand Down Expand Up @@ -6767,7 +6767,7 @@ impl AccountsDb {
.filter_map(|r| r.as_ref().err())
.next()
{
panic!("failed generating accounts hash files: {:?}", err);
panic!("failed generating accounts hash files: {err:?}");
}

// convert mmapped cache files into slices of data
Expand Down Expand Up @@ -6874,8 +6874,7 @@ impl AccountsDb {
self.calculate_accounts_hash(&calc_config, &sorted_storages, HashStats::default());
if calculated_lamports != total_lamports {
warn!(
"Mismatched total lamports: {} calculated: {}",
total_lamports, calculated_lamports
"Mismatched total lamports: {total_lamports} calculated: {calculated_lamports}"
);
return Err(AccountsHashVerificationError::MismatchedTotalLamports(
calculated_lamports,
Expand Down Expand Up @@ -7416,7 +7415,7 @@ impl AccountsDb {
"remove_dead_slots_metadata: {} dead slots",
dead_slots.len()
);
trace!("remove_dead_slots_metadata: dead_slots: {:?}", dead_slots);
trace!("remove_dead_slots_metadata: dead_slots: {dead_slots:?}");
}
self.accounts_index
.update_roots_stats(&mut accounts_index_root_stats);
Expand Down Expand Up @@ -8506,7 +8505,7 @@ impl AccountsDb {
.alive_bytes
.store(entry.stored_size, Ordering::Release);
} else {
trace!("id: {} clearing count", id);
trace!("id: {id} clearing count");
store.count_and_status.lock_write().0 = 0;
}
}
Expand All @@ -8523,7 +8522,7 @@ impl AccountsDb {
let mut alive_roots: Vec<_> = self.accounts_index.all_alive_roots();
#[allow(clippy::stable_sort_primitive)]
alive_roots.sort();
info!("{}: accounts_index alive_roots: {:?}", label, alive_roots,);
info!("{label}: accounts_index alive_roots: {alive_roots:?}",);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: not caused by you, but the trailing comma.

Suggested change
info!("{label}: accounts_index alive_roots: {alive_roots:?}",);
info!("{label}: accounts_index alive_roots: {alive_roots:?}");

let full_pubkey_range = Pubkey::from([0; 32])..=Pubkey::from([0xff; 32]);

self.accounts_index.account_maps.iter().for_each(|map| {
Expand Down
Loading
Loading