Skip to content

Commit

Permalink
check_fee_payer_unlocked: use cached compute_budget_instruction_detai…
Browse files Browse the repository at this point in the history
…ls (#3922)
  • Loading branch information
apfitzge authored Dec 13, 2024
1 parent 7a0f7b1 commit 3261a3a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
17 changes: 8 additions & 9 deletions core/src/banking_stage/consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 6 additions & 2 deletions core/src/banking_stage/unprocessed_transaction_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3261a3a

Please sign in to comment.