solana_svm/
transaction_error_metrics.rs1use std::num::Saturating;
2
3#[derive(Debug, Default)]
4pub struct TransactionErrorMetrics {
5 pub total: Saturating<usize>,
6 pub account_in_use: Saturating<usize>,
7 pub too_many_account_locks: Saturating<usize>,
8 pub account_loaded_twice: Saturating<usize>,
9 pub account_not_found: Saturating<usize>,
10 pub blockhash_not_found: Saturating<usize>,
11 pub blockhash_too_old: Saturating<usize>,
12 pub call_chain_too_deep: Saturating<usize>,
13 pub already_processed: Saturating<usize>,
14 pub instruction_error: Saturating<usize>,
15 pub insufficient_funds: Saturating<usize>,
16 pub invalid_account_for_fee: Saturating<usize>,
17 pub invalid_account_index: Saturating<usize>,
18 pub invalid_program_for_execution: Saturating<usize>,
19 pub invalid_compute_budget: Saturating<usize>,
20 pub not_allowed_during_cluster_maintenance: Saturating<usize>,
21 pub invalid_writable_account: Saturating<usize>,
22 pub invalid_rent_paying_account: Saturating<usize>,
23 pub would_exceed_max_block_cost_limit: Saturating<usize>,
24 pub would_exceed_max_account_cost_limit: Saturating<usize>,
25 pub would_exceed_max_vote_cost_limit: Saturating<usize>,
26 pub would_exceed_account_data_block_limit: Saturating<usize>,
27 pub max_loaded_accounts_data_size_exceeded: Saturating<usize>,
28 pub program_execution_temporarily_restricted: Saturating<usize>,
29}
30
31impl TransactionErrorMetrics {
32 pub fn new() -> Self {
33 Self::default()
34 }
35
36 pub fn accumulate(&mut self, other: &TransactionErrorMetrics) {
37 self.total += other.total;
38 self.account_in_use += other.account_in_use;
39 self.too_many_account_locks += other.too_many_account_locks;
40 self.account_loaded_twice += other.account_loaded_twice;
41 self.account_not_found += other.account_not_found;
42 self.blockhash_not_found += other.blockhash_not_found;
43 self.blockhash_too_old += other.blockhash_too_old;
44 self.call_chain_too_deep += other.call_chain_too_deep;
45 self.already_processed += other.already_processed;
46 self.instruction_error += other.instruction_error;
47 self.insufficient_funds += other.insufficient_funds;
48 self.invalid_account_for_fee += other.invalid_account_for_fee;
49 self.invalid_account_index += other.invalid_account_index;
50 self.invalid_program_for_execution += other.invalid_program_for_execution;
51 self.invalid_compute_budget += other.invalid_compute_budget;
52 self.not_allowed_during_cluster_maintenance += other.not_allowed_during_cluster_maintenance;
53 self.invalid_writable_account += other.invalid_writable_account;
54 self.invalid_rent_paying_account += other.invalid_rent_paying_account;
55 self.would_exceed_max_block_cost_limit += other.would_exceed_max_block_cost_limit;
56 self.would_exceed_max_account_cost_limit += other.would_exceed_max_account_cost_limit;
57 self.would_exceed_max_vote_cost_limit += other.would_exceed_max_vote_cost_limit;
58 self.would_exceed_account_data_block_limit += other.would_exceed_account_data_block_limit;
59 self.max_loaded_accounts_data_size_exceeded += other.max_loaded_accounts_data_size_exceeded;
60 self.program_execution_temporarily_restricted +=
61 other.program_execution_temporarily_restricted;
62 }
63}