Disable wasmtime cache, enable parallel compilation, add deny exception

This commit is contained in:
Quentin Gliech
2024-05-02 10:25:21 +02:00
parent afaa36b29b
commit dbdb72226a
5 changed files with 7 additions and 171 deletions

156
Cargo.lock generated
View File

@@ -849,10 +849,6 @@ name = "cc"
version = "1.0.90" version = "1.0.90"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5"
dependencies = [
"jobserver",
"libc",
]
[[package]] [[package]]
name = "cesu8" name = "cesu8"
@@ -1518,27 +1514,6 @@ dependencies = [
"subtle", "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]] [[package]]
name = "displaydoc" name = "displaydoc"
version = "0.2.4" version = "0.2.4"
@@ -2820,15 +2795,6 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"
[[package]]
name = "jobserver"
version = "0.1.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "js-sys" name = "js-sys"
version = "0.3.69" version = "0.3.69"
@@ -2934,17 +2900,6 @@ version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" 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]] [[package]]
name = "libsqlite3-sys" name = "libsqlite3-sys"
version = "0.27.0" version = "0.27.0"
@@ -4544,7 +4499,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919"
dependencies = [ dependencies = [
"once_cell", "once_cell",
"toml_edit 0.19.15", "toml_edit",
] ]
[[package]] [[package]]
@@ -4721,17 +4676,6 @@ dependencies = [
"bitflags 1.3.2", "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]] [[package]]
name = "regalloc2" name = "regalloc2"
version = "0.9.3" version = "0.9.3"
@@ -5364,15 +5308,6 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "serde_spanned"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1"
dependencies = [
"serde",
]
[[package]] [[package]]
name = "serde_urlencoded" name = "serde_urlencoded"
version = "0.7.1" version = "0.7.1"
@@ -6093,26 +6028,11 @@ dependencies = [
"tracing", "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]] [[package]]
name = "toml_datetime" name = "toml_datetime"
version = "0.6.5" version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1"
dependencies = [
"serde",
]
[[package]] [[package]]
name = "toml_edit" name = "toml_edit"
@@ -6122,20 +6042,7 @@ checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
dependencies = [ dependencies = [
"indexmap 2.2.5", "indexmap 2.2.5",
"toml_datetime", "toml_datetime",
"winnow 0.5.40", "winnow",
]
[[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",
] ]
[[package]] [[package]]
@@ -6637,13 +6544,13 @@ dependencies = [
"object 0.33.0", "object 0.33.0",
"once_cell", "once_cell",
"paste", "paste",
"rayon",
"rustix 0.38.31", "rustix 0.38.31",
"serde", "serde",
"serde_derive", "serde_derive",
"serde_json", "serde_json",
"target-lexicon", "target-lexicon",
"wasmparser", "wasmparser",
"wasmtime-cache",
"wasmtime-component-macro", "wasmtime-component-macro",
"wasmtime-cranelift", "wasmtime-cranelift",
"wasmtime-environ", "wasmtime-environ",
@@ -6663,26 +6570,6 @@ dependencies = [
"cfg-if", "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]] [[package]]
name = "wasmtime-component-macro" name = "wasmtime-component-macro"
version = "20.0.0" version = "20.0.0"
@@ -7070,15 +6957,6 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "winnow"
version = "0.6.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14b9415ee827af173ebb3f15f9083df5a122eb93572ec28741fb153356ea2578"
dependencies = [
"memchr",
]
[[package]] [[package]]
name = "wiremock" name = "wiremock"
version = "0.6.0" version = "0.6.0"
@@ -7246,31 +7124,3 @@ dependencies = [
"quote", "quote",
"syn 2.0.53", "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",
]

View File

@@ -77,13 +77,8 @@ mas-tower.workspace = true
oauth2-types.workspace = true oauth2-types.workspace = true
[features] [features]
default = ["policy-cache"]
# Features used for the prebuilt binaries # Features used for the prebuilt binaries
dist = ["policy-cache", "mas-config/dist"] dist = ["mas-config/dist"]
# Features used in the Docker image # Features used in the Docker image
docker = ["mas-config/docker"] docker = ["mas-config/docker"]
# Enable wasmtime compilation cache
policy-cache = ["mas-policy/cache"]

View File

@@ -20,7 +20,7 @@ schemars = { workspace = true, optional = true }
thiserror.workspace = true thiserror.workspace = true
tokio = { version = "1.37.0", features = ["io-util", "rt"] } tokio = { version = "1.37.0", features = ["io-util", "rt"] }
tracing.workspace = true 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 mas-data-model.workspace = true
oauth2-types.workspace = true oauth2-types.workspace = true
@@ -29,7 +29,6 @@ oauth2-types.workspace = true
tokio = { version = "1.37.0", features = ["fs", "rt", "macros"] } tokio = { version = "1.37.0", features = ["fs", "rt", "macros"] }
[features] [features]
cache = ["wasmtime/cache"]
jsonschema = ["dep:schemars"] jsonschema = ["dep:schemars"]
[[bin]] [[bin]]

View File

@@ -43,10 +43,6 @@ pub enum LoadError {
#[error("failed to instantiate a test instance")] #[error("failed to instantiate a test instance")]
Instantiate(#[source] InstantiateError), Instantiate(#[source] InstantiateError),
#[cfg(feature = "cache")]
#[error("could not load wasmtime cache configuration")]
CacheSetup(#[source] anyhow::Error),
} }
#[derive(Debug, Error)] #[derive(Debug, Error)]
@@ -99,12 +95,7 @@ impl PolicyFactory {
) -> Result<Self, LoadError> { ) -> Result<Self, LoadError> {
let mut config = Config::default(); let mut config = Config::default();
config.async_support(true); config.async_support(true);
config.cranelift_opt_level(wasmtime::OptLevel::Speed); config.cranelift_opt_level(wasmtime::OptLevel::SpeedAndSize);
#[cfg(feature = "cache")]
config
.cache_config_load_default()
.map_err(LoadError::CacheSetup)?;
let engine = Engine::new(&config).map_err(LoadError::Engine)?; let engine = Engine::new(&config).map_err(LoadError::Engine)?;

View File

@@ -71,6 +71,7 @@ skip = [
{ name = "regex-automata", version = "0.2.0" }, # icu_list depends on this old version { 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 = "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 = "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.10.5" }, # wasmtime & others depends on the old version
{ name = "itertools", version = "0.11.0" }, { name = "itertools", version = "0.11.0" },
{ name = "bitflags", version = "1.3.2" }, # axum depends on an old version { name = "bitflags", version = "1.3.2" }, # axum depends on an old version