Skip to content

Commit

Permalink
SVM: drop fee_structure from global configs
Browse files Browse the repository at this point in the history
  • Loading branch information
buffalojoec committed Jun 17, 2024
1 parent 30b0b32 commit 8a45095
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions svm/src/transaction_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,6 @@ pub struct TransactionBatchProcessor<FG: ForkGraph> {
/// 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.
Expand All @@ -172,7 +169,6 @@ impl<FG: ForkGraph> Debug for TransactionBatchProcessor<FG> {
.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()
Expand All @@ -185,7 +181,6 @@ impl<FG: ForkGraph> Default for TransactionBatchProcessor<FG> {
slot: Slot::default(),
epoch: Epoch::default(),
epoch_schedule: EpochSchedule::default(),
fee_structure: FeeStructure::default(),
sysvar_cache: RwLock::<SysvarCache>::default(),
program_cache: Arc::new(RwLock::new(ProgramCache::new(
Slot::default(),
Expand All @@ -207,7 +202,6 @@ impl<FG: ForkGraph> TransactionBatchProcessor<FG> {
slot,
epoch,
epoch_schedule,
fee_structure: FeeStructure::default(),
sysvar_cache: RwLock::<SysvarCache>::default(),
program_cache: Arc::new(RwLock::new(ProgramCache::new(slot, epoch))),
builtin_program_ids: RwLock::new(builtin_program_ids),
Expand All @@ -219,7 +213,6 @@ impl<FG: ForkGraph> TransactionBatchProcessor<FG> {
slot,
epoch,
epoch_schedule: self.epoch_schedule.clone(),
fee_structure: self.fee_structure.clone(),
sysvar_cache: RwLock::<SysvarCache>::default(),
program_cache: self.program_cache.clone(),
builtin_program_ids: RwLock::new(self.builtin_program_ids.read().unwrap().clone()),
Expand Down Expand Up @@ -254,6 +247,9 @@ impl<FG: ForkGraph> TransactionBatchProcessor<FG> {
sanitized_txs,
check_results,
&environment.feature_set,
environment
.fee_structure
.unwrap_or(&FeeStructure::default()),
environment
.rent_collector
.unwrap_or(&RentCollector::default()),
Expand Down Expand Up @@ -417,6 +413,7 @@ impl<FG: ForkGraph> TransactionBatchProcessor<FG> {
sanitized_txs: &[impl core::borrow::Borrow<SanitizedTransaction>],
check_results: Vec<TransactionCheckResult>,
feature_set: &FeatureSet,
fee_structure: &FeeStructure,
rent_collector: &RentCollector,
error_counters: &mut TransactionErrorMetrics,
) -> Vec<TransactionValidationResult> {
Expand All @@ -435,6 +432,7 @@ impl<FG: ForkGraph> TransactionBatchProcessor<FG> {
callbacks,
message,
feature_set,
fee_structure,
lamports_per_signature,
rent_collector,
error_counters,
Expand Down Expand Up @@ -471,6 +469,7 @@ impl<FG: ForkGraph> TransactionBatchProcessor<FG> {
callbacks: &CB,
message: &SanitizedMessage,
feature_set: &FeatureSet,
fee_structure: &FeeStructure,
lamports_per_signature: u64,
rent_collector: &RentCollector,
error_counters: &mut TransactionErrorMetrics,
Expand All @@ -490,7 +489,7 @@ impl<FG: ForkGraph> TransactionBatchProcessor<FG> {
)
.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())
Expand Down Expand Up @@ -2000,6 +1999,7 @@ mod tests {
&mock_bank,
&message,
&FeatureSet::default(),
&FeeStructure::default(),
lamports_per_signature,
&rent_collector,
&mut error_counters,
Expand Down Expand Up @@ -2058,6 +2058,7 @@ mod tests {
&mock_bank,
&message,
&FeatureSet::default(),
&FeeStructure::default(),
lamports_per_signature,
&rent_collector,
&mut error_counters,
Expand Down Expand Up @@ -2093,6 +2094,7 @@ mod tests {
&mock_bank,
&message,
&FeatureSet::default(),
&FeeStructure::default(),
lamports_per_signature,
&RentCollector::default(),
&mut error_counters,
Expand Down Expand Up @@ -2121,6 +2123,7 @@ mod tests {
&mock_bank,
&message,
&FeatureSet::default(),
&FeeStructure::default(),
lamports_per_signature,
&RentCollector::default(),
&mut error_counters,
Expand Down Expand Up @@ -2153,6 +2156,7 @@ mod tests {
&mock_bank,
&message,
&FeatureSet::default(),
&FeeStructure::default(),
lamports_per_signature,
&rent_collector,
&mut error_counters,
Expand Down Expand Up @@ -2183,6 +2187,7 @@ mod tests {
&mock_bank,
&message,
&FeatureSet::default(),
&FeeStructure::default(),
lamports_per_signature,
&RentCollector::default(),
&mut error_counters,
Expand Down Expand Up @@ -2234,6 +2239,7 @@ mod tests {
&mock_bank,
&message,
&feature_set,
&FeeStructure::default(),
lamports_per_signature,
&rent_collector,
&mut error_counters,
Expand Down Expand Up @@ -2279,6 +2285,7 @@ mod tests {
&mock_bank,
&message,
&feature_set,
&FeeStructure::default(),
lamports_per_signature,
&rent_collector,
&mut error_counters,
Expand Down

0 comments on commit 8a45095

Please sign in to comment.