|
| 1 | +# Dependency Update Notes - rand_core 0.9 |
| 2 | + |
| 3 | +## Summary |
| 4 | + |
| 5 | +This document explains why the Dependabot PR #21 to update `rand_core` from 0.6 to 0.9 cannot be applied at this time. |
| 6 | + |
| 7 | +## Issue |
| 8 | + |
| 9 | +Dependabot proposed updating `rand_core` from version 0.6 to 0.9. However, after investigation, **rand_core 0.9 is incompatible with the current stable Rust cryptographic ecosystem** used by WRAITH Protocol. |
| 10 | + |
| 11 | +## Root Cause |
| 12 | + |
| 13 | +The WRAITH Protocol depends on several cryptographic libraries from the Dalek cryptography ecosystem: |
| 14 | + |
| 15 | +- `ed25519-dalek` 2.1/2.2 (for Ed25519 signatures) |
| 16 | +- `x25519-dalek` 2.0 (for X25519 key exchange) |
| 17 | +- `chacha20poly1305` 0.10 (for AEAD encryption, used by `snow` Noise protocol) |
| 18 | + |
| 19 | +All of these stable versions depend on `rand_core` 0.6.x, creating a dependency conflict when trying to upgrade to `rand_core` 0.9. |
| 20 | + |
| 21 | +### Dependency Chain |
| 22 | + |
| 23 | +``` |
| 24 | +wraith-crypto |
| 25 | +├── ed25519-dalek 2.2.0 → rand_core 0.6.4 (via crypto-common) |
| 26 | +├── x25519-dalek 2.0.1 → rand_core 0.6.4 (via crypto-common) |
| 27 | +└── chacha20poly1305 0.10.1 → crypto-common 0.1.7 → rand_core 0.6.4 |
| 28 | +``` |
| 29 | + |
| 30 | +## Attempted Solutions |
| 31 | + |
| 32 | +### Option 1: Update dalek crates to 3.0 pre-release |
| 33 | + |
| 34 | +The dalek cryptography team has 3.0.0-pre.3 pre-release versions that support newer `rand_core`: |
| 35 | + |
| 36 | +- `ed25519-dalek` 3.0.0-pre.3 |
| 37 | +- `x25519-dalek` 3.0.0-pre.3 |
| 38 | + |
| 39 | +However, these versions use `rand_core` 0.10.0-rc-2, not 0.9.x, which creates a three-way version conflict: |
| 40 | + |
| 41 | +``` |
| 42 | +wraith-crypto |
| 43 | +├── ed25519-dalek 3.0.0-pre.3 → rand_core 0.10.0-rc-2 |
| 44 | +├── x25519-dalek 3.0.0-pre.3 → rand_core 0.10.0-rc-2 |
| 45 | +├── chacha20poly1305 0.10.1 → rand_core 0.6.4 |
| 46 | +└── rand_core 0.9.3 (from workspace) |
| 47 | +``` |
| 48 | + |
| 49 | +This results in compile errors due to trait incompatibilities across three different `rand_core` versions. |
| 50 | + |
| 51 | +### Option 2: Update chacha20poly1305 |
| 52 | + |
| 53 | +While `chacha20poly1305` 0.11.0-rc.2 exists, it would require updating `snow` (the Noise protocol implementation), which may have cascading effects on the protocol implementation. |
| 54 | + |
| 55 | +## Recommendation |
| 56 | + |
| 57 | +**Keep `rand_core` at version 0.6.x** until the Rust cryptographic ecosystem stabilizes with consistent `rand_core` versions. |
| 58 | + |
| 59 | +Monitor for: |
| 60 | +1. Stable releases of `ed25519-dalek` 3.x and `x25519-dalek` 3.x |
| 61 | +2. Stable release of `rand_core` 0.10.x or later |
| 62 | +3. Updates to `chacha20poly1305` and `snow` that support the new ecosystem |
| 63 | + |
| 64 | +## Changes Applied |
| 65 | + |
| 66 | +Based on code review feedback, the following changes were made: |
| 67 | + |
| 68 | +1. **Reverted `rand_core` to 0.6**: Changed from 0.9 back to 0.6 for compatibility |
| 69 | +2. **Updated `wraith-cli/Cargo.toml`**: Changed `rand_core = "0.6"` to `rand_core = { workspace = true }` for consistency with other workspace members |
| 70 | +3. **Did not update `rand`**: Kept at 0.8 since it's compatible with `rand_core` 0.6 |
| 71 | + |
| 72 | +## Testing |
| 73 | + |
| 74 | +All changes have been validated: |
| 75 | +- ✅ `cargo build --workspace` succeeds |
| 76 | +- ✅ `cargo test --workspace` passes |
| 77 | +- ✅ `cargo clippy --workspace -- -D warnings` passes |
| 78 | +- ✅ `cargo fmt --all -- --check` passes |
| 79 | +- ✅ No security vulnerabilities found in dependencies |
| 80 | + |
| 81 | +## Future Work |
| 82 | + |
| 83 | +When updating to `rand_core` 0.9 or later becomes feasible, the following dependencies should be updated together: |
| 84 | + |
| 85 | +- `rand_core`: 0.6 → 0.9+ (change feature from `getrandom` to `std` or `os_rng`) |
| 86 | +- `rand`: 0.8 → 0.9+ |
| 87 | +- `ed25519-dalek`: 2.x → 3.x (stable) |
| 88 | +- `x25519-dalek`: 2.x → 3.x (stable) |
| 89 | +- `chacha20poly1305`: Verify compatibility |
| 90 | +- `snow`: Verify compatibility |
| 91 | + |
| 92 | +This should be done as a coordinated update in a single PR to avoid version conflicts. |
0 commit comments