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
8 changes: 5 additions & 3 deletions core/benches/receive_and_buffer_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,11 @@ fn generate_transactions(
) -> BankingPacketBatch {
assert!(num_instructions_per_tx <= MAX_INSTRUCTIONS_PER_TRANSACTION);
if set_rand_cu_price {
assert!(num_instructions_per_tx > 0,
"`num_instructions_per_tx` must be at least 1 when `set_rand_cu_price` flag is set to count\
the set_compute_unit_price instruction.");
assert!(
num_instructions_per_tx > 0,
"`num_instructions_per_tx` must be at least 1 when `set_rand_cu_price` flag is set to \
count the set_compute_unit_price instruction."
);
}
let blockhash = FaultyBlockhash::new(bank.last_blockhash(), probability_invalid_blockhash);

Expand Down
6 changes: 4 additions & 2 deletions core/benches/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,10 @@ fn bench_scheduler_impl<T: ReceiveAndBuffer + utils::ReceiveAndBufferCreator>(
for (ix_count, ix_count_desc) in &ix_counts {
for (tx_count, tx_count_desc) in &tx_counts {
for (conflict_type, conflict_type_desc) in &conflict_types {
let bench_name =
format!("{bench_name}/{scheduler_desc}/{ix_count_desc}/{tx_count_desc}/{conflict_type_desc}");
let bench_name = format!(
"{bench_name}/{scheduler_desc}/{ix_count_desc}/{tx_count_desc}/\
{conflict_type_desc}"
);
group.throughput(Throughput::Elements(*tx_count as u64));
group.bench_function(&bench_name, |bencher| {
bencher.iter_custom(|iters| {
Expand Down
14 changes: 9 additions & 5 deletions core/src/accounts_hash_verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,14 @@ impl AccountsHashVerifier {
match accounts_package.accounts_hash_algorithm {
AccountsHashAlgorithm::Merkle => {
debug!(
"calculate_and_verify_accounts_hash(): snapshots lt hash is disabled, \
DO merkle-based accounts hash calculation",
"calculate_and_verify_accounts_hash(): snapshots lt hash is disabled, DO \
merkle-based accounts hash calculation",
);
}
AccountsHashAlgorithm::Lattice => {
debug!(
"calculate_and_verify_accounts_hash(): snapshots lt hash is enabled, \
SKIP merkle-based accounts hash calculation",
"calculate_and_verify_accounts_hash(): snapshots lt hash is enabled, SKIP \
merkle-based accounts hash calculation",
);
return Ok((MerkleOrLatticeAccountsHash::Lattice, None));
}
Expand Down Expand Up @@ -284,6 +284,7 @@ impl AccountsHashVerifier {
let Some((base_accounts_hash, base_capitalization)) =
accounts_db.get_accounts_hash(base_slot)
else {
#[rustfmt::skip]
panic!(
"incremental snapshot requires accounts hash and capitalization from \
the full snapshot it is based on\n\
Expand Down Expand Up @@ -447,7 +448,10 @@ impl AccountsHashVerifier {
let MerkleOrLatticeAccountsHash::Merkle(AccountsHashKind::Full(accounts_hash)) =
merkle_or_lattice_accounts_hash
else {
panic!("EAH requires a full accounts hash, but was given {merkle_or_lattice_accounts_hash:?}");
panic!(
"EAH requires a full accounts hash, but was given \
{merkle_or_lattice_accounts_hash:?}"
);
};
info!(
"saving epoch accounts hash, slot: {}, hash: {}",
Expand Down
37 changes: 21 additions & 16 deletions core/src/banking_simulation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ impl BankingTraceEvents {
) {
// Silence errors here as this can happen under normal operation...
warn!(
"Reading {:?} failed {:?} due to file corruption or unclean validator shutdown",
event_file_path, read_result,
"Reading {event_file_path:?} failed {read_result:?} due to file corruption or \
unclean validator shutdown",
);
} else {
read_result?
Expand Down Expand Up @@ -342,10 +342,14 @@ struct SenderLoop {
impl SenderLoop {
fn log_starting(&self) {
info!(
"simulating events: {} (out of {}), starting at slot {} (based on {} from traced event slot: {}) (warmup: -{:?})",
self.timed_batches_to_send.len(), self.total_batch_count, self.first_simulated_slot,
"simulating events: {} (out of {}), starting at slot {} (based on {} from traced \
event slot: {}) (warmup: -{:?})",
self.timed_batches_to_send.len(),
self.total_batch_count,
self.first_simulated_slot,
SenderLoopLogger::format_as_timestamp(self.raw_base_event_time),
self.parent_slot, WARMUP_DURATION,
self.parent_slot,
WARMUP_DURATION,
);
}

Expand Down Expand Up @@ -594,10 +598,7 @@ impl<'a> SenderLoopLogger<'a> {
batch_count: usize,
tx_count: usize,
) {
debug!(
"sent {:?} {} batches ({} txes)",
label, batch_count, tx_count
);
debug!("sent {label:?} {batch_count} batches ({tx_count} txes)");

use ChannelLabel::*;
let (total_batch_count, total_tx_count) = match label {
Expand Down Expand Up @@ -625,9 +626,16 @@ impl<'a> SenderLoopLogger<'a> {
let gossip_vote_tps =
(self.gossip_vote_tx_count - self.last_gossip_vote_tx_count) as f64 / duration;
info!(
"senders(non-,tpu-,gossip-vote): tps: {:.0} (={:.0}+{:.0}+{:.0}) over {:?} not-recved: ({}+{}+{})",
tps, non_vote_tps, tpu_vote_tps, gossip_vote_tps, log_interval,
self.non_vote_sender.len(), self.tpu_vote_sender.len(), self.gossip_vote_sender.len(),
"senders(non-,tpu-,gossip-vote): tps: {:.0} (={:.0}+{:.0}+{:.0}) over {:?} \
not-recved: ({}+{}+{})",
tps,
non_vote_tps,
tpu_vote_tps,
gossip_vote_tps,
log_interval,
self.non_vote_sender.len(),
self.tpu_vote_sender.len(),
self.gossip_vote_sender.len(),
);
self.last_log_duration = simulation_duration;
self.last_tx_count = current_tx_count;
Expand Down Expand Up @@ -763,10 +771,7 @@ impl BankingSimulator {
)))
.unwrap();
assert!(retracer.is_enabled());
info!(
"Enabled banking retracer (dir_byte_limit: {})",
BANKING_TRACE_DIR_DEFAULT_BYTE_LIMIT,
);
info!("Enabled banking retracer (dir_byte_limit: {BANKING_TRACE_DIR_DEFAULT_BYTE_LIMIT})",);

// Create a partially-dummy ClusterInfo for the banking stage.
let cluster_info_for_banking = Arc::new(DummyClusterInfo {
Expand Down
5 changes: 1 addition & 4 deletions core/src/banking_trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,10 +450,7 @@ impl TracedSender {
TracedEvent::PacketBatch(self.label, BankingPacketBatch::clone(&batch)),
))
.map_err(|err| {
error!(
"unexpected error when tracing a banking event...: {:?}",
err
);
error!("unexpected error when tracing a banking event...: {err:?}");
SendError(BankingPacketBatch::clone(&batch))
})?;
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/cluster_info_vote_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ impl ClusterInfoVoteListener {
sender
.send(BankNotification::OptimisticallyConfirmed(slot))
.unwrap_or_else(|err| {
warn!("bank_notification_sender failed: {:?}", err)
warn!("bank_notification_sender failed: {err:?}")
});
}
}
Expand Down
10 changes: 6 additions & 4 deletions core/src/cluster_slots_service/cluster_slots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ impl ClusterSlots {
let epoch_metadata = self.epoch_metadata.read().unwrap();
//startup init, this is very slow but only ever happens once
if cluster_slots.is_empty() {
info!("Init cluster_slots at range {:?}", slot_range);
info!("Init cluster_slots at range {slot_range:?}");
for slot in slot_range.clone() {
// Epoch should be defined for all slots in the window
let epoch = self
Expand Down Expand Up @@ -293,7 +293,10 @@ impl ClusterSlots {
.get_epoch_for_slot(slot)
.expect("Epoch should be defined for all slots in the window");
let Some(stake_info) = epoch_metadata.get(&epoch) else {
warn!("Epoch slots can not reuse slot entry for slot {slot} since stakes for epoch {epoch} are not available");
warn!(
"Epoch slots can not reuse slot entry for slot {slot} since stakes for epoch \
{epoch} are not available"
);
cluster_slots.push_back(RowContent {
slot,
supporters: Arc::new(SlotSupporters::new_blank()),
Expand Down Expand Up @@ -515,8 +518,7 @@ mod tests {
assert_eq!(
rg.len(),
CLUSTER_SLOTS_TRIM_SIZE,
"ring should have exactly {} elements",
CLUSTER_SLOTS_TRIM_SIZE
"ring should have exactly {CLUSTER_SLOTS_TRIM_SIZE} elements"
);
assert_eq!(rg.front().unwrap().slot, 1, "first slot should be root + 1");
assert_eq!(
Expand Down
2 changes: 1 addition & 1 deletion core/src/completed_data_sets_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl CompletedDataSetsService {
rpc_subscriptions.notify_signatures_received((slot, transactions));
}
}
Err(e) => warn!("completed-data-set-service deserialize error: {:?}", e),
Err(e) => warn!("completed-data-set-service deserialize error: {e:?}"),
}
slot
};
Expand Down
36 changes: 15 additions & 21 deletions core/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ impl Tower {
if voted_stake == 0 {
continue;
}
trace!("{} {} with stake {}", vote_account_pubkey, key, voted_stake);
trace!("{vote_account_pubkey} {key} with stake {voted_stake}");
let mut vote_state = TowerVoteState::from(account.vote_state_view());
for vote in &vote_state.votes {
lockout_intervals
Expand All @@ -418,7 +418,7 @@ impl Tower {

if key == *vote_account_pubkey {
my_latest_landed_vote = vote_state.nth_recent_lockout(0).map(|l| l.slot());
debug!("vote state {:?}", vote_state);
debug!("vote state {vote_state:?}");
debug!(
"observed slot {}",
vote_state
Expand Down Expand Up @@ -578,8 +578,8 @@ impl Tower {
if let Some(last_voted_slot) = self.last_vote.last_voted_slot() {
if heaviest_slot_on_same_fork <= last_voted_slot {
warn!(
"Trying to refresh timestamp for vote on {last_voted_slot} \
using smaller heaviest bank {heaviest_slot_on_same_fork}"
"Trying to refresh timestamp for vote on {last_voted_slot} using smaller \
heaviest bank {heaviest_slot_on_same_fork}"
);
return;
}
Expand Down Expand Up @@ -961,7 +961,7 @@ impl Tower {
vote({last_voted_slot}), meaning some inconsistency between saved tower and \
ledger."
);
warn!("{}", message);
warn!("{message}");
datapoint_warn!("tower_warn", ("warn", message, String));
}
&empty_ancestors
Expand Down Expand Up @@ -1116,8 +1116,8 @@ impl Tower {
last_vote_ancestors,
)
.expect(
"candidate_slot and switch_slot exist in descendants map, \
so they must exist in ancestors map",
"candidate_slot and switch_slot exist in descendants map, so they \
must exist in ancestors map",
)
}
{
Expand Down Expand Up @@ -1255,11 +1255,7 @@ impl Tower {
);
let new_check = Some((switch_slot, decision.clone()));
if new_check != self.last_switch_threshold_check {
trace!(
"new switch threshold check: slot {}: {:?}",
switch_slot,
decision,
);
trace!("new switch threshold check: slot {switch_slot}: {decision:?}",);
self.last_switch_threshold_check = new_check;
}
decision
Expand Down Expand Up @@ -1472,7 +1468,7 @@ impl Tower {
"For some reason, we're REPROCESSING slots which has already been voted and \
ROOTED by us; VOTING will be SUSPENDED UNTIL {last_voted_slot}!",
);
error!("{}", message);
error!("{message}");
datapoint_error!("tower_error", ("error", message, String));

// Let's pass-through adjust_lockouts_with_slot_history just for sanitization,
Expand Down Expand Up @@ -1571,7 +1567,7 @@ impl Tower {
}

// Check for errors if not anchored
info!("adjusted tower's anchored slot: {:?}", anchored_slot);
info!("adjusted tower's anchored slot: {anchored_slot:?}");
if anchored_slot.is_none() {
// this error really shouldn't happen unless ledger/tower is corrupted
return Err(TowerError::FatallyInconsistent(
Expand Down Expand Up @@ -1737,9 +1733,8 @@ pub fn reconcile_blockstore_roots_with_external_source(
.collect();
if !new_roots.is_empty() {
info!(
"Reconciling slots as root based on external root: {:?} (external: {:?}, \
blockstore: {})",
new_roots, external_source, last_blockstore_root
"Reconciling slots as root based on external root: {new_roots:?} (external: \
{external_source:?}, blockstore: {last_blockstore_root})"
);

// Unfortunately, we can't supply duplicate-confirmed hashes,
Expand All @@ -1761,10 +1756,9 @@ pub fn reconcile_blockstore_roots_with_external_source(
// That's because we might have a chance of recovering properly with
// newer snapshot.
warn!(
"Couldn't find any ancestor slots from external source ({:?}) towards blockstore \
root ({}); blockstore pruned or only tower moved into new ledger or just hard \
fork?",
external_source, last_blockstore_root,
"Couldn't find any ancestor slots from external source ({external_source:?}) \
towards blockstore root ({last_blockstore_root}); blockstore pruned or only \
tower moved into new ledger or just hard fork?",
);
}
}
Expand Down
7 changes: 2 additions & 5 deletions core/src/consensus/fork_choice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,8 @@ fn recheck_fork_decision_failed_switch_threshold(
// then there will be no blocks to include the votes for slot 4, and the network halts
// because 90% of validators can't vote
info!(
"Waiting to switch vote to {heaviest_bank_slot}, \
resetting to slot {:?} for now, \
switch proof stake: {switch_proof_stake}, \
threshold stake: {}, \
total stake: {total_stake}",
"Waiting to switch vote to {heaviest_bank_slot}, resetting to slot {:?} for now, switch \
proof stake: {switch_proof_stake}, threshold stake: {}, total stake: {total_stake}",
reset_bank.as_ref().map(|b| b.slot()),
total_stake as f64 * SWITCH_FORK_THRESHOLD,
);
Expand Down
25 changes: 8 additions & 17 deletions core/src/consensus/heaviest_subtree_fork_choice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ impl ForkInfo {
if let Some(latest_invalid_ancestor) = self.latest_invalid_ancestor {
if latest_invalid_ancestor <= newly_valid_ancestor {
info!(
"Fork choice for {:?} clearing latest invalid ancestor {:?} because {:?} was \
duplicate confirmed",
my_key, latest_invalid_ancestor, newly_valid_ancestor
"Fork choice for {my_key:?} clearing latest invalid ancestor \
{latest_invalid_ancestor:?} because {newly_valid_ancestor:?} was duplicate \
confirmed"
);
self.latest_invalid_ancestor = None;
}
Expand Down Expand Up @@ -936,10 +936,7 @@ impl HeaviestSubtreeForkChoice {
let fork_info = self.fork_infos.get_mut(&slot_hash_key).unwrap();
if is_duplicate_confirmed {
if !fork_info.is_duplicate_confirmed {
info!(
"Fork choice setting {:?} to duplicate confirmed",
slot_hash_key
);
info!("Fork choice setting {slot_hash_key:?} to duplicate confirmed");
}
fork_info.set_duplicate_confirmed();
}
Expand Down Expand Up @@ -1038,8 +1035,8 @@ impl HeaviestSubtreeForkChoice {
{
assert!(if new_vote_slot == old_latest_vote_slot {
warn!(
"Got a duplicate vote for validator: {pubkey}, \
slot_hash: {new_vote_slot_hash:?}",
"Got a duplicate vote for validator: {pubkey}, slot_hash: \
{new_vote_slot_hash:?}",
);
// If the slots are equal, then the new
// vote must be for a smaller hash
Expand Down Expand Up @@ -1331,10 +1328,7 @@ impl ForkChoice for HeaviestSubtreeForkChoice {
}

fn mark_fork_invalid_candidate(&mut self, invalid_slot_hash_key: &SlotHashKey) {
info!(
"marking fork starting at: {:?} invalid candidate",
invalid_slot_hash_key
);
info!("marking fork starting at: {invalid_slot_hash_key:?} invalid candidate");
let fork_info = self.fork_infos.get_mut(invalid_slot_hash_key);
if let Some(fork_info) = fork_info {
// Should not be marking duplicate confirmed blocks as invalid candidates
Expand All @@ -1359,10 +1353,7 @@ impl ForkChoice for HeaviestSubtreeForkChoice {
}

fn mark_fork_valid_candidate(&mut self, valid_slot_hash_key: &SlotHashKey) -> Vec<SlotHashKey> {
info!(
"marking fork starting at: {:?} valid candidate",
valid_slot_hash_key
);
info!("marking fork starting at: {valid_slot_hash_key:?} valid candidate");
let mut newly_duplicate_confirmed_ancestors = vec![];

for ancestor_key in std::iter::once(*valid_slot_hash_key)
Expand Down
9 changes: 2 additions & 7 deletions core/src/consensus/progress_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,13 +402,8 @@ impl ProgressMap {
pub fn log_propagated_stats(&self, slot: Slot, bank_forks: &RwLock<BankForks>) {
if let Some(stats) = self.get_propagated_stats(slot) {
info!(
"Propagated stats: \
total staked: {}, \
observed staked: {}, \
vote pubkeys: {:?}, \
node_pubkeys: {:?}, \
slot: {slot}, \
epoch: {:?}",
"Propagated stats: total staked: {}, observed staked: {}, vote pubkeys: {:?}, \
node_pubkeys: {:?}, slot: {slot}, epoch: {:?}",
stats.total_epoch_stake,
stats.propagated_validators_stake,
stats.propagated_validators,
Expand Down
Loading
Loading