From 46bc6115b76cc5f606e92b0f6ece68b27aedb47a Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Thu, 1 Sep 2022 16:14:38 +0200 Subject: [PATCH] Rename init_cache argument to available_capabilities --- libwasmvm/bindings.h | 2 +- libwasmvm/src/args.rs | 2 +- libwasmvm/src/cache.rs | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libwasmvm/bindings.h b/libwasmvm/bindings.h index f25f982ab..1d8c973e0 100644 --- a/libwasmvm/bindings.h +++ b/libwasmvm/bindings.h @@ -304,7 +304,7 @@ typedef struct GoQuerier { } GoQuerier; struct cache_t *init_cache(struct ByteSliceView data_dir, - struct ByteSliceView supported_features, + struct ByteSliceView available_capabilities, uint32_t cache_size, uint32_t instance_memory_limit, struct UnmanagedVector *error_msg); diff --git a/libwasmvm/src/args.rs b/libwasmvm/src/args.rs index 180cfa359..69ab5fe72 100644 --- a/libwasmvm/src/args.rs +++ b/libwasmvm/src/args.rs @@ -1,6 +1,6 @@ // store some common string for argument names pub const DATA_DIR_ARG: &str = "data_dir"; -pub const FEATURES_ARG: &str = "supported_features"; +pub const AVAILABLE_CAPABILITIES_ARG: &str = "available_capabilities"; pub const CACHE_ARG: &str = "cache"; pub const WASM_ARG: &str = "wasm"; pub const CHECKSUM_ARG: &str = "checksum"; diff --git a/libwasmvm/src/cache.rs b/libwasmvm/src/cache.rs index 8b6f330d1..2ac190474 100644 --- a/libwasmvm/src/cache.rs +++ b/libwasmvm/src/cache.rs @@ -6,7 +6,7 @@ use std::str::from_utf8; use cosmwasm_vm::{capabilities_from_csv, Cache, CacheOptions, Checksum, Size}; use crate::api::GoApi; -use crate::args::{CACHE_ARG, CHECKSUM_ARG, DATA_DIR_ARG, FEATURES_ARG, WASM_ARG}; +use crate::args::{AVAILABLE_CAPABILITIES_ARG, CACHE_ARG, CHECKSUM_ARG, DATA_DIR_ARG, WASM_ARG}; use crate::error::{handle_c_error_binary, handle_c_error_default, handle_c_error_ptr, Error}; use crate::memory::{ByteSliceView, UnmanagedVector}; use crate::querier::GoQuerier; @@ -27,7 +27,7 @@ pub fn to_cache(ptr: *mut cache_t) -> Option<&'static mut Cache, @@ -35,7 +35,7 @@ pub extern "C" fn init_cache( let r = catch_unwind(|| { do_init_cache( data_dir, - supported_features, + available_capabilities, cache_size, instance_memory_limit, ) @@ -46,7 +46,7 @@ pub extern "C" fn init_cache( fn do_init_cache( data_dir: ByteSliceView, - supported_capabilities: ByteSliceView, + available_capabilities: ByteSliceView, cache_size: u32, // in MiB instance_memory_limit: u32, // in MiB ) -> Result<*mut Cache, Error> { @@ -55,9 +55,9 @@ fn do_init_cache( .ok_or_else(|| Error::unset_arg(DATA_DIR_ARG))?; let dir_str = String::from_utf8(dir.to_vec())?; // parse the supported features - let capabilities_bin = supported_capabilities + let capabilities_bin = available_capabilities .read() - .ok_or_else(|| Error::unset_arg(FEATURES_ARG))?; + .ok_or_else(|| Error::unset_arg(AVAILABLE_CAPABILITIES_ARG))?; let capabilities = capabilities_from_csv(from_utf8(capabilities_bin)?); let memory_cache_size = Size::mebi( cache_size