diff --git a/runtime/near-vm-runner/src/near_vm_runner.rs b/runtime/near-vm-runner/src/near_vm_runner.rs index 501679f81b0..f8f45c6e7d1 100644 --- a/runtime/near-vm-runner/src/near_vm_runner.rs +++ b/runtime/near-vm-runner/src/near_vm_runner.rs @@ -353,17 +353,18 @@ impl NearVM { // outcome). And `cache`, being a database, can fail with an `io::Error`. let _span = tracing::debug_span!(target: "vm", "NearVM::compile_and_load").entered(); let key = get_contract_cache_key(code, &self.config); - let cache_record = cache - .map(|cache| cache.get(&key)) - .transpose() - .map_err(CacheError::ReadError)? - .flatten(); + let cache_record = { + let _span = tracing::debug_span!(target:"vm", "NearVM::read_cache_record").entered(); + cache.map(|cache| cache.get(&key)).transpose().map_err(CacheError::ReadError)?.flatten() + }; let stored_artifact: Option = match cache_record { None => None, Some(CompiledContract::CompileModuleError(err)) => return Ok(Err(err)), Some(CompiledContract::Code(serialized_module)) => { - let _span = tracing::debug_span!(target: "vm", "NearVM::read_from_cache").entered(); + let _span = + tracing::debug_span!(target: "vm", "NearVM::deserialize_module_from_cache") + .entered(); unsafe { // (UN-)SAFETY: the `serialized_module` must have been produced by a prior call to // `serialize`.