From e95c09d4a34364af03727c566c73f73b93d6ed50 Mon Sep 17 00:00:00 2001 From: Evan Date: Fri, 17 Feb 2023 12:40:03 -0800 Subject: [PATCH 1/6] Attempt to add wasm-bindgen-rayon --- Cargo.lock | 20 ++++++++++++++++++++ wasm/Cargo.toml | 6 ++++++ 2 files changed, 26 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 99968f580..0e3591997 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2356,6 +2356,8 @@ dependencies = [ "serde_json", "snarkvm-utilities-derives", "thiserror", + "wasm-bindgen", + "wasm-bindgen-rayon", ] [[package]] @@ -2399,6 +2401,12 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "spmc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02a8428da277a8e3a15271d79943e80ccc2ef254e78813a166a08d65e4c3ece5" + [[package]] name = "strsim" version = "0.10.0" @@ -2890,6 +2898,18 @@ dependencies = [ "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-rayon" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df87c67450805c305d3ae44a3ac537b0253d029153c25afc3ecd2edc36ccafb1" +dependencies = [ + "js-sys", + "rayon", + "spmc", + "wasm-bindgen", +] + [[package]] name = "wasm-bindgen-shared" version = "0.2.84" diff --git a/wasm/Cargo.toml b/wasm/Cargo.toml index 0c8f1e99b..77976d1cd 100644 --- a/wasm/Cargo.toml +++ b/wasm/Cargo.toml @@ -81,3 +81,9 @@ lto = true [package.metadata.wasm-pack.profile.release] wasm-opt = ["-O4", "--fast-math"] + +[target.wasm32-unknown-unknown] +rustflags = ["-C", "target-feature=+atomics,+bulk-memory,+mutable-globals"] + +[unstable] +build-std = ["panic_abort", "std"] From 35a30e2f505816e2d0d2a63210d1dbccb7f12e2f Mon Sep 17 00:00:00 2001 From: Evan Date: Fri, 17 Feb 2023 15:22:36 -0800 Subject: [PATCH 2/6] testing --- .cargo/config | 6 ++++++ Cargo.lock | 1 + wasm/Cargo.toml | 10 +++++----- wasm/src/lib.rs | 2 ++ 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.cargo/config b/.cargo/config index 7c6d59471..43ac15741 100644 --- a/.cargo/config +++ b/.cargo/config @@ -1,2 +1,8 @@ [target.'cfg(not(target_arch = "wasm32"))'] rustflags = ["-C", "target-cpu=native"] + +[target.wasm32-unknown-unknown] +rustflags = ["-C", "target-feature=+atomics,+bulk-memory,+mutable-globals"] + +[unstable] +build-std = ["panic_abort", "std"] \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 0e3591997..46e7f2e6d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -151,6 +151,7 @@ dependencies = [ "snarkvm-synthesizer", "snarkvm-wasm", "wasm-bindgen", + "wasm-bindgen-rayon", "wasm-bindgen-test", "web-sys", ] diff --git a/wasm/Cargo.toml b/wasm/Cargo.toml index 77976d1cd..b8dbfde71 100644 --- a/wasm/Cargo.toml +++ b/wasm/Cargo.toml @@ -62,6 +62,9 @@ default-features = false version = "0.2" features = [ "serde-serialize" ] +[dependencies.wasm-bindgen-rayon] +version = "1.0" + [dependencies.js-sys] version = "0.3" @@ -82,8 +85,5 @@ lto = true [package.metadata.wasm-pack.profile.release] wasm-opt = ["-O4", "--fast-math"] -[target.wasm32-unknown-unknown] -rustflags = ["-C", "target-feature=+atomics,+bulk-memory,+mutable-globals"] - -[unstable] -build-std = ["panic_abort", "std"] +[features] +thread_local_internals = [ ] diff --git a/wasm/src/lib.rs b/wasm/src/lib.rs index 03def94a7..a2a6f5d3f 100644 --- a/wasm/src/lib.rs +++ b/wasm/src/lib.rs @@ -25,3 +25,5 @@ pub use program::*; pub(crate) mod types; pub(crate) use types::*; + +// pub use wasm_bindgen_rayon::init_thread_pool; From 76a001055bc3c9f37781f6cc7cefa61706c22225 Mon Sep 17 00:00:00 2001 From: JohnDonavon Date: Fri, 17 Feb 2023 15:51:21 -0800 Subject: [PATCH 3/6] nightly toolchain --- rust-toolchain | 1 + 1 file changed, 1 insertion(+) create mode 100644 rust-toolchain diff --git a/rust-toolchain b/rust-toolchain new file mode 100644 index 000000000..467f338ce --- /dev/null +++ b/rust-toolchain @@ -0,0 +1 @@ +nightly-2022-12-12 \ No newline at end of file From 9de5e29fa83d02662e0ed7304b8457618300809b Mon Sep 17 00:00:00 2001 From: Evan Date: Fri, 17 Feb 2023 16:26:34 -0800 Subject: [PATCH 4/6] Fix webpack for rayon bindgen --- website/package.json | 1 - website/src/aleo-wasm-hook.js | 2 +- website/src/workers/worker.js | 38 +++++++++++++++++------------------ website/webpack.config.js | 8 ++++++++ website/yarn.lock | 3 --- 5 files changed, 28 insertions(+), 24 deletions(-) diff --git a/website/package.json b/website/package.json index f0662ed84..4edcf6b9e 100644 --- a/website/package.json +++ b/website/package.json @@ -4,7 +4,6 @@ "private": true, "dependencies": { "@aleohq/ui": "^0.0.9", - "@aleohq/wasm": "file:../wasm/pkg", "@ant-design/icons": "^4.4.0", "antd": "^4.11.2", "axios": "^1.1.3", diff --git a/website/src/aleo-wasm-hook.js b/website/src/aleo-wasm-hook.js index 0fdd7086f..cb4864044 100644 --- a/website/src/aleo-wasm-hook.js +++ b/website/src/aleo-wasm-hook.js @@ -5,7 +5,7 @@ export const useAleoWASM = () => { useEffect(() => { if (aleo === null) { - import('@aleohq/wasm').then(module => setAleo(module)); + import('../../wasm/pkg').then(module => setAleo(module)); } }, []); // eslint-disable-line react-hooks/exhaustive-deps return aleo; diff --git a/website/src/workers/worker.js b/website/src/workers/worker.js index 3e6a1e7e1..8cb8df03e 100644 --- a/website/src/workers/worker.js +++ b/website/src/workers/worker.js @@ -1,22 +1,22 @@ -import "babel-polyfill"; +import init, * as aleo from "../../../wasm/pkg"; -import("@aleohq/wasm").then(aleo => { - self.addEventListener("message", ev => { - const {privateKey, transferProverBytes, toAddress, amount, plaintext} = ev.data; - console.log('Web worker: Started Transfer...'); - console.log(ev.data); - let startTime = performance.now(); - const pK = aleo.PrivateKey.from_string(privateKey); - const provingKey = aleo.ProvingKey.from_bytes(transferProverBytes); - console.log(`Web worker: Deserialized proving key Completed: ${performance.now() - startTime} ms`); - startTime = performance.now(); - const address = aleo.Address.from_string(toAddress); - const rec = aleo.RecordPlaintext.fromString(plaintext); +init(); - startTime = performance.now(); - const result = aleo.TransactionBuilder.build_transfer_full(pK, provingKey, address, BigInt(amount), rec); - console.log(`Web worker: Transaction Completed: ${performance.now() - startTime} ms`); - console.log(result); - self.postMessage({ transaction: result }); - }); +self.addEventListener("message", ev => { + const {privateKey, transferProverBytes, toAddress, amount, plaintext} = ev.data; + console.log('Web worker: Started Transfer...'); + console.log(ev.data); + let startTime = performance.now(); + const pK = aleo.PrivateKey.from_string(privateKey); + const provingKey = aleo.ProvingKey.from_bytes(transferProverBytes); + console.log(`Web worker: Deserialized proving key Completed: ${performance.now() - startTime} ms`); + startTime = performance.now(); + const address = aleo.Address.from_string(toAddress); + const rec = aleo.RecordPlaintext.fromString(plaintext); + + startTime = performance.now(); + const result = aleo.TransactionBuilder.build_transfer_full(pK, provingKey, address, BigInt(amount), rec); + console.log(`Web worker: Transaction Completed: ${performance.now() - startTime} ms`); + console.log(result); + self.postMessage({ transaction: result }); }); \ No newline at end of file diff --git a/website/webpack.config.js b/website/webpack.config.js index a8b9dfc49..2902d9c8d 100644 --- a/website/webpack.config.js +++ b/website/webpack.config.js @@ -35,6 +35,7 @@ const appConfig = { maxAssetSize: 8388608 }, experiments: { + syncWebAssembly: true, asyncWebAssembly: true }, devtool: 'source-map', @@ -44,6 +45,12 @@ const workerConfig = { mode: 'development', entry: "./src/workers/worker.js", target: "webworker", + plugins: [ + new WasmPackPlugin({ + crateDirectory: path.resolve(__dirname, "../wasm"), + extraArgs: '--target web' + }) + ], resolve: { extensions: [".js", ".wasm"] }, @@ -52,6 +59,7 @@ const workerConfig = { filename: "worker.js" }, experiments: { + syncWebAssembly: true, asyncWebAssembly: true }, devtool: 'source-map', diff --git a/website/yarn.lock b/website/yarn.lock index 5c2cc732d..a4a43580f 100644 --- a/website/yarn.lock +++ b/website/yarn.lock @@ -9,9 +9,6 @@ dependencies: antd "^4.12.2" -"@aleohq/wasm@file:../wasm/pkg": - version "0.3.3" - "@ampproject/remapping@^2.0.0": version "2.1.1" resolved "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.1.1.tgz" From 76cf6857c40ffa226ad9e5e05b051893ca9a73f4 Mon Sep 17 00:00:00 2001 From: Evan Date: Sun, 19 Feb 2023 19:49:57 -0800 Subject: [PATCH 5/6] testing, disabling wasm_bindgen_rayon --- Cargo.lock | 21 --------------------- wasm/Cargo.toml | 10 +++++----- website/package.json | 4 +++- website/src/aleo-wasm-hook.js | 2 +- website/src/workers/worker.js | 6 ++++-- website/webpack.config.js | 22 ++++++++++++++-------- website/yarn.lock | 3 +++ 7 files changed, 30 insertions(+), 38 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 46e7f2e6d..99968f580 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -151,7 +151,6 @@ dependencies = [ "snarkvm-synthesizer", "snarkvm-wasm", "wasm-bindgen", - "wasm-bindgen-rayon", "wasm-bindgen-test", "web-sys", ] @@ -2357,8 +2356,6 @@ dependencies = [ "serde_json", "snarkvm-utilities-derives", "thiserror", - "wasm-bindgen", - "wasm-bindgen-rayon", ] [[package]] @@ -2402,12 +2399,6 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" -[[package]] -name = "spmc" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02a8428da277a8e3a15271d79943e80ccc2ef254e78813a166a08d65e4c3ece5" - [[package]] name = "strsim" version = "0.10.0" @@ -2899,18 +2890,6 @@ dependencies = [ "wasm-bindgen-shared", ] -[[package]] -name = "wasm-bindgen-rayon" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df87c67450805c305d3ae44a3ac537b0253d029153c25afc3ecd2edc36ccafb1" -dependencies = [ - "js-sys", - "rayon", - "spmc", - "wasm-bindgen", -] - [[package]] name = "wasm-bindgen-shared" version = "0.2.84" diff --git a/wasm/Cargo.toml b/wasm/Cargo.toml index b8dbfde71..140f59237 100644 --- a/wasm/Cargo.toml +++ b/wasm/Cargo.toml @@ -62,8 +62,8 @@ default-features = false version = "0.2" features = [ "serde-serialize" ] -[dependencies.wasm-bindgen-rayon] -version = "1.0" +# [dependencies.wasm-bindgen-rayon] +# version = "1.0" [dependencies.js-sys] version = "0.3" @@ -83,7 +83,7 @@ opt-level = 3 lto = true [package.metadata.wasm-pack.profile.release] -wasm-opt = ["-O4", "--fast-math"] +wasm-opt = ["-O4"] -[features] -thread_local_internals = [ ] +# [features] +# thread_local_internals = [ ] diff --git a/website/package.json b/website/package.json index 4edcf6b9e..d36cb67f9 100644 --- a/website/package.json +++ b/website/package.json @@ -4,6 +4,7 @@ "private": true, "dependencies": { "@aleohq/ui": "^0.0.9", + "@aleohq/wasm": "file:../wasm/pkg", "@ant-design/icons": "^4.4.0", "antd": "^4.11.2", "axios": "^1.1.3", @@ -31,7 +32,8 @@ "webpack-dev-server": "^4.7.4" }, "scripts": { - "start": "yarn upgrade @aleohq/wasm && webpack-dev-server", + "build-wasm": "cd ../wasm && wasm-pack build --debug --target web", + "start": "yarn build-wasm && yarn upgrade @aleohq/wasm && webpack-dev-server", "build": "webpack --config webpack.config.js", "predeploy": "yarn build", "deploy": "gh-pages -d build", diff --git a/website/src/aleo-wasm-hook.js b/website/src/aleo-wasm-hook.js index cb4864044..0fdd7086f 100644 --- a/website/src/aleo-wasm-hook.js +++ b/website/src/aleo-wasm-hook.js @@ -5,7 +5,7 @@ export const useAleoWASM = () => { useEffect(() => { if (aleo === null) { - import('../../wasm/pkg').then(module => setAleo(module)); + import('@aleohq/wasm').then(module => setAleo(module)); } }, []); // eslint-disable-line react-hooks/exhaustive-deps return aleo; diff --git a/website/src/workers/worker.js b/website/src/workers/worker.js index 8cb8df03e..a5c993258 100644 --- a/website/src/workers/worker.js +++ b/website/src/workers/worker.js @@ -1,6 +1,8 @@ -import init, * as aleo from "../../../wasm/pkg"; +import init, * as aleo from '@aleohq/wasm'; -init(); +await init(); + +// await aleo.initThreadPool(navigator.hardwareConcurrency); self.addEventListener("message", ev => { const {privateKey, transferProverBytes, toAddress, amount, plaintext} = ev.data; diff --git a/website/webpack.config.js b/website/webpack.config.js index 2902d9c8d..b6a382b20 100644 --- a/website/webpack.config.js +++ b/website/webpack.config.js @@ -13,6 +13,10 @@ const appConfig = { }, devServer: { port: 3000, + headers: { + 'Cross-Origin-Opener-Policy': 'same-origin', + 'Cross-Origin-Embedder-Policy': 'require-corp' + }, }, module: { rules: [ @@ -36,7 +40,8 @@ const appConfig = { }, experiments: { syncWebAssembly: true, - asyncWebAssembly: true + asyncWebAssembly: true, + topLevelAwait: true }, devtool: 'source-map', } @@ -45,12 +50,12 @@ const workerConfig = { mode: 'development', entry: "./src/workers/worker.js", target: "webworker", - plugins: [ - new WasmPackPlugin({ - crateDirectory: path.resolve(__dirname, "../wasm"), - extraArgs: '--target web' - }) - ], + // plugins: [ + // new WasmPackPlugin({ + // crateDirectory: path.resolve(__dirname, "../wasm"), + // extraArgs: '--target web' + // }) + // ], resolve: { extensions: [".js", ".wasm"] }, @@ -60,7 +65,8 @@ const workerConfig = { }, experiments: { syncWebAssembly: true, - asyncWebAssembly: true + asyncWebAssembly: true, + topLevelAwait: true }, devtool: 'source-map', }; diff --git a/website/yarn.lock b/website/yarn.lock index a4a43580f..5c2cc732d 100644 --- a/website/yarn.lock +++ b/website/yarn.lock @@ -9,6 +9,9 @@ dependencies: antd "^4.12.2" +"@aleohq/wasm@file:../wasm/pkg": + version "0.3.3" + "@ampproject/remapping@^2.0.0": version "2.1.1" resolved "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.1.1.tgz" From 58f1852099fdda17c43b99a75289ec4a05114e3c Mon Sep 17 00:00:00 2001 From: JohnDonavon Date: Tue, 28 Feb 2023 10:44:28 -0800 Subject: [PATCH 6/6] checkpt --- Cargo.lock | 3 + wasm/Cargo.toml | 10 ++- wasm/src/lib.rs | 74 ++++++++++++++++++++- wasm/src/testworker.js | 25 +++++++ website/src/App.js | 10 ++- website/src/tabs/transaction/WasmWorkers.js | 33 +++++++++ 6 files changed, 152 insertions(+), 3 deletions(-) create mode 100644 wasm/src/testworker.js create mode 100644 website/src/tabs/transaction/WasmWorkers.js diff --git a/Cargo.lock b/Cargo.lock index 99968f580..3371769f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1884,6 +1884,7 @@ dependencies = [ "hashbrown 0.13.2", "hex", "itertools", + "js-sys", "parking_lot", "rand", "rand_chacha", @@ -1898,6 +1899,8 @@ dependencies = [ "snarkvm-r1cs", "snarkvm-utilities", "thiserror", + "wasm-bindgen", + "web-sys", ] [[package]] diff --git a/wasm/Cargo.toml b/wasm/Cargo.toml index 140f59237..8119e2d31 100644 --- a/wasm/Cargo.toml +++ b/wasm/Cargo.toml @@ -70,7 +70,15 @@ version = "0.3" [dependencies.web-sys] version = "0.3" -features = ["console"] +features = [ + 'console', + 'Document', + 'HtmlElement', + 'HtmlInputElement', + 'MessageEvent', + 'Window', + 'Worker', +] [dependencies.console_error_panic_hook] version = "0.1.7" diff --git a/wasm/src/lib.rs b/wasm/src/lib.rs index a2a6f5d3f..6be6e856c 100644 --- a/wasm/src/lib.rs +++ b/wasm/src/lib.rs @@ -15,6 +15,7 @@ // along with the Aleo library. If not, see . pub mod account; + pub use account::*; pub mod record; @@ -26,4 +27,75 @@ pub use program::*; pub(crate) mod types; pub(crate) use types::*; -// pub use wasm_bindgen_rayon::init_thread_pool; +// Messing with WebWorkers +use std::cell::RefCell; +use std::rc::Rc; +use wasm_bindgen::prelude::*; +use web_sys::{console, HtmlElement, HtmlInputElement, MessageEvent, Worker}; + +#[wasm_bindgen(module = "./testworker.js")] +extern "C" { + // #[wasm_bindgen(js_name = startWorker)] + fn start_workers(module: JsValue) -> Promise; +} + +#[wasm_bindgen] +pub unsafe fn start_up_worker() { + let worker_handle = Rc::new(RefCell::new(Worker::new("./testworker.js").unwrap())); + console::log_1(&"Created a new worker from within WASM".into()); + + setup_input_oninput_callback(worker_handle.clone()); +} + +unsafe fn setup_input_oninput_callback(worker: Rc>) { + console::log_1(&"before create document".into()); + let document = web_sys::window().unwrap().document().unwrap(); + + // If our `onmessage` callback should stay valid after exiting from the + // `oninput` closure scope, we need to either forget it (so it is not + // destroyed) or store it somewhere. To avoid leaking memory every time we + // want to receive a response from the worker, we move a handle into the + // `oninput` closure to which we will always attach the last `onmessage` + // callback. The initial value will not be used and we silence the warning. + #[allow(unused_assignments)] + let mut persistent_callback_handle = get_on_msg_callback(); + + console::log_1(&"before create callback".into()); + let callback = Closure::new(move |number: MessageEvent| { + console::log_1(&"oninput callback triggered".into()); + + // Access worker behind shared handle, following the interior + // mutability pattern. + let worker_handle = &*worker.borrow(); + let _ = worker_handle.post_message(&number.into()); + persistent_callback_handle = get_on_msg_callback(); + + // Since the worker returns the message asynchronously, we + // attach a callback to be triggered when the worker returns. + worker_handle + .set_onmessage(Some(persistent_callback_handle.as_ref().unchecked_ref())); + }); + + // Attach the closure as `oninput` callback to the input field. + console::log_1(&"before create input listener".into()); + document + .get_element_by_id("inputNumber") + .expect("#inputNumber should exist") + .dyn_ref::() + .expect("#inputNumber should be a HtmlInputElement") + .set_oninput(Some(callback.as_ref().unchecked_ref())); + + // Leaks memory. + console::log_1(&"before callback forget".into()); + callback.forget(); +} + +unsafe fn get_on_msg_callback() -> Closure { + let callback = Closure::new(move |event: MessageEvent| { + console::log_2(&"Received response: ".into(), &event.data().into()); + + console::log_1(&event.data().as_string().into()); + }); + + callback +} diff --git a/wasm/src/testworker.js b/wasm/src/testworker.js new file mode 100644 index 000000000..1bbf47ed4 --- /dev/null +++ b/wasm/src/testworker.js @@ -0,0 +1,25 @@ +// The worker has its own scope and no direct access to functions/objects of the +// global scope. We import the generated JS file to make `wasm_bindgen` +// available which we need to initialize our WASM code. +importScripts('./pkg/aleo_wasm.js'); + +console.log('Initializing worker'); + +async function init_wasm_in_worker() { + // Load the wasm file by awaiting the Promise returned by `wasm_bindgen`. + await wasm_bindgen('./pkg/aleo_wasm_bg.wasm'); + + // Set callback to handle messages passed to the worker. + self.onmessage = async event => { + // By using methods of a struct as reaction to messages passed to the + // worker, we can preserve our state between messages. + console.log(event); + console.log(event.data); + + // Send response back to be handled by callback in main thread. + // A simple pass through + self.postMessage(event.data); + }; +}; + +init_wasm_in_worker(); \ No newline at end of file diff --git a/website/src/App.js b/website/src/App.js index a2154cebf..0f013cec2 100644 --- a/website/src/App.js +++ b/website/src/App.js @@ -8,11 +8,12 @@ import {DecryptRecord} from "./tabs/record/DecryptRecord"; import {GetBlockByHeight} from "./tabs/rest/GetBlockByHeight"; import {GetBlockByHash} from "./tabs/rest/GetBlockByHash"; import { SendCredits } from './tabs/transaction/SendCredits'; +import { WasmWorkers } from './tabs/transaction/WasmWorkers'; const {Header, Content, Footer} = Layout; function App() { - const [menuIndex, setMenuIndex] = useState(3); + const [menuIndex, setMenuIndex] = useState(4); return ( @@ -23,6 +24,7 @@ function App() { setMenuIndex(1)}>Record setMenuIndex(2)}>REST API setMenuIndex(3)}>Send Credits + setMenuIndex(4)}>Play With Wasm Workers @@ -54,6 +56,12 @@ function App() { } + { + menuIndex === 4 && + <> + + + } diff --git a/website/src/tabs/transaction/WasmWorkers.js b/website/src/tabs/transaction/WasmWorkers.js new file mode 100644 index 000000000..eb49883c9 --- /dev/null +++ b/website/src/tabs/transaction/WasmWorkers.js @@ -0,0 +1,33 @@ +import React, {useState, useEffect} from "react"; +import {Card, Divider, Form, Input, Button } from "antd"; +const { TextArea } = Input; +import {useAleoWASM} from "../../aleo-wasm-hook"; +import {downloadAndStoreFiles, getSavedFile} from '../../db'; +import init, * as aleo from '@aleohq/wasm'; + +await init(); + +export const WasmWorkers = () => { + const aleo = useAleoWASM(); + const layout = {labelCol: {span: 4}, wrapperCol: {span: 21}}; + + useEffect(async () => { + await init(); + aleo.start_up_worker(); + }); + + if (aleo !== null) { + return +
+ + + +
+
+ } else { + return

+
Loading...
+

+ } +} \ No newline at end of file