diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 33d314fff8afd3..088a29f6208b3e 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -6661,6 +6661,17 @@ impl Bank { &self.runtime_config.compute_budget.unwrap_or_default(), false, /* debugging_features */ )); + + // genesis_config loaded by accounts_db::open_genesis_config() from ledger + // has it's lamports_per_signature set to zero; bank sets its value correctly + // after the first block with a transaction in it. This is a hack to mimic + // the process. + let derived_fee_rate_governor = + FeeRateGovernor::new_derived(&genesis_config.fee_rate_governor, 0); + // new bank's fee_structure.lamports_per_signature should be inline with + // what's configured in GenesisConfig + self.fee_structure.lamports_per_signature = + derived_fee_rate_governor.lamports_per_signature; } pub fn set_inflation(&self, inflation: Inflation) { diff --git a/sdk/src/fee.rs b/sdk/src/fee.rs index f3377b5254f0a6..2fb045aba5d73e 100644 --- a/sdk/src/fee.rs +++ b/sdk/src/fee.rs @@ -80,17 +80,10 @@ impl FeeStructure { pub fn calculate_fee( &self, message: &SanitizedMessage, - lamports_per_signature: u64, + _lamports_per_signature: u64, budget_limits: &FeeBudgetLimits, include_loaded_account_data_size_in_fee: bool, ) -> u64 { - // Fee based on compute units and signatures - let congestion_multiplier = if lamports_per_signature == 0 { - 0.0 // test only - } else { - 1.0 // multiplier that has no effect - }; - let signature_fee = message .num_signatures() .saturating_mul(self.lamports_per_signature); @@ -122,12 +115,11 @@ impl FeeStructure { .unwrap_or_default() }); - ((budget_limits + (budget_limits .prioritization_fee .saturating_add(signature_fee) .saturating_add(write_lock_fee) .saturating_add(compute_fee) as f64) - * congestion_multiplier) .round() as u64 } }