Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert congestion multiplier PRs #35016

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6720,17 +6720,6 @@ 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) {
Expand Down
51 changes: 15 additions & 36 deletions sdk/src/fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,6 @@ pub struct FeeStructure {
pub compute_fee_bins: Vec<FeeBin>,
}

/// Return type of calculate_fee(...)
#[derive(Debug, Default, Clone, Eq, PartialEq)]
pub struct FeeDetails {
transaction_fee: u64,
prioritization_fee: u64,
}

impl FeeDetails {
pub fn total_fee(&self) -> u64 {
self.transaction_fee.saturating_add(self.prioritization_fee)
}
}

pub const ACCOUNT_DATA_COST_PAGE_SIZE: u64 = 32_u64.saturating_mul(1024);

impl FeeStructure {
Expand Down Expand Up @@ -88,30 +75,22 @@ impl FeeStructure {
.saturating_mul(heap_cost)
}

/// Calculate fee for `SanitizedMessage`
#[cfg(not(target_os = "solana"))]
pub fn calculate_fee(
&self,
message: &SanitizedMessage,
_unused: u64,
lamports_per_signature: u64,
budget_limits: &FeeBudgetLimits,
include_loaded_account_data_size_in_fee: bool,
) -> u64 {
self.calculate_fee_details(
message,
budget_limits,
include_loaded_account_data_size_in_fee,
)
.total_fee()
}
// 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
};

/// Calculate fee details for `SanitizedMessage`
#[cfg(not(target_os = "solana"))]
pub fn calculate_fee_details(
&self,
message: &SanitizedMessage,
budget_limits: &FeeBudgetLimits,
include_loaded_account_data_size_in_fee: bool,
) -> FeeDetails {
let signature_fee = message
.num_signatures()
.saturating_mul(self.lamports_per_signature);
Expand Down Expand Up @@ -143,13 +122,13 @@ impl FeeStructure {
.unwrap_or_default()
});

FeeDetails {
transaction_fee: (signature_fee
.saturating_add(write_lock_fee)
.saturating_add(compute_fee) as f64)
.round() as u64,
prioritization_fee: budget_limits.prioritization_fee,
}
((budget_limits
.prioritization_fee
.saturating_add(signature_fee)
.saturating_add(write_lock_fee)
.saturating_add(compute_fee) as f64)
* congestion_multiplier)
.round() as u64
}
}

Expand Down
Loading