Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/test_fixtures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ serde_json = { workspace = true }
alloy = { workspace = true, features = ["node-bindings", "sol-types", "rpc-types", "provider-http", "network", "contract", "signer-local"] }

[target.'cfg(target_family = "wasm")'.dependencies]
getrandom = { version = "0", features = ["js", "js-sys"] }
getrandom = { version = "0.2", features = ["js", "js-sys"] }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

getrandom 0.2 features js-sys crates.io documentation

💡 Result:

Short answer — getrandom 0.2 uses the feature name "js" to enable the wasm JavaScript backend (wasm32-unknown-unknown). Enabling it pulls in js-sys/wasm-bindgen and makes getrandom call the Web Crypto API (browser) or Node.js crypto methods; it should normally be enabled only for binaries/tests (not library crates). Example:

[dependencies]
getrandom = { version = "0.2", features = ["js"] }

References: docs.rs (getrandom 0.2). [1] Detailed explanation and recommendation in the crate source/readme. [2] Feature summary mentioning js-sys/wasm-bindgen. [3]

Sources:
[1] getrandom 0.2.2 — docs.rs. (docs.rs)
[2] getrandom crate lib.rs/readme (WASM/js docs). (janwalter.org)
[3] Feature flags summary (wasm_js / js-sys note). (lib.rs)

Citations:


🏁 Script executed:

# Check the actual Cargo.toml file to understand current state
cd crates/test_fixtures && cat -n Cargo.toml | grep -A 2 -B 2 "getrandom"

Repository: rainlanguage/rain.interpreter

Length of output: 207


🏁 Script executed:

# Try to find getrandom in the repo's lock file or check what version is actually used
fd -t f "Cargo.lock" -o "Cargo.toml" | head -1 | xargs cat | grep -A 2 "getrandom" | head -20

Repository: rainlanguage/rain.interpreter

Length of output: 212


🏁 Script executed:

cd crates/test_fixtures && cargo tree --target wasm32-unknown-unknown 2>&1 | head -30

Repository: rainlanguage/rain.interpreter

Length of output: 182


🏁 Script executed:

# Try to check if Cargo validates the features
cd crates/test_fixtures && cargo check --target wasm32-unknown-unknown 2>&1 | grep -i "js-sys\|feature" | head -20

Repository: rainlanguage/rain.interpreter

Length of output: 55


Remove invalid feature flag js-sys from getrandom dependency.

Getrandom 0.2 has a js feature that enables the wasm JavaScript backend and automatically pulls in js-sys as a transitive dependency. The js-sys is not itself a valid feature flag. This configuration would fail at compile time with an unknown feature error.

Apply this diff:

-getrandom = { version = "0.2", features = ["js", "js-sys"] }
+getrandom = { version = "0.2", features = ["js"] }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
getrandom = { version = "0.2", features = ["js", "js-sys"] }
getrandom = { version = "0.2", features = ["js"] }
🤖 Prompt for AI Agents
In crates/test_fixtures/Cargo.toml around line 15, the getrandom dependency
includes an invalid feature flag "js-sys"; remove "js-sys" from the features
list and leave only the valid "js" feature (e.g., features = ["js"]) so Cargo no
longer fails with an unknown feature error.