From ec9e5386bc8e322a0f08682def8e3ee5b6ff6c89 Mon Sep 17 00:00:00 2001 From: "matej.vukosav" Date: Wed, 20 Nov 2024 17:31:04 +0800 Subject: [PATCH] refactor: clean --- Cargo.lock | 399 +---------------------------------- crates/merod/Cargo.toml | 1 - crates/runtime/README.md | 38 ++-- crates/runtime/src/memory.rs | 5 + 4 files changed, 32 insertions(+), 411 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 031345be0..332cf606f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -741,24 +741,11 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "bstr" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a68f1f47cdf0ec8ee4b941b2eee2a80cb796db73118c0dd09ac63fbe405be22" -dependencies = [ - "memchr", - "serde", -] - [[package]] name = "bumpalo" version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" -dependencies = [ - "allocator-api2", -] [[package]] name = "byte-slice-cast" @@ -1016,7 +1003,7 @@ dependencies = [ "hex", "near-sdk", "near-workspaces", - "semver 1.0.23", + "semver", "serde_json", "tokio", ] @@ -1362,15 +1349,6 @@ dependencies = [ "strsim", ] -[[package]] -name = "clap_complete" -version = "4.5.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa3c596da3cf0983427b0df0dba359df9182c13bd5b519b585a482b0c351f4e8" -dependencies = [ - "clap", -] - [[package]] name = "clap_derive" version = "4.5.13" @@ -1431,16 +1409,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "console_static_text" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47a00bd3837aa7e8dc15766ded788486eba8aee03dab4e56f7c7051012a81c23" -dependencies = [ - "unicode-width", - "vte", -] - [[package]] name = "const-oid" version = "0.9.6" @@ -1678,31 +1646,6 @@ version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" -[[package]] -name = "crossterm" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" -dependencies = [ - "bitflags 2.6.0", - "crossterm_winapi", - "libc", - "mio 0.8.11", - "parking_lot", - "signal-hook", - "signal-hook-mio", - "winapi", -] - -[[package]] -name = "crossterm_winapi" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" -dependencies = [ - "winapi", -] - [[package]] name = "crunchy" version = "0.2.2" @@ -1751,7 +1694,7 @@ dependencies = [ "curve25519-dalek-derive", "digest 0.10.7", "fiat-crypto", - "rustc_version 0.4.0", + "rustc_version", "subtle", "zeroize", ] @@ -1920,7 +1863,7 @@ dependencies = [ "convert_case 0.4.0", "proc-macro2", "quote", - "rustc_version 0.4.0", + "rustc_version", "syn 2.0.72", ] @@ -1997,95 +1940,12 @@ dependencies = [ "syn 2.0.72", ] -[[package]] -name = "dissimilar" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86e3bdc80eee6e16b2b6b0f87fbc98c04bee3455e35174c0de1a125d0688c632" - -[[package]] -name = "dprint" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d05577ccb73ce51e5bc43edba47251465b7054833c640d09b5a58d4a15e5169" -dependencies = [ - "anyhow", - "clap", - "clap_complete", - "console_static_text", - "crossterm", - "dirs", - "dissimilar", - "dprint-core", - "dunce", - "fs3", - "ignore", - "indexmap 2.6.0", - "jsonc-parser", - "once_cell", - "parking_lot", - "percent-encoding", - "rand 0.8.5", - "rkyv", - "rustls 0.21.12", - "rustls-native-certs", - "rustls-pemfile 1.0.4", - "serde", - "serde_json", - "sha2", - "similar", - "sysinfo", - "text-size", - "thiserror", - "tokio", - "tokio-util", - "tower-lsp", - "twox-hash", - "ureq", - "url", - "wasmer", - "wasmer-compiler", - "webpki-roots 0.25.4", - "winreg 0.52.0", - "zip", -] - -[[package]] -name = "dprint-core" -version = "0.66.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3ab0dd2bedc109d25f0d21afb09b7d329f6c6fa83b095daf31d2d967e091548" -dependencies = [ - "anyhow", - "async-trait", - "bumpalo", - "crossbeam-channel", - "futures", - "hashbrown 0.14.5", - "indexmap 2.6.0", - "libc", - "parking_lot", - "rustc-hash 1.1.0", - "serde", - "serde_json", - "tokio", - "tokio-util", - "unicode-width", - "winapi", -] - [[package]] name = "dtoa" version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" -[[package]] -name = "dunce" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" - [[package]] name = "dyn-clone" version = "1.0.17" @@ -2475,17 +2335,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "fs3" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb17cf6ed704f72485332f6ab65257460c4f9f3083934cf402bf9f5b3b600a90" -dependencies = [ - "libc", - "rustc_version 0.2.3", - "winapi", -] - [[package]] name = "fsevent-sys" version = "4.1.0" @@ -2737,19 +2586,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" -[[package]] -name = "globset" -version = "0.4.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19" -dependencies = [ - "aho-corasick", - "bstr", - "log", - "regex-automata 0.4.7", - "regex-syntax 0.8.4", -] - [[package]] name = "group" version = "0.13.0" @@ -3387,7 +3223,7 @@ dependencies = [ "rtnetlink", "system-configuration", "tokio", - "windows 0.51.1", + "windows", ] [[package]] @@ -3409,22 +3245,6 @@ dependencies = [ "xmltree", ] -[[package]] -name = "ignore" -version = "0.4.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d89fd380afde86567dfba715db065673989d6253f42b88179abd3eae47bda4b" -dependencies = [ - "crossbeam-deque", - "globset", - "log", - "memchr", - "regex-automata 0.4.7", - "same-file", - "walkdir", - "winapi-util", -] - [[package]] name = "impl-codec" version = "0.6.0" @@ -3622,16 +3442,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9dbbfed4e59ba9750e15ba154fdfd9329cee16ff3df539c2666b70f58cc32105" -[[package]] -name = "jsonc-parser" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7725c320caac8c21d8228c1d055af27a995d371f78cc763073d3e068323641b5" -dependencies = [ - "indexmap 2.6.0", - "serde_json", -] - [[package]] name = "jsonptr" version = "0.4.7" @@ -4422,19 +4232,6 @@ dependencies = [ "linked-hash-map", ] -[[package]] -name = "lsp-types" -version = "0.94.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c66bfd44a06ae10647fe3f8214762e9369fd4248df1350924b4ef9e770a85ea1" -dependencies = [ - "bitflags 1.3.2", - "serde", - "serde_json", - "serde_repr", - "url", -] - [[package]] name = "lz4-sys" version = "1.10.0" @@ -4569,7 +4366,6 @@ dependencies = [ "color-eyre", "const_format", "dirs", - "dprint", "eyre", "futures-util", "hex", @@ -4725,7 +4521,7 @@ checksum = "7c49593c9e94454a2368a4c0a511bf4bf1413aff4d23f16e1d8f4e64b5215351" dependencies = [ "borsh", "schemars", - "semver 1.0.23", + "semver", "serde", ] @@ -5521,15 +5317,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "ntapi" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8a3895c6391c39d7fe7ebc444a87eb2991b2a0bc718fdabd071eec617fc68e4" -dependencies = [ - "winapi", -] - [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -6748,22 +6535,13 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver 0.9.0", -] - [[package]] name = "rustc_version" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.23", + "semver", ] [[package]] @@ -6815,18 +6593,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "rustls-native-certs" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" -dependencies = [ - "openssl-probe", - "rustls-pemfile 1.0.4", - "schannel", - "security-framework", -] - [[package]] name = "rustls-pemfile" version = "1.0.4" @@ -7029,27 +6795,12 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d369a96f978623eb3dc28807c4852d6cc617fed53da5d3c400feff1ef34a714a" -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - [[package]] name = "semver" version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - [[package]] name = "serde" version = "1.0.204" @@ -7117,7 +6868,6 @@ version = "1.0.122" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "784b6203951c57ff748476b126ccb5e8e2959a5c19e5c617ab1956be3dbc68da" dependencies = [ - "indexmap 2.6.0", "itoa", "memchr", "ryu", @@ -7302,27 +7052,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" -[[package]] -name = "signal-hook" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" -dependencies = [ - "libc", - "signal-hook-registry", -] - -[[package]] -name = "signal-hook-mio" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34db1a06d485c9142248b7a054f034b349b212551f3dfd19c94d45a754a217cd" -dependencies = [ - "libc", - "mio 0.8.11", - "signal-hook", -] - [[package]] name = "signal-hook-registry" version = "1.4.2" @@ -7347,12 +7076,6 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" -[[package]] -name = "similar" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1de1d4f81173b03af4c0cbed3c898f6bff5b870e4a7f5d6f4057d62a7a4b686e" - [[package]] name = "simple_asn1" version = "0.6.2" @@ -7415,7 +7138,7 @@ dependencies = [ "curve25519-dalek", "rand_core 0.6.4", "ring 0.17.8", - "rustc_version 0.4.0", + "rustc_version", "sha2", "subtle", ] @@ -7430,17 +7153,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "socks" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c3dbbd9ae980613c6dd8e28a9407b50509d3803b57624d5dfe8315218cd58b" -dependencies = [ - "byteorder", - "libc", - "winapi", -] - [[package]] name = "soketto" version = "0.7.1" @@ -7782,20 +7494,6 @@ dependencies = [ "syn 2.0.72", ] -[[package]] -name = "sysinfo" -version = "0.30.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a5b4ddaee55fb2bea2bf0e5000747e5f5c0de765e5a5ff87f4cd106439f4bb3" -dependencies = [ - "cfg-if 1.0.0", - "core-foundation-sys", - "libc", - "ntapi", - "once_cell", - "windows 0.52.0", -] - [[package]] name = "system-configuration" version = "0.5.1" @@ -7882,12 +7580,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "text-size" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f18aa187839b2bdb1ad2fa35ead8c4c2976b64e4363c386d45ac0f7ee85c9233" - [[package]] name = "thiserror" version = "1.0.63" @@ -8230,40 +7922,6 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" -[[package]] -name = "tower-lsp" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4ba052b54a6627628d9b3c34c176e7eda8359b7da9acd497b9f20998d118508" -dependencies = [ - "async-trait", - "auto_impl", - "bytes", - "dashmap", - "futures", - "httparse", - "lsp-types", - "memchr", - "serde", - "serde_json", - "tokio", - "tokio-util", - "tower", - "tower-lsp-macros", - "tracing", -] - -[[package]] -name = "tower-lsp-macros" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84fd902d4e0b9a4b27f2f440108dc034e1758628a9b702f8ec61ad66355422fa" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.72", -] - [[package]] name = "tower-service" version = "0.3.2" @@ -8450,17 +8108,6 @@ dependencies = [ "utf-8", ] -[[package]] -name = "twox-hash" -version = "1.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" -dependencies = [ - "cfg-if 1.0.0", - "rand 0.8.5", - "static_assertions", -] - [[package]] name = "typed-arena" version = "2.0.2" @@ -8583,7 +8230,6 @@ dependencies = [ "once_cell", "rustls 0.23.12", "rustls-pki-types", - "socks", "url", "webpki-roots 0.26.3", ] @@ -8700,27 +8346,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -[[package]] -name = "vte" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40eb22ae96f050e0c0d6f7ce43feeae26c348fc4dea56928ca81537cfaa6188b" -dependencies = [ - "arrayvec 0.7.4", - "utf8parse", - "vte_generate_state_changes", -] - -[[package]] -name = "vte_generate_state_changes" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e369bee1b05d510a7b4ed645f5faa90619e05437111783ea5848f28d97d3c2e" -dependencies = [ - "proc-macro2", - "quote", -] - [[package]] name = "walkdir" version = "2.5.0" @@ -9137,16 +8762,6 @@ dependencies = [ "windows-targets 0.48.5", ] -[[package]] -name = "windows" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" -dependencies = [ - "windows-core 0.52.0", - "windows-targets 0.52.6", -] - [[package]] name = "windows-core" version = "0.51.1" diff --git a/crates/merod/Cargo.toml b/crates/merod/Cargo.toml index a44d45edc..8332cc326 100644 --- a/crates/merod/Cargo.toml +++ b/crates/merod/Cargo.toml @@ -37,7 +37,6 @@ calimero-network = { path = "../network" } calimero-server = { path = "../server", features = ["jsonrpc", "websocket", "admin"] } calimero-store = { path = "../store" } husky-rs.workspace = true -dprint.workspace = true [lints] workspace = true diff --git a/crates/runtime/README.md b/crates/runtime/README.md index e297bfd4d..5244461e9 100644 --- a/crates/runtime/README.md +++ b/crates/runtime/README.md @@ -3,24 +3,25 @@ [Serde]: https://serde.rs/ [Wasmer]: https://wasmer.io/ -- [Introduction](#introduction) -- [Core components](#core-components) - - [Overview](#overview) - - [VMLogic](#vmlogic) - - [Host functions](#host-functions) - - [Resource limits](#resource-limits) - - [Storage](#storage) - - [Error handling](#error-handling) - - [Serialisation and deserialisation](#serialisation-and-deserialisation) -- [Operational flow](#operational-flow) -- [Detailed component descriptions](#detailed-component-descriptions) - - [Wasm module execution (`run()` function)](#wasm-module-execution-run-function) - - [VMLogic](#vmlogic-1) - - [Host functions](#host-functions-1) - - [Memory management](#memory-management) - - [Storage](#storage-1) - - [Error handling](#error-handling-1) -- [Usage examples](#usage-examples) +- [Calimero runtime](#calimero-runtime) + - [Introduction](#introduction) + - [Core components](#core-components) + - [Overview](#overview) + - [VMLogic](#vmlogic) + - [Host functions](#host-functions) + - [Resource limits](#resource-limits) + - [Storage](#storage) + - [Error handling](#error-handling) + - [Operational flow](#operational-flow) + - [Detailed component descriptions](#detailed-component-descriptions) + - [Topology](#topology) + - [Wasm module execution (`run()` function)](#wasm-module-execution-run-function) + - [VMLogic](#vmlogic-1) + - [Host functions](#host-functions-1) + - [Memory management](#memory-management) + - [Storage](#storage-1) + - [Error handling](#error-handling-1) + - [Usage examples](#usage-examples) ## Introduction @@ -28,6 +29,7 @@ The Calimero runtime is a lightweight, sandboxed execution environment for WebAssembly (Wasm) modules. It provides a secure and controlled platform for running untrusted code with defined resource limits and a set of host-provided functions. The runtime is designed to facilitate the execution of smart + contracts or similar applications in a blockchain-like environment. Its modular design allows for easy extension and customisation, making it suitable for various applications requiring sandboxed execution of untrusted code. diff --git a/crates/runtime/src/memory.rs b/crates/runtime/src/memory.rs index 8683f7cec..90df12296 100644 --- a/crates/runtime/src/memory.rs +++ b/crates/runtime/src/memory.rs @@ -22,6 +22,11 @@ impl WasmerTunables { dynamic_memory_offset_guard_size: u64::from(WASM_MAX_PAGES), }; + + + + + let vmconfig = VMConfig { wasm_stack_size: Some(limits.max_stack_size), };