Skip to content
Open
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
4 changes: 2 additions & 2 deletions crates/l2/sdk/src/sdk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -813,10 +813,10 @@ fn bump_gas_generic_tx(tx: &mut GenericTransaction, bump_percentage: u64) {
*max_priority_fee_per_gas = (*max_priority_fee_per_gas * (100 + bump_percentage)) / 100;
}
if let Some(max_fee_per_blob_gas) = &mut tx.max_fee_per_blob_gas {
let factor = 1 + (bump_percentage / 100) * 10;
let factor = 100 + bump_percentage;
*max_fee_per_blob_gas = max_fee_per_blob_gas
.saturating_mul(U256::from(factor))
.div(10);
.div(100);
Comment on lines 815 to +819
Copy link
Contributor

Choose a reason for hiding this comment

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

To keep the same semantics without the integer truncation issue what you actually need is:

Suggested change
if let Some(max_fee_per_blob_gas) = &mut tx.max_fee_per_blob_gas {
let factor = 1 + (bump_percentage / 100) * 10;
let factor = 100 + bump_percentage;
*max_fee_per_blob_gas = max_fee_per_blob_gas
.saturating_mul(U256::from(factor))
.div(10);
.div(100);
if let Some(max_fee_per_blob_gas) = &mut tx.max_fee_per_blob_gas {
let factor = 100 + bump_percentage * 10;
*max_fee_per_blob_gas = max_fee_per_blob_gas
.saturating_mul(U256::from(factor))
.div(1000);

I don't know why the magic multiply and divide by 10 was there, but if there was a reason you'll want to keep it.

}
}

Expand Down
Loading