From 6ea7aa6dd45acd1e9be458ddfe7c6b2b3e3fe3b1 Mon Sep 17 00:00:00 2001 From: m3ultra Date: Sun, 26 Jul 2026 00:42:47 +1000 Subject: [PATCH] core: build rhai without ahash/runtime-rng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rhai's default feature set is ["std", "ahash/runtime-rng"]. The second half seeds hash maps from OS entropy, which is a run-to-run variation source living under a crate whose whole promise is byte-identical replays — and it pulls getrandom, which has no backend on wasm32-unknown-unknown, so the browser build could not compile at all. Dropping it leaves ahash on its compile-time seed. The canonical Neon Precinct playthrough produces byte-identical events before and after, and the suite is green. Co-Authored-By: Claude Opus 5 --- Cargo.lock | 38 ++------------------------------------ mrpci-core/Cargo.toml | 10 +++++++++- 2 files changed, 11 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e349609..9001122 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -16,7 +16,6 @@ checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" dependencies = [ "cfg-if", "const-random", - "getrandom 0.3.4", "once_cell", "version_check", "zerocopy", @@ -137,7 +136,7 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" dependencies = [ - "getrandom 0.2.17", + "getrandom", "once_cell", "tiny-keccak", ] @@ -274,18 +273,6 @@ dependencies = [ "wasi", ] -[[package]] -name = "getrandom" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" -dependencies = [ - "cfg-if", - "libc", - "r-efi", - "wasip2", -] - [[package]] name = "glam" version = "0.27.0" @@ -698,12 +685,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "r-efi" -version = "5.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" - [[package]] name = "rhai" version = "1.25.1" @@ -741,7 +722,7 @@ checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", "cfg-if", - "getrandom 0.2.17", + "getrandom", "libc", "untrusted", "windows-sys", @@ -1035,15 +1016,6 @@ version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" -[[package]] -name = "wasip2" -version = "1.0.4+wasi-0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" -dependencies = [ - "wit-bindgen", -] - [[package]] name = "wasm-bindgen" version = "0.2.126" @@ -1212,12 +1184,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" -[[package]] -name = "wit-bindgen" -version = "0.57.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" - [[package]] name = "writeable" version = "0.6.3" diff --git a/mrpci-core/Cargo.toml b/mrpci-core/Cargo.toml index 9471279..2f4bf0e 100644 --- a/mrpci-core/Cargo.toml +++ b/mrpci-core/Cargo.toml @@ -11,7 +11,15 @@ image = { version = "0.24", default-features = false, features = ["png"] } # PN # Room logic. "sync" keeps the engine Send+Sync (the HTTP surface shares # GameState across threads); "no_time" bans wall-clock from scripts, so a # replayed script is bit-identical — the whole CPU-speed-bug class, deleted. -rhai = { version = "1", features = ["sync", "no_time"] } +# +# default-features = false drops exactly one thing from rhai's default set: +# `ahash/runtime-rng`, which seeds hash maps from the OS entropy pool. We +# want the compile-time seed instead — one less source of run-to-run +# variation under a crate whose whole promise is byte-identical replays — +# and it's also what makes wasm32-unknown-unknown build at all (runtime-rng +# pulls getrandom, which has no default backend there). "std" is the rest of +# rhai's default and stays on. +rhai = { version = "1", default-features = false, features = ["std", "sync", "no_time"] } # Native-only: the HTTP surface and the AI parser lane don't exist in # browser builds (wasm gets the deterministic parser and bundles).