From 9e2530861f8424c99391bc7cf64efd50ca5f0ae4 Mon Sep 17 00:00:00 2001 From: Quentin Gliech Date: Thu, 2 May 2024 10:25:21 +0200 Subject: [PATCH] Disable wasmtime cache, enable parallel compilation, add deny exception --- Cargo.lock | 156 +-------------------------------------- crates/cli/Cargo.toml | 7 +- crates/policy/Cargo.toml | 3 +- crates/policy/src/lib.rs | 11 +-- deny.toml | 1 + 5 files changed, 7 insertions(+), 171 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 905c6201..15df6b6c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -849,10 +849,6 @@ name = "cc" version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" -dependencies = [ - "jobserver", - "libc", -] [[package]] name = "cesu8" @@ -1518,27 +1514,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "directories-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" -dependencies = [ - "cfg-if", - "dirs-sys-next", -] - -[[package]] -name = "dirs-sys-next" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - [[package]] name = "displaydoc" version = "0.2.4" @@ -2820,15 +2795,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" -[[package]] -name = "jobserver" -version = "0.1.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6" -dependencies = [ - "libc", -] - [[package]] name = "js-sys" version = "0.3.69" @@ -2934,17 +2900,6 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" -[[package]] -name = "libredox" -version = "0.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" -dependencies = [ - "bitflags 2.5.0", - "libc", - "redox_syscall", -] - [[package]] name = "libsqlite3-sys" version = "0.27.0" @@ -4544,7 +4499,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" dependencies = [ "once_cell", - "toml_edit 0.19.15", + "toml_edit", ] [[package]] @@ -4721,17 +4676,6 @@ dependencies = [ "bitflags 1.3.2", ] -[[package]] -name = "redox_users" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" -dependencies = [ - "getrandom", - "libredox", - "thiserror", -] - [[package]] name = "regalloc2" version = "0.9.3" @@ -5364,15 +5308,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_spanned" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" -dependencies = [ - "serde", -] - [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -6093,26 +6028,11 @@ dependencies = [ "tracing", ] -[[package]] -name = "toml" -version = "0.8.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit 0.22.12", -] - [[package]] name = "toml_datetime" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" -dependencies = [ - "serde", -] [[package]] name = "toml_edit" @@ -6122,20 +6042,7 @@ checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ "indexmap 2.2.5", "toml_datetime", - "winnow 0.5.40", -] - -[[package]] -name = "toml_edit" -version = "0.22.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3328d4f68a705b2a4498da1d580585d39a6510f98318a2cec3018a7ec61ddef" -dependencies = [ - "indexmap 2.2.5", - "serde", - "serde_spanned", - "toml_datetime", - "winnow 0.6.7", + "winnow", ] [[package]] @@ -6637,13 +6544,13 @@ dependencies = [ "object 0.33.0", "once_cell", "paste", + "rayon", "rustix 0.38.31", "serde", "serde_derive", "serde_json", "target-lexicon", "wasmparser", - "wasmtime-cache", "wasmtime-component-macro", "wasmtime-cranelift", "wasmtime-environ", @@ -6663,26 +6570,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "wasmtime-cache" -version = "20.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98534bf28de232299e83eab33984a7a6c40c69534d6bd0ea216150b63d41a83a" -dependencies = [ - "anyhow", - "base64 0.21.7", - "bincode", - "directories-next", - "log", - "rustix 0.38.31", - "serde", - "serde_derive", - "sha2", - "toml", - "windows-sys 0.52.0", - "zstd", -] - [[package]] name = "wasmtime-component-macro" version = "20.0.0" @@ -7070,15 +6957,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "winnow" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14b9415ee827af173ebb3f15f9083df5a122eb93572ec28741fb153356ea2578" -dependencies = [ - "memchr", -] - [[package]] name = "wiremock" version = "0.6.0" @@ -7246,31 +7124,3 @@ dependencies = [ "quote", "syn 2.0.53", ] - -[[package]] -name = "zstd" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d789b1514203a1120ad2429eae43a7bd32b90976a7bb8a05f7ec02fa88cc23a" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "7.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd99b45c6bc03a018c8b8a86025678c87e55526064e38f9df301989dce7ec0a" -dependencies = [ - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "2.0.10+zstd.1.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c253a4914af5bafc8fa8c86ee400827e83cf6ec01195ec1f1ed8441bf00d65aa" -dependencies = [ - "cc", - "pkg-config", -] diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 87dfe5dd..2086f8fd 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -77,13 +77,8 @@ mas-tower.workspace = true oauth2-types.workspace = true [features] -default = ["policy-cache"] - # Features used for the prebuilt binaries -dist = ["policy-cache", "mas-config/dist"] +dist = ["mas-config/dist"] # Features used in the Docker image docker = ["mas-config/docker"] - -# Enable wasmtime compilation cache -policy-cache = ["mas-policy/cache"] diff --git a/crates/policy/Cargo.toml b/crates/policy/Cargo.toml index 40b48975..d0bbd444 100644 --- a/crates/policy/Cargo.toml +++ b/crates/policy/Cargo.toml @@ -20,7 +20,7 @@ schemars = { workspace = true, optional = true } thiserror.workspace = true tokio = { version = "1.37.0", features = ["io-util", "rt"] } tracing.workspace = true -wasmtime = { version = "20.0.0", default-features = false, features = ["async", "cranelift"] } +wasmtime = { version = "20.0.0", default-features = false, features = ["async", "cranelift", "parallel-compilation"] } mas-data-model.workspace = true oauth2-types.workspace = true @@ -29,7 +29,6 @@ oauth2-types.workspace = true tokio = { version = "1.37.0", features = ["fs", "rt", "macros"] } [features] -cache = ["wasmtime/cache"] jsonschema = ["dep:schemars"] [[bin]] diff --git a/crates/policy/src/lib.rs b/crates/policy/src/lib.rs index 3bcf744f..99a1720f 100644 --- a/crates/policy/src/lib.rs +++ b/crates/policy/src/lib.rs @@ -43,10 +43,6 @@ pub enum LoadError { #[error("failed to instantiate a test instance")] Instantiate(#[source] InstantiateError), - - #[cfg(feature = "cache")] - #[error("could not load wasmtime cache configuration")] - CacheSetup(#[source] anyhow::Error), } #[derive(Debug, Error)] @@ -99,12 +95,7 @@ impl PolicyFactory { ) -> Result { let mut config = Config::default(); config.async_support(true); - config.cranelift_opt_level(wasmtime::OptLevel::Speed); - - #[cfg(feature = "cache")] - config - .cache_config_load_default() - .map_err(LoadError::CacheSetup)?; + config.cranelift_opt_level(wasmtime::OptLevel::SpeedAndSize); let engine = Engine::new(&config).map_err(LoadError::Engine)?; diff --git a/deny.toml b/deny.toml index ff229124..8f2f2d27 100644 --- a/deny.toml +++ b/deny.toml @@ -71,6 +71,7 @@ skip = [ { name = "regex-automata", version = "0.2.0" }, # icu_list depends on this old version { name = "socket2", version = "0.4.10" }, # old hyper version depends on this old version { name = "indexmap", version = "1.9.3" }, # schemars depends on this old version + { name = "object", version = "0.32.2" }, # sentry-backtrace depends on this old version { name = "itertools", version = "0.10.5" }, # wasmtime & others depends on the old version { name = "itertools", version = "0.11.0" }, { name = "bitflags", version = "1.3.2" }, # axum depends on an old version