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

Perform fee padding in a larger bit width of integers #70

Merged
merged 12 commits into from
Feb 21, 2024
18 changes: 11 additions & 7 deletions cmd/crates/soroban-rpc/src/txn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,13 +315,17 @@ pub fn assemble(

// update the fees of the actual transaction to meet the minimum resource fees.
let classic_transaction_fees = crate::DEFAULT_TRANSACTION_FEES;
// Pad the fees up by 15% for a bit of wiggle room.
tx.fee = (tx.fee.max(
classic_transaction_fees
+ u32::try_from(simulation.min_resource_fee)
.map_err(|_| Error::LargeFee(simulation.min_resource_fee))?,
) * 115)
/ 100;

// Pad the fees up by 15% for a bit of wiggle room
let padded_fee = u64::from(
dmkozh marked this conversation as resolved.
Show resolved Hide resolved
tx.fee.max(
classic_transaction_fees
+ u32::try_from(simulation.min_resource_fee)
.map_err(|_| Error::LargeFee(simulation.min_resource_fee))?,
),
) / 100
* 115;
tx.fee = u32::try_from(padded_fee).map_err(|_| Error::LargeFee(padded_fee))?;
Shaptic marked this conversation as resolved.
Show resolved Hide resolved

tx.operations = vec![op].try_into()?;
tx.ext = TransactionExt::V1(transaction_data);
Expand Down
Loading