diff --git a/banks-server/src/banks_server.rs b/banks-server/src/banks_server.rs index 1fcdce1ad436c5..50aa96e6695987 100644 --- a/banks-server/src/banks_server.rs +++ b/banks-server/src/banks_server.rs @@ -419,7 +419,7 @@ impl Banks for BanksServer { ) -> Option { let bank = self.bank(commitment); let sanitized_message = SanitizedMessage::try_from(message).ok()?; - bank.get_fee_for_message(&sanitized_message) + Some(bank.get_fee_for_message(&sanitized_message)) } } diff --git a/core/src/banking_stage/consumer.rs b/core/src/banking_stage/consumer.rs index d5dccca98a0fae..bb5b01504787c7 100644 --- a/core/src/banking_stage/consumer.rs +++ b/core/src/banking_stage/consumer.rs @@ -714,7 +714,6 @@ impl Consumer { process_compute_budget_instructions(message.program_instructions_iter())?.into(); let fee = bank.fee_structure.calculate_fee( message, - bank.get_lamports_per_signature(), &budget_limits, bank.feature_set.is_active( &feature_set::include_loaded_accounts_data_size_in_fee_calculation::id(), diff --git a/programs/sbf/tests/programs.rs b/programs/sbf/tests/programs.rs index 8f8f9d2ffec92d..fff14a9ac2d43c 100644 --- a/programs/sbf/tests/programs.rs +++ b/programs/sbf/tests/programs.rs @@ -16,7 +16,7 @@ use { parse_bpf_upgradeable_loader, BpfUpgradeableLoaderAccountType, }, solana_accounts_db::transaction_results::{ - DurableNonceFee, InnerInstruction, TransactionExecutionDetails, TransactionExecutionResult, + InnerInstruction, TransactionExecutionDetails, TransactionExecutionResult, TransactionResults, }, solana_ledger::token_balances::collect_token_balances, @@ -190,25 +190,13 @@ fn execute_transactions( status, log_messages, inner_instructions, - durable_nonce_fee, return_data, executed_units, .. } = details; - let lamports_per_signature = match durable_nonce_fee { - Some(DurableNonceFee::Valid(lamports_per_signature)) => { - Some(lamports_per_signature) - } - Some(DurableNonceFee::Invalid) => None, - None => bank.get_lamports_per_signature_for_blockhash( - &tx.message().recent_blockhash, - ), - } - .expect("lamports_per_signature must be available"); - let fee = bank.get_fee_for_message_with_lamports_per_signature( + let fee = bank.get_fee_for_message( &SanitizedMessage::try_from(tx.message().clone()).unwrap(), - lamports_per_signature, ); let inner_instructions = inner_instructions.map(|inner_instructions| { @@ -3985,7 +3973,6 @@ fn test_program_fees() { let sanitized_message = SanitizedMessage::try_from(message.clone()).unwrap(); let expected_normal_fee = fee_structure.calculate_fee( &sanitized_message, - congestion_multiplier, &process_compute_budget_instructions(sanitized_message.program_instructions_iter()) .unwrap_or_default() .into(), @@ -4008,7 +3995,6 @@ fn test_program_fees() { let sanitized_message = SanitizedMessage::try_from(message.clone()).unwrap(); let expected_prioritized_fee = fee_structure.calculate_fee( &sanitized_message, - congestion_multiplier, &process_compute_budget_instructions(sanitized_message.program_instructions_iter()) .unwrap_or_default() .into(), diff --git a/rpc/src/rpc.rs b/rpc/src/rpc.rs index 16d78a913bc90b..57dfa6f0abc6b2 100644 --- a/rpc/src/rpc.rs +++ b/rpc/src/rpc.rs @@ -4106,7 +4106,7 @@ pub mod rpc_full { .map_err(|err| { Error::invalid_params(format!("invalid transaction message: {err}")) })?; - let fee = bank.get_fee_for_message(&sanitized_message); + let fee = Some(bank.get_fee_for_message(&sanitized_message)); Ok(new_response(bank, fee)) } diff --git a/rpc/src/transaction_status_service.rs b/rpc/src/transaction_status_service.rs index 68640362b2182c..431cc98e16d841 100644 --- a/rpc/src/transaction_status_service.rs +++ b/rpc/src/transaction_status_service.rs @@ -2,7 +2,7 @@ use { crate::transaction_notifier_interface::TransactionNotifierArc, crossbeam_channel::{Receiver, RecvTimeoutError}, itertools::izip, - solana_accounts_db::transaction_results::{DurableNonceFee, TransactionExecutionDetails}, + solana_accounts_db::transaction_results::TransactionExecutionDetails, solana_ledger::{ blockstore::Blockstore, blockstore_processor::{TransactionStatusBatch, TransactionStatusMessage}, @@ -99,25 +99,11 @@ impl TransactionStatusService { status, log_messages, inner_instructions, - durable_nonce_fee, return_data, executed_units, .. } = details; - let lamports_per_signature = match durable_nonce_fee { - Some(DurableNonceFee::Valid(lamports_per_signature)) => { - Some(lamports_per_signature) - } - Some(DurableNonceFee::Invalid) => None, - None => bank.get_lamports_per_signature_for_blockhash( - transaction.message().recent_blockhash(), - ), - } - .expect("lamports_per_signature must be available"); - let fee = bank.get_fee_for_message_with_lamports_per_signature( - transaction.message(), - lamports_per_signature, - ); + let fee = bank.get_fee_for_message(transaction.message()); let tx_account_locks = transaction.get_account_locks_unchecked(); let inner_instructions = inner_instructions.map(|inner_instructions| { @@ -215,6 +201,7 @@ pub(crate) mod tests { solana_accounts_db::{ nonce_info::{NonceFull, NoncePartial}, rent_debits::RentDebits, + transaction_results::DurableNonceFee, }, solana_ledger::{genesis_utils::create_genesis_config, get_tmp_ledger_path_auto_delete}, solana_runtime::bank::{Bank, TransactionBalancesSet}, diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index e00b04354697cf..c11564bdf23564 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -4005,20 +4005,6 @@ impl Bank { &self.fee_rate_governor } - pub fn get_fee_for_message(&self, message: &SanitizedMessage) -> Option { - let lamports_per_signature = { - let blockhash_queue = self.blockhash_queue.read().unwrap(); - blockhash_queue.get_lamports_per_signature(message.recent_blockhash()) - } - .or_else(|| { - self.check_message_for_nonce(message) - .and_then(|(address, account)| { - NoncePartial::new(address, account).lamports_per_signature() - }) - })?; - Some(self.get_fee_for_message_with_lamports_per_signature(message, lamports_per_signature)) - } - /// Returns true when startup accounts hash verification has completed or never had to run in background. pub fn get_startup_verification_complete(&self) -> &Arc { &self @@ -4050,14 +4036,9 @@ impl Bank { .verification_complete() } - pub fn get_fee_for_message_with_lamports_per_signature( - &self, - message: &SanitizedMessage, - lamports_per_signature: u64, - ) -> u64 { + pub fn get_fee_for_message(&self, message: &SanitizedMessage) -> u64 { self.fee_structure.calculate_fee( message, - lamports_per_signature, &process_compute_budget_instructions(message.program_instructions_iter()) .unwrap_or_default() .into(), @@ -5342,7 +5323,6 @@ impl Bank { &self.ancestors, sanitized_txs, check_results, - &self.blockhash_queue.read().unwrap(), error_counters, &self.rent_collector, &self.feature_set, @@ -5529,7 +5509,7 @@ impl Bank { TransactionExecutionResult::NotExecuted(err) => Err(err.clone()), }?; - let (lamports_per_signature, is_nonce) = durable_nonce_fee + let (_lamports_per_signature, is_nonce) = durable_nonce_fee .map(|durable_nonce_fee| durable_nonce_fee.lamports_per_signature()) .map(|maybe_lamports_per_signature| (maybe_lamports_per_signature, true)) .unwrap_or_else(|| { @@ -5539,12 +5519,7 @@ impl Bank { ) }); - let lamports_per_signature = - lamports_per_signature.ok_or(TransactionError::BlockhashNotFound)?; - let fee = self.get_fee_for_message_with_lamports_per_signature( - tx.message(), - lamports_per_signature, - ); + let fee = self.get_fee_for_message(tx.message()); // In case of instruction error, even though no accounts // were stored we still need to charge the payer the diff --git a/runtime/src/bank/tests.rs b/runtime/src/bank/tests.rs index 763b8c7db42df7..f27a682d0d234b 100644 --- a/runtime/src/bank/tests.rs +++ b/runtime/src/bank/tests.rs @@ -2669,10 +2669,6 @@ fn test_bank_tx_compute_unit_fee() { let expected_fee_paid = calculate_test_fee( &SanitizedMessage::try_from(Message::new(&[], Some(&Pubkey::new_unique()))).unwrap(), - genesis_config - .fee_rate_governor - .create_fee_calculator() - .lamports_per_signature, &bank.fee_structure, ); @@ -2797,7 +2793,6 @@ fn test_bank_blockhash_fee_structure() { assert_eq!(bank.get_balance(&key), 1); let cheap_fee = calculate_test_fee( &SanitizedMessage::try_from(Message::new(&[], Some(&Pubkey::new_unique()))).unwrap(), - cheap_lamports_per_signature, &bank.fee_structure, ); assert_eq!( @@ -2813,7 +2808,6 @@ fn test_bank_blockhash_fee_structure() { assert_eq!(bank.get_balance(&key), 1); let expensive_fee = calculate_test_fee( &SanitizedMessage::try_from(Message::new(&[], Some(&Pubkey::new_unique()))).unwrap(), - expensive_lamports_per_signature, &bank.fee_structure, ); assert_eq!( @@ -2859,7 +2853,6 @@ fn test_bank_blockhash_compute_unit_fee_structure() { assert_eq!(bank.get_balance(&key), 1); let cheap_fee = calculate_test_fee( &SanitizedMessage::try_from(Message::new(&[], Some(&Pubkey::new_unique()))).unwrap(), - cheap_lamports_per_signature, &bank.fee_structure, ); assert_eq!( @@ -2875,7 +2868,6 @@ fn test_bank_blockhash_compute_unit_fee_structure() { assert_eq!(bank.get_balance(&key), 1); let expensive_fee = calculate_test_fee( &SanitizedMessage::try_from(Message::new(&[], Some(&Pubkey::new_unique()))).unwrap(), - expensive_lamports_per_signature, &bank.fee_structure, ); assert_eq!( @@ -2983,10 +2975,6 @@ fn test_filter_program_errors_and_collect_compute_unit_fee() { calculate_test_fee( &SanitizedMessage::try_from(Message::new(&[], Some(&Pubkey::new_unique()))) .unwrap(), - genesis_config - .fee_rate_governor - .create_fee_calculator() - .lamports_per_signature, &bank.fee_structure, ) * 2 ) @@ -5275,10 +5263,8 @@ fn test_nonce_transaction() { /* Check balances */ let mut recent_message = nonce_tx.message; recent_message.recent_blockhash = bank.last_blockhash(); - let mut expected_balance = 4_650_000 - - bank - .get_fee_for_message(&recent_message.try_into().unwrap()) - .unwrap(); + let mut expected_balance = + 4_650_000 - bank.get_fee_for_message(&recent_message.try_into().unwrap()); assert_eq!(bank.get_balance(&custodian_pubkey), expected_balance); assert_eq!(bank.get_balance(&nonce_pubkey), 250_000); assert_eq!(bank.get_balance(&alice_pubkey), 100_000); @@ -5335,9 +5321,8 @@ fn test_nonce_transaction() { /* Check fee charged and nonce has advanced */ let mut recent_message = nonce_tx.message.clone(); recent_message.recent_blockhash = bank.last_blockhash(); - expected_balance -= bank - .get_fee_for_message(&SanitizedMessage::try_from(recent_message).unwrap()) - .unwrap(); + expected_balance -= + bank.get_fee_for_message(&SanitizedMessage::try_from(recent_message).unwrap()); assert_eq!(bank.get_balance(&custodian_pubkey), expected_balance); assert_ne!( nonce_hash, @@ -5402,10 +5387,8 @@ fn test_nonce_transaction_with_tx_wide_caps() { /* Check balances */ let mut recent_message = nonce_tx.message; recent_message.recent_blockhash = bank.last_blockhash(); - let mut expected_balance = 4_650_000 - - bank - .get_fee_for_message(&recent_message.try_into().unwrap()) - .unwrap(); + let mut expected_balance = + 4_650_000 - bank.get_fee_for_message(&recent_message.try_into().unwrap()); assert_eq!(bank.get_balance(&custodian_pubkey), expected_balance); assert_eq!(bank.get_balance(&nonce_pubkey), 250_000); assert_eq!(bank.get_balance(&alice_pubkey), 100_000); @@ -5462,9 +5445,8 @@ fn test_nonce_transaction_with_tx_wide_caps() { /* Check fee charged and nonce has advanced */ let mut recent_message = nonce_tx.message.clone(); recent_message.recent_blockhash = bank.last_blockhash(); - expected_balance -= bank - .get_fee_for_message(&SanitizedMessage::try_from(recent_message).unwrap()) - .unwrap(); + expected_balance -= + bank.get_fee_for_message(&SanitizedMessage::try_from(recent_message).unwrap()); assert_eq!(bank.get_balance(&custodian_pubkey), expected_balance); assert_ne!( nonce_hash, @@ -5593,10 +5575,7 @@ fn test_nonce_payer() { recent_message.recent_blockhash = bank.last_blockhash(); assert_eq!( bank.get_balance(&nonce_pubkey), - nonce_starting_balance - - bank - .get_fee_for_message(&recent_message.try_into().unwrap()) - .unwrap() + nonce_starting_balance - bank.get_fee_for_message(&recent_message.try_into().unwrap()) ); assert_ne!( nonce_hash, @@ -5660,10 +5639,7 @@ fn test_nonce_payer_tx_wide_cap() { recent_message.recent_blockhash = bank.last_blockhash(); assert_eq!( bank.get_balance(&nonce_pubkey), - nonce_starting_balance - - bank - .get_fee_for_message(&recent_message.try_into().unwrap()) - .unwrap() + nonce_starting_balance - bank.get_fee_for_message(&recent_message.try_into().unwrap()) ); assert_ne!( nonce_hash, @@ -10019,16 +9995,12 @@ fn test_call_precomiled_program() { bank.process_transaction(&tx).unwrap(); } -fn calculate_test_fee( - message: &SanitizedMessage, - lamports_per_signature: u64, - fee_structure: &FeeStructure, -) -> u64 { +fn calculate_test_fee(message: &SanitizedMessage, fee_structure: &FeeStructure) -> u64 { let budget_limits = process_compute_budget_instructions(message.program_instructions_iter()) .unwrap_or_default() .into(); - fee_structure.calculate_fee(message, lamports_per_signature, &budget_limits, false) + fee_structure.calculate_fee(message, &budget_limits, false) } #[test] @@ -10039,7 +10011,6 @@ fn test_calculate_fee() { assert_eq!( calculate_test_fee( &message, - 0, &FeeStructure { lamports_per_signature: 0, ..FeeStructure::default() @@ -10052,7 +10023,6 @@ fn test_calculate_fee() { assert_eq!( calculate_test_fee( &message, - 1, &FeeStructure { lamports_per_signature: 1, ..FeeStructure::default() @@ -10070,7 +10040,6 @@ fn test_calculate_fee() { assert_eq!( calculate_test_fee( &message, - 2, &FeeStructure { lamports_per_signature: 2, ..FeeStructure::default() @@ -10094,7 +10063,7 @@ fn test_calculate_fee_compute_units() { let message = SanitizedMessage::try_from(Message::new(&[], Some(&Pubkey::new_unique()))).unwrap(); assert_eq!( - calculate_test_fee(&message, 1, &fee_structure,), + calculate_test_fee(&message, &fee_structure,), max_fee + lamports_per_signature ); @@ -10105,7 +10074,7 @@ fn test_calculate_fee_compute_units() { let message = SanitizedMessage::try_from(Message::new(&[ix0, ix1], Some(&Pubkey::new_unique()))).unwrap(); assert_eq!( - calculate_test_fee(&message, 1, &fee_structure,), + calculate_test_fee(&message, &fee_structure,), max_fee + 3 * lamports_per_signature ); @@ -10138,7 +10107,7 @@ fn test_calculate_fee_compute_units() { Some(&Pubkey::new_unique()), )) .unwrap(); - let fee = calculate_test_fee(&message, 1, &fee_structure); + let fee = calculate_test_fee(&message, &fee_structure); assert_eq!( fee, lamports_per_signature + prioritization_fee_details.get_fee() @@ -10170,11 +10139,7 @@ fn test_calculate_prioritization_fee() { )) .unwrap(); - let fee = calculate_test_fee( - &message, - fee_structure.lamports_per_signature, - &fee_structure, - ); + let fee = calculate_test_fee(&message, &fee_structure); assert_eq!( fee, fee_structure.lamports_per_signature + prioritization_fee @@ -10211,7 +10176,7 @@ fn test_calculate_fee_secp256k1() { Some(&key0), )) .unwrap(); - assert_eq!(calculate_test_fee(&message, 1, &fee_structure,), 2); + assert_eq!(calculate_test_fee(&message, &fee_structure,), 2); secp_instruction1.data = vec![0]; secp_instruction2.data = vec![10]; @@ -10220,7 +10185,7 @@ fn test_calculate_fee_secp256k1() { Some(&key0), )) .unwrap(); - assert_eq!(calculate_test_fee(&message, 1, &fee_structure,), 11); + assert_eq!(calculate_test_fee(&message, &fee_structure,), 11); } #[test] @@ -10755,7 +10720,7 @@ fn test_invalid_rent_state_changes_fee_payer() { &recent_blockhash, )) .unwrap(); - let fee = bank.get_fee_for_message(&dummy_message).unwrap(); + let fee = bank.get_fee_for_message(&dummy_message); // RentPaying fee-payer can remain RentPaying let tx = Transaction::new( @@ -10990,7 +10955,6 @@ fn test_rent_state_list_len() { &bank.ancestors, &[sanitized_tx.clone()], &[(Ok(()), None)], - &bank.blockhash_queue.read().unwrap(), &mut error_counters, &bank.rent_collector, &bank.feature_set, @@ -11939,10 +11903,6 @@ fn test_stake_account_consistency_with_rent_epoch_max_feature( #[test] fn test_calculate_fee_with_congestion_multiplier() { - let lamports_scale: u64 = 5; - let base_lamports_per_signature: u64 = 5_000; - let cheap_lamports_per_signature: u64 = base_lamports_per_signature / lamports_scale; - let expensive_lamports_per_signature: u64 = base_lamports_per_signature * lamports_scale; let signature_count: u64 = 2; let signature_fee: u64 = 10; let fee_structure = FeeStructure { @@ -11957,17 +11917,8 @@ fn test_calculate_fee_with_congestion_multiplier() { let ix1 = system_instruction::transfer(&key1, &key0, 1); let message = SanitizedMessage::try_from(Message::new(&[ix0, ix1], Some(&key0))).unwrap(); - // assert when lamports_per_signature is less than BASE_LAMPORTS, turnning on/off - // congestion_multiplier has no effect on fee. - assert_eq!( - calculate_test_fee(&message, cheap_lamports_per_signature, &fee_structure), - signature_fee * signature_count - ); - - // assert when lamports_per_signature is more than BASE_LAMPORTS, turnning on/off - // congestion_multiplier will change calculated fee. assert_eq!( - calculate_test_fee(&message, expensive_lamports_per_signature, &fee_structure,), + calculate_test_fee(&message, &fee_structure), signature_fee * signature_count ); } @@ -11976,7 +11927,6 @@ fn test_calculate_fee_with_congestion_multiplier() { fn test_calculate_fee_with_request_heap_frame_flag() { let key0 = Pubkey::new_unique(); let key1 = Pubkey::new_unique(); - let lamports_per_signature: u64 = 5_000; let signature_fee: u64 = 10; let request_cu: u64 = 1; let lamports_per_cu: u64 = 5; @@ -11998,7 +11948,7 @@ fn test_calculate_fee_with_request_heap_frame_flag() { // assert when request_heap_frame is presented in tx, prioritization fee will be counted // into transaction fee assert_eq!( - calculate_test_fee(&message, lamports_per_signature, &fee_structure), + calculate_test_fee(&message, &fee_structure), signature_fee + request_cu * lamports_per_cu ); } @@ -12126,7 +12076,7 @@ fn test_bank_verify_accounts_hash_with_base() { let transaction = SanitizedTransaction::from_transaction_for_tests( system_transaction::transfer(&key2, &key3.pubkey(), amount, blockhash), ); - bank.get_fee_for_message(transaction.message()).unwrap() + bank.get_fee_for_message(transaction.message()) }; bank.transfer(amount + fee, &mint, &key1.pubkey()).unwrap(); bank.transfer(amount + fee, &mint, &key2.pubkey()).unwrap(); diff --git a/runtime/src/bank_client.rs b/runtime/src/bank_client.rs index 7fe6418d4110b2..cc0358c0d8782c 100644 --- a/runtime/src/bank_client.rs +++ b/runtime/src/bank_client.rs @@ -288,7 +288,7 @@ impl SyncClient for BankClient { fn get_fee_for_message(&self, message: &Message) -> Result { SanitizedMessage::try_from(message.clone()) .ok() - .and_then(|sanitized_message| self.bank.get_fee_for_message(&sanitized_message)) + .map(|sanitized_message| self.bank.get_fee_for_message(&sanitized_message)) .ok_or_else(|| { TransportError::IoError(io::Error::new( io::ErrorKind::Other, diff --git a/runtime/src/snapshot_bank_utils.rs b/runtime/src/snapshot_bank_utils.rs index 5494eb1beb716c..15deab8f666233 100644 --- a/runtime/src/snapshot_bank_utils.rs +++ b/runtime/src/snapshot_bank_utils.rs @@ -1816,7 +1816,7 @@ mod tests { lamports_to_transfer, blockhash, )); - let fee = bank2.get_fee_for_message(tx.message()).unwrap(); + let fee = bank2.get_fee_for_message(tx.message()); let tx = system_transaction::transfer( &key1, &key2.pubkey(), @@ -2184,7 +2184,7 @@ mod tests { let transaction = SanitizedTransaction::from_transaction_for_tests( system_transaction::transfer(&key2, &key3.pubkey(), amount, blockhash), ); - bank.get_fee_for_message(transaction.message()).unwrap() + bank.get_fee_for_message(transaction.message()) }; bank.transfer(amount + fee, mint, &key1.pubkey()).unwrap(); bank.transfer(amount + fee, mint, &key2.pubkey()).unwrap(); diff --git a/runtime/src/svm/account_loader.rs b/runtime/src/svm/account_loader.rs index 8fa432db1556dc..4c314b3c360248 100644 --- a/runtime/src/svm/account_loader.rs +++ b/runtime/src/svm/account_loader.rs @@ -7,8 +7,7 @@ use { accounts::{LoadedTransaction, TransactionLoadResult, TransactionRent}, accounts_db::AccountsDb, ancestors::Ancestors, - blockhash_queue::BlockhashQueue, - nonce_info::{NonceFull, NonceInfo}, + nonce_info::NonceFull, rent_collector::{RentCollector, RENT_EXEMPT_RENT_EPOCH}, rent_debits::RentDebits, transaction_error_metrics::TransactionErrorMetrics, @@ -45,7 +44,6 @@ pub(crate) fn load_accounts( ancestors: &Ancestors, txs: &[SanitizedTransaction], lock_results: &[TransactionCheckResult], - hash_queue: &BlockhashQueue, error_counters: &mut TransactionErrorMetrics, rent_collector: &RentCollector, feature_set: &FeatureSet, @@ -60,27 +58,14 @@ pub(crate) fn load_accounts( .zip(lock_results) .map(|etx| match etx { (tx, (Ok(()), nonce)) => { - let lamports_per_signature = nonce - .as_ref() - .map(|nonce| nonce.lamports_per_signature()) - .unwrap_or_else(|| { - hash_queue.get_lamports_per_signature(tx.message().recent_blockhash()) - }); - let fee = if let Some(lamports_per_signature) = lamports_per_signature { - fee_structure.calculate_fee( - tx.message(), - lamports_per_signature, - &process_compute_budget_instructions( - tx.message().program_instructions_iter(), - ) + let fee = fee_structure.calculate_fee( + tx.message(), + &process_compute_budget_instructions(tx.message().program_instructions_iter()) .unwrap_or_default() .into(), - feature_set - .is_active(&include_loaded_accounts_data_size_in_fee_calculation::id()), - ) - } else { - return (Err(TransactionError::BlockhashNotFound), None); - }; + feature_set + .is_active(&include_loaded_accounts_data_size_in_fee_calculation::id()), + ); // load transactions let loaded_transaction = match load_transaction_accounts( @@ -519,14 +504,11 @@ mod tests { fn load_accounts_with_fee_and_rent( tx: Transaction, ka: &[TransactionAccount], - lamports_per_signature: u64, rent_collector: &RentCollector, error_counters: &mut TransactionErrorMetrics, feature_set: &FeatureSet, fee_structure: &FeeStructure, ) -> Vec { - let mut hash_queue = BlockhashQueue::new(100); - hash_queue.register_hash(&tx.message().recent_blockhash, lamports_per_signature); let accounts_db = AccountsDb::new_single_for_tests(); let accounts = Accounts::new(Arc::new(accounts_db)); for ka in ka.iter() { @@ -540,7 +522,6 @@ mod tests { &ancestors, &[sanitized_tx], &[(Ok(()), None)], - &hash_queue, error_counters, rent_collector, feature_set, @@ -573,7 +554,6 @@ mod tests { load_accounts_with_fee_and_rent( tx, ka, - lamports_per_signature, &RentCollector::default(), error_counters, &all_features_except(exclude_features), @@ -685,7 +665,6 @@ mod tests { let message = SanitizedMessage::try_from(tx.message().clone()).unwrap(); let fee = FeeStructure::default().calculate_fee( &message, - lamports_per_signature, &process_compute_budget_instructions(message.program_instructions_iter()) .unwrap_or_default() .into(), @@ -776,7 +755,6 @@ mod tests { let loaded_accounts = load_accounts_with_fee_and_rent( tx.clone(), &accounts, - lamports_per_signature, &rent_collector, &mut error_counters, &all_features_except(None), @@ -792,7 +770,6 @@ mod tests { let loaded_accounts = load_accounts_with_fee_and_rent( tx.clone(), &accounts, - lamports_per_signature, &rent_collector, &mut error_counters, &FeatureSet::all_enabled(), @@ -809,7 +786,6 @@ mod tests { let loaded_accounts = load_accounts_with_fee_and_rent( tx, &accounts, - lamports_per_signature, &rent_collector, &mut error_counters, &FeatureSet::all_enabled(), @@ -1008,8 +984,6 @@ mod tests { ) -> Vec { let tx = SanitizedTransaction::from_transaction_for_tests(tx); let rent_collector = RentCollector::default(); - let mut hash_queue = BlockhashQueue::new(100); - hash_queue.register_hash(tx.message().recent_blockhash(), 10); let ancestors = vec![(0, 0)].into_iter().collect(); let mut error_counters = TransactionErrorMetrics::default(); @@ -1018,7 +992,6 @@ mod tests { &ancestors, &[tx], &[(Ok(()), None)], - &hash_queue, &mut error_counters, &rent_collector, &FeatureSet::all_enabled(), @@ -1219,7 +1192,6 @@ mod tests { let message = SanitizedMessage::try_from(tx.message().clone()).unwrap(); let fee = FeeStructure::default().calculate_fee( &message, - lamports_per_signature, &process_compute_budget_instructions(message.program_instructions_iter()) .unwrap_or_default() .into(), diff --git a/sdk/src/fee.rs b/sdk/src/fee.rs index 2fb045aba5d73e..2ba1445a63614e 100644 --- a/sdk/src/fee.rs +++ b/sdk/src/fee.rs @@ -80,7 +80,6 @@ impl FeeStructure { pub fn calculate_fee( &self, message: &SanitizedMessage, - _lamports_per_signature: u64, budget_limits: &FeeBudgetLimits, include_loaded_account_data_size_in_fee: bool, ) -> u64 {