diff --git a/canister_templates/experimental.wasm b/canister_templates/experimental.wasm index f9b832b541..9fa9685885 100644 Binary files a/canister_templates/experimental.wasm and b/canister_templates/experimental.wasm differ diff --git a/src/build/experimental/commands/compile/wasm_binary/compile.ts b/src/build/experimental/commands/compile/wasm_binary/compile.ts index f4b66ff208..8daf027410 100644 --- a/src/build/experimental/commands/compile/wasm_binary/compile.ts +++ b/src/build/experimental/commands/compile/wasm_binary/compile.ts @@ -8,7 +8,7 @@ export function compile( ioType: IOType ): void { execSyncPretty( - `CARGO_TARGET_DIR=target cargo build --target wasm32-wasi --manifest-path ${manifestPath} --release --features "experimental"`, + `CARGO_TARGET_DIR=target cargo build --target wasm32-wasi --manifest-path ${manifestPath} --release`, ioType ); diff --git a/src/build/experimental/commands/compile/wasm_binary/rust/experimental_canister_template/Cargo.toml b/src/build/experimental/commands/compile/wasm_binary/rust/experimental_canister_template/Cargo.toml index d4d0ae8117..d7c4c0676b 100644 --- a/src/build/experimental/commands/compile/wasm_binary/rust/experimental_canister_template/Cargo.toml +++ b/src/build/experimental/commands/compile/wasm_binary/rust/experimental_canister_template/Cargo.toml @@ -6,9 +6,6 @@ edition = "2018" [lib] crate-type = ["cdylib"] -[features] -experimental = ["open_value_sharing", "wasmi"] - [dependencies] anyhow = "1.0.75" ic-cdk = "0.12.2" @@ -17,6 +14,7 @@ ic-cdk-timers = "0.6.0" candid = "0.10.2" candid_parser = "0.1.2" ic-stable-structures = "0.6.5" +open_value_sharing = { path = "../open_value_sharing" } slotmap = "=1.0.6" sha2 = "0.10.8" serde = "1.0.202" @@ -24,11 +22,4 @@ serde_json = "1.0.107" ic-wasi-polyfill = "0.6.1" wasmedge_quickjs = { git = "https://github.com/demergent-labs/wasmedge-quickjs", rev = "573c6c07316de64e4bb9a9561b079f265fd9bcc4" } # wasmedge_quickjs = { path = "/home/wasmedge-quickjs" } - -[dependencies.open_value_sharing] -optional = true -path = "../open_value_sharing" - -[dependencies.wasmi] -optional = true -version = "0.31.2" +wasmi = "0.31.2" diff --git a/src/build/experimental/commands/compile/wasm_binary/rust/experimental_canister_template/src/candid.rs b/src/build/experimental/commands/compile/wasm_binary/rust/experimental_canister_template/src/candid.rs index ba21eed769..b672bcc9b3 100644 --- a/src/build/experimental/commands/compile/wasm_binary/rust/experimental_canister_template/src/candid.rs +++ b/src/build/experimental/commands/compile/wasm_binary/rust/experimental_canister_template/src/candid.rs @@ -1,6 +1,6 @@ use wasmedge_quickjs::AsObject; -use crate::{ic, run_event_loop, wasm_binary_manipulation::get_js_code, EXPERIMENTAL, RUNTIME}; +use crate::{ic, run_event_loop, wasm_binary_manipulation::get_js_code, RUNTIME}; // Heavily inspired by https://stackoverflow.com/a/47676844 #[no_mangle] @@ -36,7 +36,7 @@ pub fn get_candid_and_method_meta_pointer() -> *mut std::os::raw::c_char { // TODO what do we do if there is an error in here? context.eval_global_str("globalThis.exports = {};".to_string()); - context.eval_global_str(format!("globalThis._azleExperimental = {EXPERIMENTAL};")); + context.eval_global_str(format!("globalThis._azleExperimental = true;")); context.eval_module_str(std::str::from_utf8(&js).unwrap().to_string(), "main"); run_event_loop(context); diff --git a/src/build/experimental/commands/compile/wasm_binary/rust/experimental_canister_template/src/init_and_post_upgrade.rs b/src/build/experimental/commands/compile/wasm_binary/rust/experimental_canister_template/src/init_and_post_upgrade.rs index aec3c5526a..7be34ff30b 100644 --- a/src/build/experimental/commands/compile/wasm_binary/rust/experimental_canister_template/src/init_and_post_upgrade.rs +++ b/src/build/experimental/commands/compile/wasm_binary/rust/experimental_canister_template/src/init_and_post_upgrade.rs @@ -3,11 +3,9 @@ use wasmedge_quickjs::AsObject; use crate::{ execute_method_js, ic, run_event_loop, wasm_binary_manipulation::get_js_code, - wasm_binary_manipulation::get_wasm_data, EXPERIMENTAL, MEMORY_MANAGER_REF_CELL, RUNTIME, - WASM_DATA_REF_CELL, + wasm_binary_manipulation::get_wasm_data, MEMORY_MANAGER_REF_CELL, RUNTIME, WASM_DATA_REF_CELL, }; -#[cfg(feature = "experimental")] use crate::{upload_file, web_assembly}; #[inline(never)] @@ -20,7 +18,6 @@ pub extern "C" fn init(function_index: i32, pass_arg_data: i32) { initialize(true, function_index, pass_arg_data); - #[cfg(feature = "experimental")] upload_file::init_hashes().unwrap(); } @@ -69,7 +66,6 @@ fn initialize(init: bool, function_index: i32, pass_arg_data: i32) { MEMORY_MANAGER_REF_CELL.with(|manager| manager.borrow().get(MemoryId::new(254))); ic_wasi_polyfill::init_with_memory(&[], &env_vars, polyfill_memory); - #[cfg(feature = "experimental")] std::fs::write("/candid/icp/management.did", &wasm_data.management_did).unwrap(); let js = get_js_code(); @@ -81,7 +77,6 @@ fn initialize(init: bool, function_index: i32, pass_arg_data: i32) { pass_arg_data, ); - #[cfg(feature = "experimental")] ic_cdk::spawn(async move { open_value_sharing::init(&wasm_data.consumer).await; }); @@ -93,7 +88,6 @@ pub fn initialize_js(js: &str, init: bool, function_index: i32, pass_arg_data: i rt.run_with_context(|context| { ic::register(context); - #[cfg(feature = "experimental")] web_assembly::register(context); let mut env = context.new_object(); @@ -115,7 +109,7 @@ pub fn initialize_js(js: &str, init: bool, function_index: i32, pass_arg_data: i // TODO what do we do if there is an error in here? context.eval_global_str("globalThis.exports = {};".to_string()); - context.eval_global_str(format!("globalThis._azleExperimental = {EXPERIMENTAL};")); + context.eval_global_str(format!("globalThis._azleExperimental = true;")); let record_benchmarks = WASM_DATA_REF_CELL.with(|wasm_data_ref_cell| { wasm_data_ref_cell .borrow() diff --git a/src/build/experimental/commands/compile/wasm_binary/rust/experimental_canister_template/src/lib.rs b/src/build/experimental/commands/compile/wasm_binary/rust/experimental_canister_template/src/lib.rs index 61b8204f18..863b859805 100644 --- a/src/build/experimental/commands/compile/wasm_binary/rust/experimental_canister_template/src/lib.rs +++ b/src/build/experimental/commands/compile/wasm_binary/rust/experimental_canister_template/src/lib.rs @@ -12,7 +12,6 @@ use ic_stable_structures::{ DefaultMemoryImpl, }; -#[cfg(feature = "experimental")] mod autoreload; mod benchmarking; mod candid; @@ -22,10 +21,8 @@ mod guards; mod ic; mod init_and_post_upgrade; mod stable_b_tree_map; -#[cfg(feature = "experimental")] mod upload_file; mod wasm_binary_manipulation; -#[cfg(feature = "experimental")] mod web_assembly; #[allow(unused)] @@ -37,8 +34,6 @@ thread_local! { static WASM_DATA_REF_CELL: RefCell> = RefCell::new(None); } -const EXPERIMENTAL: bool = cfg!(feature = "experimental"); - pub fn run_event_loop(context: &mut wasmedge_quickjs::Context) { context.promise_loop_poll(); @@ -56,7 +51,6 @@ pub fn run_event_loop(context: &mut wasmedge_quickjs::Context) { #[ic_cdk_macros::update] pub fn _azle_chunk() {} -#[cfg(feature = "experimental")] #[ic_cdk_macros::update(guard = guard_against_non_controllers)] fn _azle_reload_js( timestamp: u64, @@ -68,7 +62,6 @@ fn _azle_reload_js( autoreload::reload_js(timestamp, chunk_number, js_bytes, total_len, function_index); } -#[cfg(feature = "experimental")] #[ic_cdk_macros::update(guard = guard_against_non_controllers)] pub async fn _azle_upload_file_chunk( dest_path: String, @@ -87,13 +80,11 @@ pub async fn _azle_upload_file_chunk( .await } -#[cfg(feature = "experimental")] #[ic_cdk_macros::update(guard = guard_against_non_controllers)] pub fn _azle_clear_file_and_info(path: String) { upload_file::reset_for_new_upload(&path, 0).unwrap() } -#[cfg(feature = "experimental")] #[ic_cdk_macros::query(guard = guard_against_non_controllers)] pub fn _azle_get_file_hash(path: String) -> Option { upload_file::get_file_hash(path) diff --git a/src/build/experimental/commands/compile/wasm_binary/rust/experimental_canister_template/src/wasm_binary_manipulation.rs b/src/build/experimental/commands/compile/wasm_binary/rust/experimental_canister_template/src/wasm_binary_manipulation.rs index 0ccea8881f..c445c2d8d7 100644 --- a/src/build/experimental/commands/compile/wasm_binary/rust/experimental_canister_template/src/wasm_binary_manipulation.rs +++ b/src/build/experimental/commands/compile/wasm_binary/rust/experimental_canister_template/src/wasm_binary_manipulation.rs @@ -1,4 +1,3 @@ -#[cfg(feature = "experimental")] use open_value_sharing::Consumer; use serde::{Deserialize, Serialize}; @@ -9,9 +8,7 @@ pub struct WasmData { pub env_vars: Vec<(String, String)>, #[serde(rename = "recordBenchmarks")] pub record_benchmarks: bool, - #[cfg(feature = "experimental")] pub consumer: Consumer, - #[cfg(feature = "experimental")] #[serde(rename = "managementDid")] pub management_did: String, }