-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Summary
Building CrabGraph for the wasm32-unknown-unknown target is currently not supported in v0.3.3 due to a dependency version conflict introduced by the getrandom 0.2.x → 0.3.4 upgrade.
Root Cause
Cargo's unified feature resolution cannot enable different features for different versions of the same crate. When building for WASM:
Two versions of getrandom are required simultaneously:
-
getrandom 0.2.x (transitive dependency)
- Via:
ed25519-dalek 2.2.0→rand_core 0.6.4→getrandom 0.2.x - Requires:
jsfeature flag for WASM support
- Via:
-
getrandom 0.3.4 (direct dependency)
- Our explicit dependency for random number generation
- Requires:
wasm_jsfeature flag for WASM support
The Conflict:
- getrandom 0.2.x has
jsfeature (removed in 0.3.x) - getrandom 0.3.x has
wasm_jsfeature (didn't exist in 0.2.x) - Cargo cannot enable both
jsandwasm_jsfor different versions
Impact
- ❌ Affected:
wasm32-unknown-unknowntarget builds - ✅ Unaffected: All other platforms (Windows, Linux, macOS, iOS, Android, other wasm targets)
- ✅ Workaround: Use CrabGraph v0.3.2 for WASM projects
Timeline for Resolution
This issue will be automatically resolved when upgrading to the next generation of Dalek cryptography crates:
Required Upgrades
ed25519-dalek = "3.0.0" # Currently: 2.2.0 (stable)
x25519-dalek = "3.0.0" # Currently: 2.0.1 (stable)Current Status (as of November 2025):
- ed25519-dalek 3.0.0-pre.1 available (pre-release)
- x25519-dalek 3.0.0-pre.1 available (pre-release)
- Both use
curve25519-dalek 4.xwhich depends onrand_core 0.9.x rand_core 0.9.xusesgetrandom 0.3.x(compatible with our upgrade!)
Expected Stable Release: Q1 2026
MSRV Impact
Upgrading to Dalek 3.0 will require:
- Current MSRV: Rust 1.70
- New MSRV: Rust 1.81+ (required by ed25519-dalek 3.0)
Technical Details
Dependency Chain (Current - v0.3.3)
crabgraph 0.3.3
├── getrandom 0.3.4 (direct) ← needs wasm_js feature
├── ed25519-dalek 2.2.0
│ └── rand_core 0.6.4
│ └── getrandom 0.2.x ← needs js feature
└── x25519-dalek 2.0.1
└── rand_core 0.6.4
└── getrandom 0.2.x ← needs js feature
After Dalek 3.0 Upgrade (Future)
crabgraph 0.4.0
├── getrandom 0.3.4 (direct) ← wasm_js feature
├── ed25519-dalek 3.0.0
│ └── rand_core 0.9.x
│ └── getrandom 0.3.x ← wasm_js feature ✅
└── x25519-dalek 3.0.0
└── rand_core 0.9.x
└── getrandom 0.3.x ← wasm_js feature ✅
Action Items
For Users
- Need WASM support now? → Use CrabGraph v0.3.2
- Don't need WASM? → Use v0.3.3 (recommended - latest features)
For Maintainers
- Document limitation in CHANGELOG.md (v0.3.3)
- Add warning to README.md WASM feature description
- Add comments in Cargo.toml explaining the issue
- Monitor ed25519-dalek 3.0 stable release
- Monitor x25519-dalek 3.0 stable release
- Create upgrade PR when stable versions available
- Bump MSRV to 1.81 in upgrade PR
- Test WASM build after upgrade
- Update CHANGELOG.md noting WASM support restored
Alternative Solutions Considered
❌ Downgrade getrandom back to 0.2.x
- Pro: Immediate WASM fix
- Con: Miss security improvements and new features in 0.3.x
- Con: getrandom 0.2.x is older, will eventually be deprecated
- Decision: Not chosen - forward compatibility preferred
❌ Upgrade to Dalek 3.0-pre now
- Pro: Immediate WASM fix
- Con: Pre-release versions (not production-ready)
- Con: Requires MSRV bump to 1.81 (breaking for users on older Rust)
- Decision: Not chosen - wait for stable releases
✅ Document limitation and wait for stable Dalek 3.0
- Pro: Gets getrandom 0.3.4 improvements immediately
- Pro: Users on older Rust versions unaffected
- Pro: Clear upgrade path when ecosystem ready
- Con: Temporary WASM limitation
- Decision: Chosen - best balance of stability and progress
Related Dependencies Waiting for Stable Releases
When Dalek 3.0 is stable, we can also consider upgrading the broader RustCrypto ecosystem (all currently RC):
# AEAD
aes-gcm = "0.11.0" # Currently: 0.10.3
chacha20poly1305 = "0.11.0" # Currently: 0.10.1
# KDF
pbkdf2 = "0.13.0" # Currently: 0.12.2
argon2 = "0.6.0" # Currently: 0.5.3
hkdf = "0.13.0" # Currently: 0.12.4
# Hash
sha2 = "0.11.0" # Currently: 0.10.9
sha3 = "0.11.0" # Currently: 0.10.8
blake2 = "0.11.0" # Currently: 0.10.6
hmac = "0.13.0" # Currently: 0.12.1
# Key Wrap
aes-kw = "0.3.0" # Currently: 0.2.1
# Other
pkcs8 = "0.11.0" # Currently: 0.10.2
rsa = "0.10.0" # Currently: 0.9.8 (fixes num-bigint-dig deprecation)Note: All these are coordinated releases - likely to go stable together in Q1 2026.
Testing Checklist (For Future Fix PR)
When creating the fix PR after Dalek 3.0 stable release:
- Update
ed25519-dalekto 3.0.0 in Cargo.toml - Update
x25519-dalekto 3.0.0 in Cargo.toml - Update
rust-versionto 1.81 in Cargo.toml - Remove target-specific getrandom dependency (no longer needed)
- Restore
wasmfeature flag towasm = ["getrandom/wasm_js"] - Remove WASM limitation comments from Cargo.toml
- Test:
cargo build --target wasm32-unknown-unknown --features wasm - Test: All 313 tests still pass
- Test: Clippy passes with zero warnings
- Test: Ed25519/X25519 examples still work
- Update CHANGELOG.md noting WASM support restored
- Update README.md removing WASM limitation warning
- Bump version to 0.4.0 (MSRV bump = minor version bump)
References
- getrandom 0.3.x migration guide: https://docs.rs/getrandom/0.3.4/getrandom/
- ed25519-dalek 3.0 tracking: https://github.com/dalek-cryptography/curve25519-dalek/discussions
- RustCrypto 0.11 tracking: https://github.com/RustCrypto/traits/issues
- Cargo feature resolution: https://doc.rust-lang.org/cargo/reference/features.html#feature-unification