Skip to content

Commit

Permalink
Fix Budget::memory_bytes_cost (#1033)
Browse files Browse the repository at this point in the history
### What

Report the correct number in the test function
`Budget::memory_bytes_cost`.

### Why

It is incorrectly reporting the CPU cost.

### Known limitations

na

Co-authored-by: Graydon Hoare <[email protected]>
  • Loading branch information
brson and graydon authored Aug 3, 2023
1 parent 6ab39d3 commit 5a5ef12
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion soroban-sdk/src/testutils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ pub mod budget {
/// Note that memory is likely to be underestimated when running Rust
/// code compared to running the WASM equivalent.
pub fn memory_bytes_cost(&self) -> u64 {
self.0.get_cpu_insns_consumed().unwrap()
self.0.get_mem_bytes_consumed().unwrap()
}

/// Get the input tracker associated with the cost. The tracker tracks
Expand Down

0 comments on commit 5a5ef12

Please sign in to comment.