diff --git a/svm/src/transaction_processor.rs b/svm/src/transaction_processor.rs index 9c97bf38085342..b41d29d7dce6eb 100644 --- a/svm/src/transaction_processor.rs +++ b/svm/src/transaction_processor.rs @@ -151,9 +151,6 @@ pub struct TransactionBatchProcessor { /// initialized from genesis pub epoch_schedule: EpochSchedule, - /// Transaction fee structure - pub fee_structure: FeeStructure, - /// SysvarCache is a collection of system variables that are /// accessible from on chain programs. It is passed to SVM from /// client code (e.g. Bank) and forwarded to the MessageProcessor. @@ -172,7 +169,6 @@ impl Debug for TransactionBatchProcessor { .field("slot", &self.slot) .field("epoch", &self.epoch) .field("epoch_schedule", &self.epoch_schedule) - .field("fee_structure", &self.fee_structure) .field("sysvar_cache", &self.sysvar_cache) .field("program_cache", &self.program_cache) .finish() @@ -185,7 +181,6 @@ impl Default for TransactionBatchProcessor { slot: Slot::default(), epoch: Epoch::default(), epoch_schedule: EpochSchedule::default(), - fee_structure: FeeStructure::default(), sysvar_cache: RwLock::::default(), program_cache: Arc::new(RwLock::new(ProgramCache::new( Slot::default(), @@ -207,7 +202,6 @@ impl TransactionBatchProcessor { slot, epoch, epoch_schedule, - fee_structure: FeeStructure::default(), sysvar_cache: RwLock::::default(), program_cache: Arc::new(RwLock::new(ProgramCache::new(slot, epoch))), builtin_program_ids: RwLock::new(builtin_program_ids), @@ -219,7 +213,6 @@ impl TransactionBatchProcessor { slot, epoch, epoch_schedule: self.epoch_schedule.clone(), - fee_structure: self.fee_structure.clone(), sysvar_cache: RwLock::::default(), program_cache: self.program_cache.clone(), builtin_program_ids: RwLock::new(self.builtin_program_ids.read().unwrap().clone()), @@ -254,6 +247,9 @@ impl TransactionBatchProcessor { sanitized_txs, check_results, &environment.feature_set, + environment + .fee_structure + .unwrap_or(&FeeStructure::default()), environment .rent_collector .unwrap_or(&RentCollector::default()), @@ -417,6 +413,7 @@ impl TransactionBatchProcessor { sanitized_txs: &[impl core::borrow::Borrow], check_results: Vec, feature_set: &FeatureSet, + fee_structure: &FeeStructure, rent_collector: &RentCollector, error_counters: &mut TransactionErrorMetrics, ) -> Vec { @@ -435,6 +432,7 @@ impl TransactionBatchProcessor { callbacks, message, feature_set, + fee_structure, lamports_per_signature, rent_collector, error_counters, @@ -471,6 +469,7 @@ impl TransactionBatchProcessor { callbacks: &CB, message: &SanitizedMessage, feature_set: &FeatureSet, + fee_structure: &FeeStructure, lamports_per_signature: u64, rent_collector: &RentCollector, error_counters: &mut TransactionErrorMetrics, @@ -490,7 +489,7 @@ impl TransactionBatchProcessor { ) .rent_amount; - let fee_details = self.fee_structure.calculate_fee_details( + let fee_details = fee_structure.calculate_fee_details( message, lamports_per_signature, &process_compute_budget_instructions(message.program_instructions_iter()) @@ -2000,6 +1999,7 @@ mod tests { &mock_bank, &message, &FeatureSet::default(), + &FeeStructure::default(), lamports_per_signature, &rent_collector, &mut error_counters, @@ -2058,6 +2058,7 @@ mod tests { &mock_bank, &message, &FeatureSet::default(), + &FeeStructure::default(), lamports_per_signature, &rent_collector, &mut error_counters, @@ -2093,6 +2094,7 @@ mod tests { &mock_bank, &message, &FeatureSet::default(), + &FeeStructure::default(), lamports_per_signature, &RentCollector::default(), &mut error_counters, @@ -2121,6 +2123,7 @@ mod tests { &mock_bank, &message, &FeatureSet::default(), + &FeeStructure::default(), lamports_per_signature, &RentCollector::default(), &mut error_counters, @@ -2153,6 +2156,7 @@ mod tests { &mock_bank, &message, &FeatureSet::default(), + &FeeStructure::default(), lamports_per_signature, &rent_collector, &mut error_counters, @@ -2183,6 +2187,7 @@ mod tests { &mock_bank, &message, &FeatureSet::default(), + &FeeStructure::default(), lamports_per_signature, &RentCollector::default(), &mut error_counters, @@ -2234,6 +2239,7 @@ mod tests { &mock_bank, &message, &feature_set, + &FeeStructure::default(), lamports_per_signature, &rent_collector, &mut error_counters, @@ -2279,6 +2285,7 @@ mod tests { &mock_bank, &message, &feature_set, + &FeeStructure::default(), lamports_per_signature, &rent_collector, &mut error_counters,