Skip to content

Commit

Permalink
soroban-rpc: preflight: Fix double-counting bug
Browse files Browse the repository at this point in the history
  • Loading branch information
2opremio committed Sep 13, 2023
1 parent 06bf51f commit ce76bf0
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions cmd/soroban-rpc/lib/preflight/src/fees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ pub(crate) fn compute_host_function_transaction_data_and_min_fee(
calculate_host_function_soroban_resources(&ledger_changes, &post_storage.footprint, budget)
.context("cannot compute host function resources")?;

let read_write_entries = u32::try_from(soroban_resources.footprint.read_write.as_vec().len())?;

let contract_events_size =
calculate_contract_events_size_bytes(events).context("cannot calculate events size")?;
let invocation_return_size = u32::try_from(invocation_result.to_xdr()?.len())?;
Expand All @@ -53,9 +51,8 @@ pub(crate) fn compute_host_function_transaction_data_and_min_fee(

let transaction_resources = TransactionResources {
instructions: soroban_resources.instructions,
read_entries: u32::try_from(soroban_resources.footprint.read_only.as_vec().len())?
+ read_write_entries,
write_entries: read_write_entries,
read_entries: u32::try_from(soroban_resources.footprint.read_only.as_vec().len())?,
write_entries: u32::try_from(soroban_resources.footprint.read_write.as_vec().len())?,
read_bytes: soroban_resources.read_bytes,
write_bytes: soroban_resources.write_bytes,
// Note: we could get a better transaction size if the full transaction was passed down to libpreflight
Expand Down

0 comments on commit ce76bf0

Please sign in to comment.