From 695b3f4a8e54eac6683e0abf4c3299032448fe14 Mon Sep 17 00:00:00 2001 From: roryharr Date: Wed, 11 Dec 2024 11:41:10 -0800 Subject: [PATCH] Removing saturating_add_assign and replacing with Saturating struct (#4029) --- core/src/banking_stage/consume_worker.rs | 51 +++---- core/src/banking_stage/leader_slot_metrics.rs | 52 +++---- runtime/src/bank.rs | 2 +- .../json-rpc/server/src/rpc_process.rs | 2 +- svm/src/account_loader.rs | 31 +++-- svm/src/transaction_error_metrics.rs | 129 +++++++----------- svm/src/transaction_processor.rs | 12 +- 7 files changed, 128 insertions(+), 151 deletions(-) diff --git a/core/src/banking_stage/consume_worker.rs b/core/src/banking_stage/consume_worker.rs index 815c51b9b6b253..cdb2ad2ea2ceed 100644 --- a/core/src/banking_stage/consume_worker.rs +++ b/core/src/banking_stage/consume_worker.rs @@ -357,76 +357,79 @@ impl ConsumeWorkerMetrics { ) { self.error_metrics .total - .fetch_add(*total, Ordering::Relaxed); + .fetch_add(total.0, Ordering::Relaxed); self.error_metrics .account_in_use - .fetch_add(*account_in_use, Ordering::Relaxed); + .fetch_add(account_in_use.0, Ordering::Relaxed); self.error_metrics .too_many_account_locks - .fetch_add(*too_many_account_locks, Ordering::Relaxed); + .fetch_add(too_many_account_locks.0, Ordering::Relaxed); self.error_metrics .account_loaded_twice - .fetch_add(*account_loaded_twice, Ordering::Relaxed); + .fetch_add(account_loaded_twice.0, Ordering::Relaxed); self.error_metrics .account_not_found - .fetch_add(*account_not_found, Ordering::Relaxed); + .fetch_add(account_not_found.0, Ordering::Relaxed); self.error_metrics .blockhash_not_found - .fetch_add(*blockhash_not_found, Ordering::Relaxed); + .fetch_add(blockhash_not_found.0, Ordering::Relaxed); self.error_metrics .blockhash_too_old - .fetch_add(*blockhash_too_old, Ordering::Relaxed); + .fetch_add(blockhash_too_old.0, Ordering::Relaxed); self.error_metrics .call_chain_too_deep - .fetch_add(*call_chain_too_deep, Ordering::Relaxed); + .fetch_add(call_chain_too_deep.0, Ordering::Relaxed); self.error_metrics .already_processed - .fetch_add(*already_processed, Ordering::Relaxed); + .fetch_add(already_processed.0, Ordering::Relaxed); self.error_metrics .instruction_error - .fetch_add(*instruction_error, Ordering::Relaxed); + .fetch_add(instruction_error.0, Ordering::Relaxed); self.error_metrics .insufficient_funds - .fetch_add(*insufficient_funds, Ordering::Relaxed); + .fetch_add(insufficient_funds.0, Ordering::Relaxed); self.error_metrics .invalid_account_for_fee - .fetch_add(*invalid_account_for_fee, Ordering::Relaxed); + .fetch_add(invalid_account_for_fee.0, Ordering::Relaxed); self.error_metrics .invalid_account_index - .fetch_add(*invalid_account_index, Ordering::Relaxed); + .fetch_add(invalid_account_index.0, Ordering::Relaxed); self.error_metrics .invalid_program_for_execution - .fetch_add(*invalid_program_for_execution, Ordering::Relaxed); + .fetch_add(invalid_program_for_execution.0, Ordering::Relaxed); self.error_metrics .invalid_compute_budget - .fetch_add(*invalid_compute_budget, Ordering::Relaxed); + .fetch_add(invalid_compute_budget.0, Ordering::Relaxed); self.error_metrics .not_allowed_during_cluster_maintenance - .fetch_add(*not_allowed_during_cluster_maintenance, Ordering::Relaxed); + .fetch_add(not_allowed_during_cluster_maintenance.0, Ordering::Relaxed); self.error_metrics .invalid_writable_account - .fetch_add(*invalid_writable_account, Ordering::Relaxed); + .fetch_add(invalid_writable_account.0, Ordering::Relaxed); self.error_metrics .invalid_rent_paying_account - .fetch_add(*invalid_rent_paying_account, Ordering::Relaxed); + .fetch_add(invalid_rent_paying_account.0, Ordering::Relaxed); self.error_metrics .would_exceed_max_block_cost_limit - .fetch_add(*would_exceed_max_block_cost_limit, Ordering::Relaxed); + .fetch_add(would_exceed_max_block_cost_limit.0, Ordering::Relaxed); self.error_metrics .would_exceed_max_account_cost_limit - .fetch_add(*would_exceed_max_account_cost_limit, Ordering::Relaxed); + .fetch_add(would_exceed_max_account_cost_limit.0, Ordering::Relaxed); self.error_metrics .would_exceed_max_vote_cost_limit - .fetch_add(*would_exceed_max_vote_cost_limit, Ordering::Relaxed); + .fetch_add(would_exceed_max_vote_cost_limit.0, Ordering::Relaxed); self.error_metrics .would_exceed_account_data_block_limit - .fetch_add(*would_exceed_account_data_block_limit, Ordering::Relaxed); + .fetch_add(would_exceed_account_data_block_limit.0, Ordering::Relaxed); self.error_metrics .max_loaded_accounts_data_size_exceeded - .fetch_add(*max_loaded_accounts_data_size_exceeded, Ordering::Relaxed); + .fetch_add(max_loaded_accounts_data_size_exceeded.0, Ordering::Relaxed); self.error_metrics .program_execution_temporarily_restricted - .fetch_add(*program_execution_temporarily_restricted, Ordering::Relaxed); + .fetch_add( + program_execution_temporarily_restricted.0, + Ordering::Relaxed, + ); } } diff --git a/core/src/banking_stage/leader_slot_metrics.rs b/core/src/banking_stage/leader_slot_metrics.rs index ce232a370b2a5f..be491b2c697cb7 100644 --- a/core/src/banking_stage/leader_slot_metrics.rs +++ b/core/src/banking_stage/leader_slot_metrics.rs @@ -403,88 +403,88 @@ fn report_transaction_error_metrics(errors: &TransactionErrorMetrics, id: &str, "banking_stage-leader_slot_transaction_errors", "id" => id, ("slot", slot as i64, i64), - ("total", errors.total as i64, i64), - ("account_in_use", errors.account_in_use as i64, i64), + ("total", errors.total.0 as i64, i64), + ("account_in_use", errors.account_in_use.0 as i64, i64), ( "too_many_account_locks", - errors.too_many_account_locks as i64, + errors.too_many_account_locks.0 as i64, i64 ), ( "account_loaded_twice", - errors.account_loaded_twice as i64, + errors.account_loaded_twice.0 as i64, i64 ), - ("account_not_found", errors.account_not_found as i64, i64), - ("blockhash_not_found", errors.blockhash_not_found as i64, i64), - ("blockhash_too_old", errors.blockhash_too_old as i64, i64), - ("call_chain_too_deep", errors.call_chain_too_deep as i64, i64), - ("already_processed", errors.already_processed as i64, i64), - ("instruction_error", errors.instruction_error as i64, i64), - ("insufficient_funds", errors.insufficient_funds as i64, i64), + ("account_not_found", errors.account_not_found.0 as i64, i64), + ("blockhash_not_found", errors.blockhash_not_found.0 as i64, i64), + ("blockhash_too_old", errors.blockhash_too_old.0 as i64, i64), + ("call_chain_too_deep", errors.call_chain_too_deep.0 as i64, i64), + ("already_processed", errors.already_processed.0 as i64, i64), + ("instruction_error", errors.instruction_error.0 as i64, i64), + ("insufficient_funds", errors.insufficient_funds.0 as i64, i64), ( "invalid_account_for_fee", - errors.invalid_account_for_fee as i64, + errors.invalid_account_for_fee.0 as i64, i64 ), ( "invalid_account_index", - errors.invalid_account_index as i64, + errors.invalid_account_index.0 as i64, i64 ), ( "invalid_program_for_execution", - errors.invalid_program_for_execution as i64, + errors.invalid_program_for_execution.0 as i64, i64 ), ( "invalid_compute_budget", - errors.invalid_compute_budget as i64, + errors.invalid_compute_budget.0 as i64, i64 ), ( "not_allowed_during_cluster_maintenance", - errors.not_allowed_during_cluster_maintenance as i64, + errors.not_allowed_during_cluster_maintenance.0 as i64, i64 ), ( "invalid_writable_account", - errors.invalid_writable_account as i64, + errors.invalid_writable_account.0 as i64, i64 ), ( "invalid_rent_paying_account", - errors.invalid_rent_paying_account as i64, + errors.invalid_rent_paying_account.0 as i64, i64 ), ( "would_exceed_max_block_cost_limit", - errors.would_exceed_max_block_cost_limit as i64, + errors.would_exceed_max_block_cost_limit.0 as i64, i64 ), ( "would_exceed_max_account_cost_limit", - errors.would_exceed_max_account_cost_limit as i64, + errors.would_exceed_max_account_cost_limit.0 as i64, i64 ), ( "would_exceed_max_vote_cost_limit", - errors.would_exceed_max_vote_cost_limit as i64, + errors.would_exceed_max_vote_cost_limit.0 as i64, i64 ), ( "would_exceed_account_data_block_limit", - errors.would_exceed_account_data_block_limit as i64, + errors.would_exceed_account_data_block_limit.0 as i64, i64 ), ( "max_loaded_accounts_data_size_exceeded", - errors.max_loaded_accounts_data_size_exceeded as i64, + errors.max_loaded_accounts_data_size_exceeded.0 as i64, i64 ), ( "program_execution_temporarily_restricted", - errors.program_execution_temporarily_restricted as i64, + errors.program_execution_temporarily_restricted.0 as i64, i64 ), ); @@ -745,14 +745,14 @@ impl LeaderSlotMetricsTracker { leader_slot_metrics .packet_count_metrics .account_lock_throttled_transactions_count, - error_counters.account_in_use as u64 + error_counters.account_in_use.0 as u64 ); saturating_add_assign!( leader_slot_metrics .packet_count_metrics .account_locks_limit_throttled_transactions_count, - error_counters.too_many_account_locks as u64 + error_counters.too_many_account_locks.0 as u64 ); saturating_add_assign!( diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 10db11e0b09937..4c892a8c33412f 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -3954,7 +3954,7 @@ impl Bank { processed_counts.processed_with_successful_result_count += 1; } Err(err) => { - if *err_count == 0 { + if err_count.0 == 0 { debug!("tx error: {:?} {:?}", err, tx); } *err_count += 1; diff --git a/svm/examples/json-rpc/server/src/rpc_process.rs b/svm/examples/json-rpc/server/src/rpc_process.rs index 280496f0903225..c73b1b1f44e265 100644 --- a/svm/examples/json-rpc/server/src/rpc_process.rs +++ b/svm/examples/json-rpc/server/src/rpc_process.rs @@ -582,7 +582,7 @@ impl JsonRpcRequestProcessor { processed_counts.processed_with_successful_result_count += 1; } Err(err) => { - if *err_count == 0 { + if err_count.0 == 0 { debug!("tx error: {:?} {:?}", err, tx); } *err_count += 1; diff --git a/svm/src/account_loader.rs b/svm/src/account_loader.rs index bff6b406e9fa20..895db94f3b111f 100644 --- a/svm/src/account_loader.rs +++ b/svm/src/account_loader.rs @@ -20,7 +20,6 @@ use { rent::RentDue, rent_collector::{CollectedInfo, RENT_EXEMPT_RENT_EPOCH}, rent_debits::RentDebits, - saturating_add_assign, sysvar::{ self, instructions::{construct_instructions_data, BorrowedAccountMeta, BorrowedInstruction}, @@ -32,7 +31,11 @@ use { solana_svm_rent_collector::svm_rent_collector::SVMRentCollector, solana_svm_transaction::svm_message::SVMMessage, solana_system_program::{get_system_account_kind, SystemAccountKind}, - std::{collections::HashMap, num::NonZeroU32, sync::Arc}, + std::{ + collections::HashMap, + num::{NonZeroU32, Saturating}, + sync::Arc, + }, }; // for the load instructions @@ -431,7 +434,7 @@ fn load_transaction_accounts( let mut accounts = Vec::with_capacity(account_keys.len()); let mut validated_loaders = AHashSet::with_capacity(PROGRAM_OWNERS.len()); let mut rent_debits = RentDebits::default(); - let mut accumulated_accounts_data_size: u32 = 0; + let mut accumulated_accounts_data_size: Saturating = Saturating(0); let mut collect_loaded_account = |key, loaded_account| -> Result<()> { let LoadedTransactionAccount { @@ -564,7 +567,7 @@ fn load_transaction_accounts( program_indices, rent: tx_rent, rent_debits, - loaded_accounts_data_size: accumulated_accounts_data_size, + loaded_accounts_data_size: accumulated_accounts_data_size.0, }) } @@ -637,7 +640,7 @@ fn account_shared_data_from_program( /// `accumulated_accounts_data_size` exceeds /// `requested_loaded_accounts_data_size_limit`. fn accumulate_and_check_loaded_account_data_size( - accumulated_loaded_accounts_data_size: &mut u32, + accumulated_loaded_accounts_data_size: &mut Saturating, account_data_size: usize, requested_loaded_accounts_data_size_limit: NonZeroU32, error_metrics: &mut TransactionErrorMetrics, @@ -646,8 +649,8 @@ fn accumulate_and_check_loaded_account_data_size( error_metrics.max_loaded_accounts_data_size_exceeded += 1; return Err(TransactionError::MaxLoadedAccountsDataSizeExceeded); }; - saturating_add_assign!(*accumulated_loaded_accounts_data_size, account_data_size); - if *accumulated_loaded_accounts_data_size > requested_loaded_accounts_data_size_limit.get() { + *accumulated_loaded_accounts_data_size += account_data_size; + if accumulated_loaded_accounts_data_size.0 > requested_loaded_accounts_data_size_limit.get() { error_metrics.max_loaded_accounts_data_size_exceeded += 1; Err(TransactionError::MaxLoadedAccountsDataSizeExceeded) } else { @@ -906,7 +909,7 @@ mod tests { let load_results = load_accounts_aux_test(tx, &accounts, &mut error_metrics); - assert_eq!(error_metrics.account_not_found, 1); + assert_eq!(error_metrics.account_not_found.0, 1); assert!(matches!( load_results, TransactionLoadResult::FeesOnly(FeesOnlyTransaction { @@ -945,7 +948,7 @@ mod tests { let loaded_accounts = load_accounts_with_excluded_features(tx, &accounts, &mut error_metrics, None); - assert_eq!(error_metrics.account_not_found, 0); + assert_eq!(error_metrics.account_not_found.0, 0); match &loaded_accounts { TransactionLoadResult::Loaded(loaded_transaction) => { assert_eq!(loaded_transaction.accounts.len(), 3); @@ -986,7 +989,7 @@ mod tests { let load_results = load_accounts_aux_test(tx, &accounts, &mut error_metrics); - assert_eq!(error_metrics.account_not_found, 1); + assert_eq!(error_metrics.account_not_found.0, 1); assert!(matches!( load_results, TransactionLoadResult::FeesOnly(FeesOnlyTransaction { @@ -1030,7 +1033,7 @@ mod tests { &mut feature_set, ); - assert_eq!(error_metrics.invalid_program_for_execution, 1); + assert_eq!(error_metrics.invalid_program_for_execution.0, 1); assert!(matches!( load_results, TransactionLoadResult::FeesOnly(FeesOnlyTransaction { @@ -1081,7 +1084,7 @@ mod tests { let loaded_accounts = load_accounts_with_excluded_features(tx, &accounts, &mut error_metrics, None); - assert_eq!(error_metrics.account_not_found, 0); + assert_eq!(error_metrics.account_not_found.0, 0); match &loaded_accounts { TransactionLoadResult::Loaded(loaded_transaction) => { assert_eq!(loaded_transaction.accounts.len(), 3); @@ -1188,7 +1191,7 @@ mod tests { #[test] fn test_accumulate_and_check_loaded_account_data_size() { let mut error_metrics = TransactionErrorMetrics::default(); - let mut accumulated_data_size: u32 = 0; + let mut accumulated_data_size: Saturating = Saturating(0); let data_size: usize = 123; let requested_data_size_limit = NonZeroU32::new(data_size as u32).unwrap(); @@ -1200,7 +1203,7 @@ mod tests { &mut error_metrics ) .is_ok()); - assert_eq!(data_size as u32, accumulated_data_size); + assert_eq!(data_size as u32, accumulated_data_size.0); // fail - loading more data that would exceed limit let another_byte: usize = 1; diff --git a/svm/src/transaction_error_metrics.rs b/svm/src/transaction_error_metrics.rs index 5b3ec2b7e53d1d..8f345390bbd63d 100644 --- a/svm/src/transaction_error_metrics.rs +++ b/svm/src/transaction_error_metrics.rs @@ -1,31 +1,31 @@ -use solana_sdk::saturating_add_assign; +use std::num::Saturating; #[derive(Debug, Default)] pub struct TransactionErrorMetrics { - pub total: usize, - pub account_in_use: usize, - pub too_many_account_locks: usize, - pub account_loaded_twice: usize, - pub account_not_found: usize, - pub blockhash_not_found: usize, - pub blockhash_too_old: usize, - pub call_chain_too_deep: usize, - pub already_processed: usize, - pub instruction_error: usize, - pub insufficient_funds: usize, - pub invalid_account_for_fee: usize, - pub invalid_account_index: usize, - pub invalid_program_for_execution: usize, - pub invalid_compute_budget: usize, - pub not_allowed_during_cluster_maintenance: usize, - pub invalid_writable_account: usize, - pub invalid_rent_paying_account: usize, - pub would_exceed_max_block_cost_limit: usize, - pub would_exceed_max_account_cost_limit: usize, - pub would_exceed_max_vote_cost_limit: usize, - pub would_exceed_account_data_block_limit: usize, - pub max_loaded_accounts_data_size_exceeded: usize, - pub program_execution_temporarily_restricted: usize, + pub total: Saturating, + pub account_in_use: Saturating, + pub too_many_account_locks: Saturating, + pub account_loaded_twice: Saturating, + pub account_not_found: Saturating, + pub blockhash_not_found: Saturating, + pub blockhash_too_old: Saturating, + pub call_chain_too_deep: Saturating, + pub already_processed: Saturating, + pub instruction_error: Saturating, + pub insufficient_funds: Saturating, + pub invalid_account_for_fee: Saturating, + pub invalid_account_index: Saturating, + pub invalid_program_for_execution: Saturating, + pub invalid_compute_budget: Saturating, + pub not_allowed_during_cluster_maintenance: Saturating, + pub invalid_writable_account: Saturating, + pub invalid_rent_paying_account: Saturating, + pub would_exceed_max_block_cost_limit: Saturating, + pub would_exceed_max_account_cost_limit: Saturating, + pub would_exceed_max_vote_cost_limit: Saturating, + pub would_exceed_account_data_block_limit: Saturating, + pub max_loaded_accounts_data_size_exceeded: Saturating, + pub program_execution_temporarily_restricted: Saturating, } impl TransactionErrorMetrics { @@ -34,59 +34,30 @@ impl TransactionErrorMetrics { } pub fn accumulate(&mut self, other: &TransactionErrorMetrics) { - saturating_add_assign!(self.total, other.total); - saturating_add_assign!(self.account_in_use, other.account_in_use); - saturating_add_assign!(self.too_many_account_locks, other.too_many_account_locks); - saturating_add_assign!(self.account_loaded_twice, other.account_loaded_twice); - saturating_add_assign!(self.account_not_found, other.account_not_found); - saturating_add_assign!(self.blockhash_not_found, other.blockhash_not_found); - saturating_add_assign!(self.blockhash_too_old, other.blockhash_too_old); - saturating_add_assign!(self.call_chain_too_deep, other.call_chain_too_deep); - saturating_add_assign!(self.already_processed, other.already_processed); - saturating_add_assign!(self.instruction_error, other.instruction_error); - saturating_add_assign!(self.insufficient_funds, other.insufficient_funds); - saturating_add_assign!(self.invalid_account_for_fee, other.invalid_account_for_fee); - saturating_add_assign!(self.invalid_account_index, other.invalid_account_index); - saturating_add_assign!( - self.invalid_program_for_execution, - other.invalid_program_for_execution - ); - saturating_add_assign!(self.invalid_compute_budget, other.invalid_compute_budget); - saturating_add_assign!( - self.not_allowed_during_cluster_maintenance, - other.not_allowed_during_cluster_maintenance - ); - saturating_add_assign!( - self.invalid_writable_account, - other.invalid_writable_account - ); - saturating_add_assign!( - self.invalid_rent_paying_account, - other.invalid_rent_paying_account - ); - saturating_add_assign!( - self.would_exceed_max_block_cost_limit, - other.would_exceed_max_block_cost_limit - ); - saturating_add_assign!( - self.would_exceed_max_account_cost_limit, - other.would_exceed_max_account_cost_limit - ); - saturating_add_assign!( - self.would_exceed_max_vote_cost_limit, - other.would_exceed_max_vote_cost_limit - ); - saturating_add_assign!( - self.would_exceed_account_data_block_limit, - other.would_exceed_account_data_block_limit - ); - saturating_add_assign!( - self.max_loaded_accounts_data_size_exceeded, - other.max_loaded_accounts_data_size_exceeded - ); - saturating_add_assign!( - self.program_execution_temporarily_restricted, - other.program_execution_temporarily_restricted - ); + self.total += other.total; + self.account_in_use += other.account_in_use; + self.too_many_account_locks += other.too_many_account_locks; + self.account_loaded_twice += other.account_loaded_twice; + self.account_not_found += other.account_not_found; + self.blockhash_not_found += other.blockhash_not_found; + self.blockhash_too_old += other.blockhash_too_old; + self.call_chain_too_deep += other.call_chain_too_deep; + self.already_processed += other.already_processed; + self.instruction_error += other.instruction_error; + self.insufficient_funds += other.insufficient_funds; + self.invalid_account_for_fee += other.invalid_account_for_fee; + self.invalid_account_index += other.invalid_account_index; + self.invalid_program_for_execution += other.invalid_program_for_execution; + self.invalid_compute_budget += other.invalid_compute_budget; + self.not_allowed_during_cluster_maintenance += other.not_allowed_during_cluster_maintenance; + self.invalid_writable_account += other.invalid_writable_account; + self.invalid_rent_paying_account += other.invalid_rent_paying_account; + self.would_exceed_max_block_cost_limit += other.would_exceed_max_block_cost_limit; + self.would_exceed_max_account_cost_limit += other.would_exceed_max_account_cost_limit; + self.would_exceed_max_vote_cost_limit += other.would_exceed_max_vote_cost_limit; + self.would_exceed_account_data_block_limit += other.would_exceed_account_data_block_limit; + self.max_loaded_accounts_data_size_exceeded += other.max_loaded_accounts_data_size_exceeded; + self.program_execution_temporarily_restricted += + other.program_execution_temporarily_restricted; } } diff --git a/svm/src/transaction_processor.rs b/svm/src/transaction_processor.rs index 21245436503456..e252710ec60499 100644 --- a/svm/src/transaction_processor.rs +++ b/svm/src/transaction_processor.rs @@ -1560,7 +1560,7 @@ mod tests { &processing_config, ); - assert_eq!(error_metrics.instruction_error, 1); + assert_eq!(error_metrics.instruction_error.0, 1); } #[test] @@ -2311,7 +2311,7 @@ mod tests { &mut error_counters, ); - assert_eq!(error_counters.account_not_found, 1); + assert_eq!(error_counters.account_not_found.0, 1); assert_eq!(result, Err(TransactionError::AccountNotFound)); } @@ -2345,7 +2345,7 @@ mod tests { &mut error_counters, ); - assert_eq!(error_counters.insufficient_funds, 1); + assert_eq!(error_counters.insufficient_funds.0, 1); assert_eq!(result, Err(TransactionError::InsufficientFundsForFee)); } @@ -2419,7 +2419,7 @@ mod tests { &mut error_counters, ); - assert_eq!(error_counters.invalid_account_for_fee, 1); + assert_eq!(error_counters.invalid_account_for_fee.0, 1); assert_eq!(result, Err(TransactionError::InvalidAccountForFee)); } @@ -2451,7 +2451,7 @@ mod tests { &mut error_counters, ); - assert_eq!(error_counters.invalid_compute_budget, 1); + assert_eq!(error_counters.invalid_compute_budget.0, 1); assert_eq!(result, Err(TransactionError::DuplicateInstruction(1u8))); } @@ -2585,7 +2585,7 @@ mod tests { &mut error_counters, ); - assert_eq!(error_counters.insufficient_funds, 1); + assert_eq!(error_counters.insufficient_funds.0, 1); assert_eq!(result, Err(TransactionError::InsufficientFundsForFee)); } }