From 3be5bed3dfedb9d5dadf55da69279ed202749df5 Mon Sep 17 00:00:00 2001 From: Dmytro Kozhevin Date: Wed, 13 Sep 2023 11:29:21 -0400 Subject: [PATCH 1/2] No-op rename: remove `metered` from `metered_scan_slice_of_slices` as there is no metering. This doesn't seem to need to be metered. --- soroban-env-host/src/host.rs | 2 +- soroban-env-host/src/host/mem_helper.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/soroban-env-host/src/host.rs b/soroban-env-host/src/host.rs index 4bde5f1a5..339750180 100644 --- a/soroban-env-host/src/host.rs +++ b/soroban-env-host/src/host.rs @@ -1201,7 +1201,7 @@ impl EnvBase for Host { fn symbol_index_in_strs(&self, sym: Symbol, slices: &[&str]) -> Result { let mut found = None; - self.metered_scan_slice_of_slices(slices, |i, slice| { + self.scan_slice_of_slices(slices, |i, slice| { if self.symbol_matches(slice.as_bytes(), sym)? && found.is_none() { found = Some(i) } diff --git a/soroban-env-host/src/host/mem_helper.rs b/soroban-env-host/src/host/mem_helper.rs index c75ee7fd8..13f5f0081 100644 --- a/soroban-env-host/src/host/mem_helper.rs +++ b/soroban-env-host/src/host/mem_helper.rs @@ -209,7 +209,7 @@ impl Host { Ok(()) } - pub(crate) fn metered_scan_slice_of_slices( + pub(crate) fn scan_slice_of_slices( &self, slices: &[&str], mut callback: impl FnMut(usize, &str) -> Result<(), HostError>, From bdec5502b2f11487c946adaf7d0a7f3dfac0c440 Mon Sep 17 00:00:00 2001 From: Dmytro Kozhevin Date: Wed, 13 Sep 2023 12:22:45 -0400 Subject: [PATCH 2/2] Remove redundant TODO comment --- soroban-env-host/src/host/mem_helper.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/soroban-env-host/src/host/mem_helper.rs b/soroban-env-host/src/host/mem_helper.rs index 13f5f0081..a98d5e8e2 100644 --- a/soroban-env-host/src/host/mem_helper.rs +++ b/soroban-env-host/src/host/mem_helper.rs @@ -303,8 +303,6 @@ impl Host { let obj_end = obj_pos .checked_add(len) .ok_or_else(|| self.err_arith_overflow())? as usize; - // TODO: we currently grow the destination vec if it's not big enough, - // make sure this is desirable behaviour. if obj_new.len() < obj_end { self.charge_budget( ContractCostType::HostMemAlloc,