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

Refactor remove unnecessary rounding #34963

Closed
Closed
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
9 changes: 3 additions & 6 deletions sdk/src/fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,12 @@ impl FeeStructure {
pub fn calculate_fee(
&self,
message: &SanitizedMessage,
lamports_per_signature: u64,
_unused: u64,
budget_limits: &FeeBudgetLimits,
include_loaded_account_data_size_in_fee: bool,
) -> u64 {
self.calculate_fee_details(
message,
lamports_per_signature,
budget_limits,
include_loaded_account_data_size_in_fee,
)
Expand All @@ -110,7 +109,6 @@ impl FeeStructure {
pub fn calculate_fee_details(
&self,
message: &SanitizedMessage,
_lamports_per_signature: u64,
budget_limits: &FeeBudgetLimits,
include_loaded_account_data_size_in_fee: bool,
) -> FeeDetails {
Expand Down Expand Up @@ -146,10 +144,9 @@ impl FeeStructure {
});

FeeDetails {
transaction_fee: (signature_fee
transaction_fee: signature_fee
.saturating_add(write_lock_fee)
.saturating_add(compute_fee) as f64)
.round() as u64,
.saturating_add(compute_fee),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs a feature-gate 😢 f64 rounding could lead to a different result here if total fee is high....I think that this probably would not happen practically

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess safe to 2^53...so practically is this okay?

prioritization_fee: budget_limits.prioritization_fee,
}
}
Expand Down
Loading