Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 021e555

Browse files
v1.18: Revert PRs caused hash mismatch (backport of #35018) (#35020)
* Revert "refactor unused parameter (#34970)" This reverts commit 0838909. (cherry picked from commit 1542392) # Conflicts: # sdk/src/fee.rs * Revert "separate priority fee and transaction fee from fee calculation (#34757)" This reverts commit 5ecc47e. (cherry picked from commit df2ee12) # Conflicts: # sdk/src/fee.rs * Revert "Remove congestion multiplier from calculate fee (#34865)" This reverts commit 73d3973. (cherry picked from commit 0dcac3f) # Conflicts: # sdk/src/fee.rs * fix merge conflicts --------- Co-authored-by: Tao Zhu <[email protected]>
1 parent ed34e4b commit 021e555

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

runtime/src/bank.rs

-11
Original file line numberDiff line numberDiff line change
@@ -6660,17 +6660,6 @@ impl Bank {
66606660
&self.runtime_config.compute_budget.unwrap_or_default(),
66616661
false, /* debugging_features */
66626662
));
6663-
6664-
// genesis_config loaded by accounts_db::open_genesis_config() from ledger
6665-
// has it's lamports_per_signature set to zero; bank sets its value correctly
6666-
// after the first block with a transaction in it. This is a hack to mimic
6667-
// the process.
6668-
let derived_fee_rate_governor =
6669-
FeeRateGovernor::new_derived(&genesis_config.fee_rate_governor, 0);
6670-
// new bank's fee_structure.lamports_per_signature should be inline with
6671-
// what's configured in GenesisConfig
6672-
self.fee_structure.lamports_per_signature =
6673-
derived_fee_rate_governor.lamports_per_signature;
66746663
}
66756664

66766665
pub fn set_inflation(&self, inflation: Inflation) {

runtime/src/bank/tests.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3335,6 +3335,7 @@ fn test_bank_parent_account_spend() {
33353335
let key2 = Keypair::new();
33363336
let (parent, bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config);
33373337
let amount = genesis_config.rent.minimum_balance(0);
3338+
println!("==== amount {}", amount);
33383339

33393340
let tx =
33403341
system_transaction::transfer(&mint_keypair, &key1.pubkey(), amount, genesis_config.hash());

sdk/src/fee.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,17 @@ impl FeeStructure {
8080
pub fn calculate_fee(
8181
&self,
8282
message: &SanitizedMessage,
83-
_lamports_per_signature: u64,
83+
lamports_per_signature: u64,
8484
budget_limits: &FeeBudgetLimits,
8585
include_loaded_account_data_size_in_fee: bool,
8686
) -> u64 {
87+
// Fee based on compute units and signatures
88+
let congestion_multiplier = if lamports_per_signature == 0 {
89+
0.0 // test only
90+
} else {
91+
1.0 // multiplier that has no effect
92+
};
93+
8794
let signature_fee = message
8895
.num_signatures()
8996
.saturating_mul(self.lamports_per_signature);
@@ -115,11 +122,12 @@ impl FeeStructure {
115122
.unwrap_or_default()
116123
});
117124

118-
(budget_limits
125+
((budget_limits
119126
.prioritization_fee
120127
.saturating_add(signature_fee)
121128
.saturating_add(write_lock_fee)
122129
.saturating_add(compute_fee) as f64)
130+
* congestion_multiplier)
123131
.round() as u64
124132
}
125133
}

0 commit comments

Comments
 (0)