Skip to content

Commit

Permalink
Rename tx counts from committed to executed (anza-xyz#1807)
Browse files Browse the repository at this point in the history
  • Loading branch information
jstarry authored and neutrinoks committed Jul 17, 2024
1 parent 2c4bc27 commit 6872f42
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 28 deletions.
10 changes: 5 additions & 5 deletions core/src/banking_stage/committer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use {
},
solana_measure::measure_us,
solana_runtime::{
bank::{Bank, CommitTransactionCounts, TransactionBalancesSet},
bank::{Bank, ExecutedTransactionCounts, TransactionBalancesSet},
bank_utils,
prioritization_fee_cache::PrioritizationFeeCache,
transaction_batch::TransactionBatch,
Expand Down Expand Up @@ -92,10 +92,10 @@ impl Committer {
execution_results,
last_blockhash,
lamports_per_signature,
CommitTransactionCounts {
committed_transactions_count: executed_transactions_count as u64,
committed_non_vote_transactions_count: executed_non_vote_transactions_count as u64,
committed_with_failure_result_count: executed_transactions_count
ExecutedTransactionCounts {
executed_transactions_count: executed_transactions_count as u64,
executed_non_vote_transactions_count: executed_non_vote_transactions_count as u64,
executed_with_failure_result_count: executed_transactions_count
.saturating_sub(executed_with_successful_result_count)
as u64,
signature_count,
Expand Down
42 changes: 19 additions & 23 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -939,10 +939,10 @@ struct PrevEpochInflationRewards {
foundation_rate: f64,
}

pub struct CommitTransactionCounts {
pub committed_transactions_count: u64,
pub committed_non_vote_transactions_count: u64,
pub committed_with_failure_result_count: u64,
pub struct ExecutedTransactionCounts {
pub executed_transactions_count: u64,
pub executed_non_vote_transactions_count: u64,
pub executed_with_failure_result_count: u64,
pub signature_count: u64,
}

Expand Down Expand Up @@ -3985,49 +3985,45 @@ impl Bank {
results
}

/// `committed_transactions_count` is the number of transactions out of `sanitized_txs`
/// that was executed. Of those, `committed_transactions_count`,
/// `committed_with_failure_result_count` is the number of executed transactions that returned
/// a failure result.
pub fn commit_transactions(
&self,
sanitized_txs: &[SanitizedTransaction],
loaded_txs: &mut [TransactionLoadResult],
execution_results: Vec<TransactionExecutionResult>,
last_blockhash: Hash,
lamports_per_signature: u64,
counts: CommitTransactionCounts,
counts: ExecutedTransactionCounts,
timings: &mut ExecuteTimings,
) -> TransactionResults {
assert!(
!self.freeze_started(),
"commit_transactions() working on a bank that is already frozen or is undergoing freezing!"
);

let CommitTransactionCounts {
committed_transactions_count,
committed_non_vote_transactions_count,
committed_with_failure_result_count,
let ExecutedTransactionCounts {
executed_transactions_count,
executed_non_vote_transactions_count,
executed_with_failure_result_count,
signature_count,
} = counts;

self.increment_transaction_count(committed_transactions_count);
self.increment_transaction_count(executed_transactions_count);
self.increment_non_vote_transaction_count_since_restart(
committed_non_vote_transactions_count,
executed_non_vote_transactions_count,
);
self.increment_signature_count(signature_count);

if committed_with_failure_result_count > 0 {
if executed_with_failure_result_count > 0 {
self.transaction_error_count
.fetch_add(committed_with_failure_result_count, Relaxed);
.fetch_add(executed_with_failure_result_count, Relaxed);
}

// Should be equivalent to checking `committed_transactions_count > 0`
// Should be equivalent to checking `executed_transactions_count > 0`
if execution_results.iter().any(|result| result.was_executed()) {
self.is_delta.store(true, Relaxed);
self.transaction_entries_count.fetch_add(1, Relaxed);
self.transactions_per_entry_max
.fetch_max(committed_transactions_count, Relaxed);
.fetch_max(executed_transactions_count, Relaxed);
}

let mut write_time = Measure::start("write_time");
Expand Down Expand Up @@ -4862,10 +4858,10 @@ impl Bank {
execution_results,
last_blockhash,
lamports_per_signature,
CommitTransactionCounts {
committed_transactions_count: executed_transactions_count as u64,
committed_non_vote_transactions_count: executed_non_vote_transactions_count as u64,
committed_with_failure_result_count: executed_transactions_count
ExecutedTransactionCounts {
executed_transactions_count: executed_transactions_count as u64,
executed_non_vote_transactions_count: executed_non_vote_transactions_count as u64,
executed_with_failure_result_count: executed_transactions_count
.saturating_sub(executed_with_successful_result_count)
as u64,
signature_count,
Expand Down

0 comments on commit 6872f42

Please sign in to comment.