From 3261a3a457def2d72e908d1844015ff50ccb1346 Mon Sep 17 00:00:00 2001 From: Andrew Fitzgerald Date: Fri, 13 Dec 2024 12:00:15 -0600 Subject: [PATCH] check_fee_payer_unlocked: use cached compute_budget_instruction_details (#3922) --- core/src/banking_stage/consumer.rs | 17 ++++++++--------- .../unprocessed_transaction_storage.rs | 8 ++++++-- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/core/src/banking_stage/consumer.rs b/core/src/banking_stage/consumer.rs index 2c8d46d46d7cdb..7f8d7f1d4baee9 100644 --- a/core/src/banking_stage/consumer.rs +++ b/core/src/banking_stage/consumer.rs @@ -12,7 +12,6 @@ use { BankingStageStats, }, itertools::Itertools, - solana_compute_budget_instruction::instructions_processor::process_compute_budget_instructions, solana_feature_set as feature_set, solana_ledger::token_balances::collect_token_balances, solana_measure::{measure::Measure, measure_us}, @@ -39,7 +38,6 @@ use { transaction_processing_result::TransactionProcessingResultExtensions, transaction_processor::{ExecutionRecordingConfig, TransactionProcessingConfig}, }, - solana_svm_transaction::svm_message::SVMMessage, solana_timings::ExecuteTimings, std::{ num::Saturating, @@ -753,16 +751,17 @@ impl Consumer { pub fn check_fee_payer_unlocked( bank: &Bank, - message: &impl SVMMessage, + transaction: &impl TransactionWithMeta, error_counters: &mut TransactionErrorMetrics, ) -> Result<(), TransactionError> { - let fee_payer = message.fee_payer(); - let fee_budget_limits = FeeBudgetLimits::from(process_compute_budget_instructions( - message.program_instructions_iter(), - &bank.feature_set, - )?); + let fee_payer = transaction.fee_payer(); + let fee_budget_limits = FeeBudgetLimits::from( + transaction + .compute_budget_instruction_details() + .sanitize_and_convert_to_compute_budget_limits(&bank.feature_set)?, + ); let fee = solana_fee::calculate_fee( - message, + transaction, bank.get_lamports_per_signature() == 0, bank.fee_structure().lamports_per_signature, fee_budget_limits.prioritization_fee, diff --git a/core/src/banking_stage/unprocessed_transaction_storage.rs b/core/src/banking_stage/unprocessed_transaction_storage.rs index e28501c065300f..024cca9b026a5e 100644 --- a/core/src/banking_stage/unprocessed_transaction_storage.rs +++ b/core/src/banking_stage/unprocessed_transaction_storage.rs @@ -186,8 +186,12 @@ fn consume_scan_should_process_packet( // because the priority guard requires that we always take locks // except in the cases of discarding transactions (i.e. `Never`). if payload.account_locks.check_locks(message) - && Consumer::check_fee_payer_unlocked(bank, message, &mut payload.error_counters) - .is_err() + && Consumer::check_fee_payer_unlocked( + bank, + &sanitized_transaction, + &mut payload.error_counters, + ) + .is_err() { payload .message_hash_to_transaction