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
11 changes: 5 additions & 6 deletions runtime/src/accounts_background_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -509,10 +509,9 @@ impl AccountsBackgroundService {
Ok(snapshot_slot) => {
assert!(
last_cleaned_slot <= snapshot_slot,
"last cleaned slot: {last_cleaned_slot}, \
snapshot request slot: {snapshot_slot}, \
is startup verification complete: {}, \
enqueued snapshot requests: {:?}",
"last cleaned slot: {last_cleaned_slot}, snapshot request \
slot: {snapshot_slot}, is startup verification complete: \
{}, enqueued snapshot requests: {:?}",
bank.has_initial_accounts_hash_verification_completed(),
request_handlers
.snapshot_request_handler
Expand All @@ -526,8 +525,8 @@ impl AccountsBackgroundService {
}
Err(err) => {
error!(
"Stopping AccountsBackgroundService! \
Fatal error while handling snapshot requests: {err}",
"Stopping AccountsBackgroundService! Fatal error while \
handling snapshot requests: {err}",
);
exit.store(true, Ordering::Relaxed);
break;
Expand Down
107 changes: 51 additions & 56 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1739,8 +1739,8 @@ impl Bank {
Some(account)
})
.expect(
"Stakes cache is inconsistent with accounts-db. This can indicate \
a corrupted snapshot or bugs in cached accounts or accounts-db.",
"Stakes cache is inconsistent with accounts-db. This can indicate a corrupted \
snapshot or bugs in cached accounts or accounts-db.",
));
info!("Loading Stakes took: {stakes_time}");
let stakes_accounts_load_duration = now.elapsed();
Expand Down Expand Up @@ -1845,8 +1845,8 @@ impl Bank {
// from the passed in genesis_config instead (as new()/new_with_paths() already do)
assert_eq!(
bank.genesis_creation_time, genesis_config.creation_time,
"Bank snapshot genesis creation time does not match genesis.bin creation time. \
The snapshot and genesis.bin might pertain to different clusters"
"Bank snapshot genesis creation time does not match genesis.bin creation time. The \
snapshot and genesis.bin might pertain to different clusters"
);
assert_eq!(bank.ticks_per_slot, genesis_config.ticks_per_slot);
assert_eq!(
Expand Down Expand Up @@ -2376,7 +2376,7 @@ impl Bank {
},
)| {
if let Err(err) = vote_account.checked_add_lamports(vote_rewards) {
debug!("reward redemption failed for {}: {:?}", vote_pubkey, err);
debug!("reward redemption failed for {vote_pubkey}: {err:?}");
return;
}

Expand Down Expand Up @@ -2685,8 +2685,9 @@ impl Bank {

assert!(
!self.freeze_started(),
"Can't change frozen bank by adding not-existing new precompiled program ({program_id}). \
Maybe, inconsistent program activation is detected on snapshot restore?"
"Can't change frozen bank by adding not-existing new precompiled program \
({program_id}). Maybe, inconsistent program activation is detected on snapshot \
restore?"
);

// Add a bogus executable account, which will be loaded and ignored.
Expand Down Expand Up @@ -3132,7 +3133,7 @@ impl Bank {
},
);

debug!("simulate_transaction: {:?}", timings);
debug!("simulate_transaction: {timings:?}");

let processing_result = processing_results
.pop()
Expand Down Expand Up @@ -3333,7 +3334,7 @@ impl Bank {
}
Err(err) => {
if err_count.0 == 0 {
debug!("tx error: {:?} {:?}", err, tx);
debug!("tx error: {err:?} {tx:?}");
}
*err_count += 1;
}
Expand Down Expand Up @@ -3542,7 +3543,8 @@ impl Bank {
) -> Vec<TransactionCommitResult> {
assert!(
!self.freeze_started(),
"commit_transactions() working on a bank that is already frozen or is undergoing freezing!"
"commit_transactions() working on a bank that is already frozen or is undergoing \
freezing!"
);

let ProcessedTransactionCounts {
Expand Down Expand Up @@ -3985,40 +3987,32 @@ impl Bank {
pubkey: &Pubkey,
new_account: &AccountSharedData,
) {
let old_account_data_size =
if let Some(old_account) = self.get_account_with_fixed_root_no_cache(pubkey) {
match new_account.lamports().cmp(&old_account.lamports()) {
std::cmp::Ordering::Greater => {
let increased = new_account.lamports() - old_account.lamports();
trace!(
"store_account_and_update_capitalization: increased: {} {}",
pubkey,
increased
);
self.capitalization.fetch_add(increased, Relaxed);
}
std::cmp::Ordering::Less => {
let decreased = old_account.lamports() - new_account.lamports();
trace!(
"store_account_and_update_capitalization: decreased: {} {}",
pubkey,
decreased
);
self.capitalization.fetch_sub(decreased, Relaxed);
}
std::cmp::Ordering::Equal => {}
let old_account_data_size = if let Some(old_account) =
self.get_account_with_fixed_root_no_cache(pubkey)
{
match new_account.lamports().cmp(&old_account.lamports()) {
std::cmp::Ordering::Greater => {
let diff = new_account.lamports() - old_account.lamports();
trace!("store_account_and_update_capitalization: increased: {pubkey} {diff}");
self.capitalization.fetch_add(diff, Relaxed);
}
old_account.data().len()
} else {
trace!(
"store_account_and_update_capitalization: created: {} {}",
pubkey,
new_account.lamports()
);
self.capitalization
.fetch_add(new_account.lamports(), Relaxed);
0
};
std::cmp::Ordering::Less => {
let diff = old_account.lamports() - new_account.lamports();
trace!("store_account_and_update_capitalization: decreased: {pubkey} {diff}");
self.capitalization.fetch_sub(diff, Relaxed);
}
std::cmp::Ordering::Equal => {}
}
old_account.data().len()
} else {
trace!(
"store_account_and_update_capitalization: created: {pubkey} {}",
new_account.lamports()
);
self.capitalization
.fetch_add(new_account.lamports(), Relaxed);
0
};

self.store_account(pubkey, new_account);
self.calculate_and_update_accounts_data_size_delta_off_chain(
Expand Down Expand Up @@ -4160,14 +4154,14 @@ impl Bank {
let bank_frozen = *lock != Hash::default();
if new_hard_fork_slot < bank_slot {
warn!(
"Hard fork at slot {new_hard_fork_slot} ignored, the hard fork is older \
than the bank at slot {bank_slot} that attempted to register it."
"Hard fork at slot {new_hard_fork_slot} ignored, the hard fork is older than the \
bank at slot {bank_slot} that attempted to register it."
);
} else if (new_hard_fork_slot == bank_slot) && bank_frozen {
warn!(
"Hard fork at slot {new_hard_fork_slot} ignored, the hard fork is the same \
slot as the bank at slot {bank_slot} that attempted to register it, but that \
bank is already frozen."
"Hard fork at slot {new_hard_fork_slot} ignored, the hard fork is the same slot \
as the bank at slot {bank_slot} that attempted to register it, but that bank is \
already frozen."
);
} else {
self.hard_forks
Expand Down Expand Up @@ -4523,8 +4517,8 @@ impl Bank {
);
info!(
"bank frozen: {slot} hash: {hash} signature_count: {} last_blockhash: {} \
capitalization: {}, accounts_lt_hash checksum: {accounts_lt_hash_checksum}, \
stats: {bank_hash_stats:?}",
capitalization: {}, accounts_lt_hash checksum: {accounts_lt_hash_checksum}, stats: \
{bank_hash_stats:?}",
self.signature_count(),
self.last_blockhash(),
self.capitalization(),
Expand Down Expand Up @@ -4611,8 +4605,8 @@ impl Bank {
let expected = expected_accounts_lt_hash.0.checksum();
let calculated = calculated_accounts_lt_hash.0.checksum();
error!(
"Verifying accounts failed: accounts lattice hashes do not match, \
expected: {expected}, calculated: {calculated}",
"Verifying accounts failed: accounts lattice hashes do not match, expected: \
{expected}, calculated: {calculated}",
);
}
is_ok
Expand Down Expand Up @@ -5205,9 +5199,9 @@ impl Bank {
}

pub fn add_precompile(&mut self, program_id: &Pubkey) {
debug!("Adding precompiled program {}", program_id);
debug!("Adding precompiled program {program_id}");
self.add_precompiled_account(program_id);
debug!("Added precompiled program {:?}", program_id);
debug!("Added precompiled program {program_id:?}");
}

// Call AccountsDb::clean_accounts()
Expand Down Expand Up @@ -5714,8 +5708,9 @@ impl TransactionProcessingCallback for Bank {

assert!(
!self.freeze_started(),
"Can't change frozen bank by adding not-existing new builtin program ({name}, {program_id}). \
Maybe, inconsistent program activation is detected on snapshot restore?"
"Can't change frozen bank by adding not-existing new builtin program ({name}, \
{program_id}). Maybe, inconsistent program activation is detected on snapshot \
restore?"
);

// Add a bogus executable builtin account, which will be loaded and ignored.
Expand Down
17 changes: 9 additions & 8 deletions runtime/src/bank/partitioned_epoch_rewards/calculation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,12 @@ impl Bank {

// Use `EpochStakes` for vote accounts
let leader_schedule_epoch = self.epoch_schedule().get_leader_schedule_epoch(self.slot());
let cached_vote_accounts = self.epoch_stakes(leader_schedule_epoch)
.expect("calculation should always run after Bank::update_epoch_stakes(leader_schedule_epoch)")
let cached_vote_accounts = self
.epoch_stakes(leader_schedule_epoch)
.expect(
"calculation should always run after \
Bank::update_epoch_stakes(leader_schedule_epoch)",
)
.stakes()
.vote_accounts();

Expand Down Expand Up @@ -373,8 +377,8 @@ impl Bank {
) && VoteAccount::try_from(account_from_db.clone()).is_ok()
{
panic!(
"Vote account {} not found in cache, but found in db: {:?}",
vote_pubkey, account_from_db
"Vote account {vote_pubkey} not found in cache, but found in \
db: {account_from_db:?}"
);
}
}
Expand Down Expand Up @@ -422,10 +426,7 @@ impl Bank {
commission,
});
} else {
debug!(
"redeem_rewards() failed for {}: {:?}",
stake_pubkey, redeemed
);
debug!("redeem_rewards() failed for {stake_pubkey}: {redeemed:?}");
}
None
})
Expand Down
3 changes: 2 additions & 1 deletion runtime/src/bank/partitioned_epoch_rewards/distribution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ impl Bank {
else {
// We should never get here.
unreachable!(
"epoch rewards status is not in distribution phase, but we are trying to distribute rewards"
"epoch rewards status is not in distribution phase, but we are trying to \
distribute rewards"
);
};

Expand Down
2 changes: 1 addition & 1 deletion runtime/src/bank/partitioned_epoch_rewards/sysvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ impl Bank {
if let Some(account) = self.get_account(&sysvar::epoch_rewards::id()) {
let epoch_rewards: sysvar::epoch_rewards::EpochRewards =
from_account(&account).unwrap();
info!("{prefix} epoch_rewards sysvar: {:?}", epoch_rewards);
info!("{prefix} epoch_rewards sysvar: {epoch_rewards:?}");
} else {
info!("{prefix} epoch_rewards sysvar: none");
}
Expand Down
Loading
Loading