Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename tx counts from committed to executed #1807

Merged
merged 1 commit into from
Jun 20, 2024
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
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 @@ -937,10 +937,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 @@ -3983,49 +3983,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 @@ -4860,10 +4856,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