Skip to content
Merged
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
12 changes: 6 additions & 6 deletions local-cluster/src/cluster_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ pub fn sleep_n_epochs(
let num_ticks_per_second = config.target_tick_duration.as_secs_f64().recip();
let num_ticks_to_sleep = num_epochs * ticks_per_slot as f64 * slots_per_epoch as f64;
let secs = ((num_ticks_to_sleep + num_ticks_per_second - 1.0) / num_ticks_per_second) as u64;
warn!("sleep_n_epochs: {} seconds", secs);
warn!("sleep_n_epochs: {secs} seconds");
sleep(Duration::from_secs(secs));
}

Expand Down Expand Up @@ -320,7 +320,7 @@ pub fn kill_entry_and_spend_and_verify_rest(
&transaction,
) {
Err(e) => {
info!("poll_all_nodes_for_signature() failed {:?}", e);
info!("poll_all_nodes_for_signature() failed {e:?}");
result = Err(e);
}
Ok(()) => {
Expand Down Expand Up @@ -405,8 +405,8 @@ pub fn check_for_new_roots(
done = num_roots >= num_new_roots;
if done || last_print.elapsed().as_secs() > 3 {
info!(
"{} waiting for {} new roots.. observed: {:?}",
test_name, num_new_roots, num_roots_map
"{test_name} waiting for {num_new_roots} new roots.. observed: \
{num_roots_map:?}"
);
last_print = Instant::now();
}
Expand Down Expand Up @@ -572,7 +572,7 @@ pub fn start_gossip_voter(
if latest_push_attempt.elapsed() > Duration::from_millis(refresh_ms) {
for (leader_vote_tx, parsed_vote) in refreshable_votes.iter().rev() {
let vote_slot = parsed_vote.last_voted_slot().unwrap();
info!("gossip voter refreshing vote {}", vote_slot);
info!("gossip voter refreshing vote {vote_slot}");
process_vote_tx(vote_slot, leader_vote_tx, parsed_vote, &cluster_info);
latest_push_attempt = Instant::now();
}
Expand All @@ -594,7 +594,7 @@ pub fn start_gossip_voter(

for (parsed_vote, leader_vote_tx) in &parsed_vote_iter {
if let Some(vote_slot) = parsed_vote.last_voted_slot() {
info!("received vote for {}", vote_slot);
info!("received vote for {vote_slot}");
if vote_slot > latest_voted_slot {
latest_voted_slot = vote_slot;
refreshable_votes
Expand Down
7 changes: 2 additions & 5 deletions local-cluster/src/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,7 @@ pub fn run_kill_partition_switch_threshold<C>(
// Needs to be at least 1/3 or there will be no overlap
// with the confirmation supermajority 2/3
static_assertions::const_assert!(SWITCH_FORK_THRESHOLD >= 1f64 / 3f64);
info!(
"stakes_to_kill: {:?}, alive_stakes: {:?}",
stakes_to_kill, alive_stakes
);
info!("stakes_to_kill: {stakes_to_kill:?}, alive_stakes: {alive_stakes:?}");

// This test:
// 1) Spins up three partitions
Expand Down Expand Up @@ -237,7 +234,7 @@ pub fn run_kill_partition_switch_threshold<C>(
[0..stakes_to_kill.len()]
.iter()
.map(|validator_to_kill| {
info!("Killing validator with id: {}", validator_to_kill);
info!("Killing validator with id: {validator_to_kill}");
cluster.exit_node(validator_to_kill)
})
.collect();
Expand Down
45 changes: 16 additions & 29 deletions local-cluster/src/local_cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ impl LocalCluster {
// Give the validator some lamports to setup vote accounts
if is_listener {
// setup as a listener
info!("listener {} ", validator_pubkey,);
info!("listener {validator_pubkey} ",);
} else if should_create_vote_pubkey {
Self::transfer_with_client(
&client,
Expand All @@ -538,10 +538,7 @@ impl LocalCluster {
.get_balance_with_commitment(&validator_pubkey, CommitmentConfig::processed())
.expect("received response")
.value;
info!(
"validator {} balance {}",
validator_pubkey, validator_balance
);
info!("validator {validator_pubkey} balance {validator_balance}");
Self::setup_vote_and_stake_accounts(
&client,
voting_keypair.as_ref().unwrap(),
Expand Down Expand Up @@ -622,7 +619,7 @@ impl LocalCluster {
.map(|v| v.info.contact_info.clone())
.collect();
assert!(!alive_node_contact_infos.is_empty());
info!("{} discovering nodes", test_name);
info!("{test_name} discovering nodes");
let cluster_nodes = discover_validators(
&alive_node_contact_infos[0].gossip().unwrap(),
alive_node_contact_infos.len(),
Expand All @@ -641,17 +638,14 @@ impl LocalCluster {
socket_addr_space: SocketAddrSpace,
) {
let alive_node_contact_infos = self.discover_nodes(socket_addr_space, test_name);
info!(
"{} looking minimum root {} on all nodes",
test_name, min_root
);
info!("{test_name} looking minimum root {min_root} on all nodes");
cluster_tests::check_min_slot_is_rooted(
min_root,
&alive_node_contact_infos,
&self.connection_cache,
test_name,
);
info!("{} done waiting for roots", test_name);
info!("{test_name} done waiting for roots");
}

pub fn check_for_new_roots(
Expand All @@ -661,14 +655,14 @@ impl LocalCluster {
socket_addr_space: SocketAddrSpace,
) {
let alive_node_contact_infos = self.discover_nodes(socket_addr_space, test_name);
info!("{} looking for new roots on all nodes", test_name);
info!("{test_name} looking for new roots on all nodes");
cluster_tests::check_for_new_roots(
num_new_roots,
&alive_node_contact_infos,
&self.connection_cache,
test_name,
);
info!("{} done waiting for roots", test_name);
info!("{test_name} done waiting for roots");
}

pub fn check_no_new_roots(
Expand All @@ -683,7 +677,7 @@ impl LocalCluster {
.map(|node| &node.info.contact_info)
.collect();
assert!(!alive_node_contact_infos.is_empty());
info!("{} discovering nodes", test_name);
info!("{test_name} discovering nodes");
let cluster_nodes = discover_validators(
&alive_node_contact_infos[0].gossip().unwrap(),
alive_node_contact_infos.len(),
Expand All @@ -692,14 +686,14 @@ impl LocalCluster {
)
.unwrap();
info!("{} discovered {} nodes", test_name, cluster_nodes.len());
info!("{} making sure no new roots on any nodes", test_name);
info!("{test_name} making sure no new roots on any nodes");
cluster_tests::check_no_new_roots(
num_slots_to_wait,
&alive_node_contact_infos,
&self.connection_cache,
test_name,
);
info!("{} done waiting for roots", test_name);
info!("{test_name} done waiting for roots");
}

/// Poll RPC to see if transaction was processed. Return an error if unable
Expand Down Expand Up @@ -797,8 +791,7 @@ impl LocalCluster {
let vote_account_pubkey = vote_account.pubkey();
let node_pubkey = from_account.pubkey();
info!(
"setup_vote_and_stake_accounts: {}, {}, amount: {}",
node_pubkey, vote_account_pubkey, amount,
"setup_vote_and_stake_accounts: {node_pubkey}, {vote_account_pubkey}, amount: {amount}",
);
let stake_account_keypair = Keypair::new();
let stake_account_pubkey = stake_account_keypair.pubkey();
Expand Down Expand Up @@ -887,12 +880,9 @@ impl LocalCluster {
)
.expect("get balance");
} else {
warn!(
"{} vote_account already has a balance?!?",
vote_account_pubkey
);
warn!("{vote_account_pubkey} vote_account already has a balance?!?");
}
info!("Checking for vote account registration of {}", node_pubkey);
info!("Checking for vote account registration of {node_pubkey}");
match (
client
.rpc_client()
Expand All @@ -916,10 +906,7 @@ impl LocalCluster {
} else if vote_state.node_pubkey != node_pubkey {
Err(Error::other("invalid vote account state"))
} else {
info!(
"node {} {:?} {:?}",
node_pubkey, stake_state, vote_state
);
info!("node {node_pubkey} {stake_state:?} {vote_state:?}");

return Ok(());
}
Expand Down Expand Up @@ -953,7 +940,7 @@ impl LocalCluster {
rpc_client: Arc<RpcClient>,
rpc_pubsub_addr: SocketAddr,
) -> Result<QuicTpuClient> {
let rpc_pubsub_url = format!("ws://{}/", rpc_pubsub_addr);
let rpc_pubsub_url = format!("ws://{rpc_pubsub_addr}/");

let cache = match &*self.connection_cache {
ConnectionCache::Quic(cache) => cache,
Expand All @@ -968,7 +955,7 @@ impl LocalCluster {
TpuClientConfig::default(),
cache.clone(),
)
.map_err(|err| Error::other(format!("TpuSenderError: {}", err)))?;
.map_err(|err| Error::other(format!("TpuSenderError: {err}")))?;

Ok(tpu_client)
}
Expand Down
9 changes: 4 additions & 5 deletions local-cluster/src/local_cluster_snapshot_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,8 @@ impl LocalCluster {

// Wait for a snapshot for a bank > last_slot to be made
trace!(
"Waiting for {:?} snapshot archive to be generated with slot > {}, max wait duration: {:?}",
next_snapshot_type,
last_slot,
max_wait_duration,
"Waiting for {next_snapshot_type:?} snapshot archive to be generated with slot > \
{last_slot}, max wait duration: {max_wait_duration:?}",
);
let timer = Instant::now();
let next_snapshot = loop {
Expand Down Expand Up @@ -122,7 +120,8 @@ impl LocalCluster {
if let Some(max_wait_duration) = max_wait_duration {
assert!(
timer.elapsed() < max_wait_duration,
"Waiting for next {next_snapshot_type:?} snapshot exceeded the {max_wait_duration:?} maximum wait duration!",
"Waiting for next {next_snapshot_type:?} snapshot exceeded the \
{max_wait_duration:?} maximum wait duration!",
);
}
sleep(Duration::from_secs(1));
Expand Down
Loading
Loading