From 5a5ef1214de70d6c248907eb61c9f4aa0f8e7bd2 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 2 Aug 2023 18:42:37 -0600 Subject: [PATCH] Fix Budget::memory_bytes_cost (#1033) ### 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 --- soroban-sdk/src/testutils.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soroban-sdk/src/testutils.rs b/soroban-sdk/src/testutils.rs index 89bd98482..a4c4a3c8b 100644 --- a/soroban-sdk/src/testutils.rs +++ b/soroban-sdk/src/testutils.rs @@ -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