Skip to content

feat(common): updated the ed25519 dalek crate - #3473

Draft
damrobi wants to merge 2 commits into
mainfrom
damrobi/msnark/3471-update-ed25519-dalek
Draft

feat(common): updated the ed25519 dalek crate#3473
damrobi wants to merge 2 commits into
mainfrom
damrobi/msnark/3471-update-ed25519-dalek

Conversation

@damrobi

@damrobi damrobi commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Content

This PR includes an update of the ed25519 dalek crate from 2.2.0 to 3.0.0. It also includes a bridge to link two incompatible version of rand_core.

Changes

  • Update the ed25519-dalek crate from 2.2.0 to 3.0.0
  • Add a renamed version of the rand_chacha crate to fix the deterministic RNG
  • Import the genrandom crate directly to replace the removed OsRng of rand_core with SysRng (the new version of ed25519-dalek requires a new rand_core that does not have the OsRng anymore
  • Use a wrapper UnwrapErr around the SysRng to make it Infallible

Details on the change of OS RNG

To fit with the new crate versions and dependencies, we need to move from rand_core::OsRng to getrandom::SysRng. This does not change the entropy source or security posture: OsRng was already a wrapper around getrandom internally, and rand_core 0.10.1 removed OsRng in favor of exposing that same getrandom-backed source directly as SysRng.
Both read from the same OS-level entropy sources (the getrandom syscall on Linux, ProcessPrng on Windows, getentropy on macOS, etc.) under the same documented security guarantee. The one visible difference is that SysRng only implements the fallible TryRng/TryCryptoRng traits, since an OS entropy call can in principle fail, whereas ed25519-dalek's generate() requires an infallible RNG. The wrapper rand_core::UnwrapErr takes care of this by implementing the TryRng trait with and Infallible error. It still panics on an OS failure in the same way OsRng already did internally, so the practical chance of hitting it is unchanged.

Pre-submit checklist

  • Branch
    • Tests are provided (if possible)
    • Crates versions are updated (if relevant)
    • CHANGELOG file is updated (if relevant)
    • Commit sequence broadly makes sense
    • Key commits have useful messages
  • PR
    • All check jobs of the CI have succeeded
    • Self-reviewed the diff
    • Useful pull request description
    • Reviewer requested
  • Documentation
    • No new TODOs introduced

Comments

Issue(s)

Closes #3471

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Test Results

     5 files     209 suites   50m 23s ⏱️
 3 374 tests  3 374 ✅ 0 💤 0 ❌
11 228 runs  11 228 ✅ 0 💤 0 ❌

Results for commit 1333751.

♻️ This comment has been updated with latest results.

@damrobi
damrobi temporarily deployed to testing-2-preview August 5, 2026 16:56 — with GitHub Actions Inactive
@damrobi
damrobi temporarily deployed to testing-preview August 5, 2026 16:56 — with GitHub Actions Inactive
@damrobi
damrobi temporarily deployed to testing-2-preview August 7, 2026 12:22 — with GitHub Actions Inactive
@damrobi
damrobi temporarily deployed to testing-preview August 7, 2026 12:22 — with GitHub Actions Inactive
@damrobi
damrobi force-pushed the damrobi/msnark/3471-update-ed25519-dalek branch from 2dfdccd to 1333751 Compare August 7, 2026 14:59
@jpraynaud
jpraynaud requested a balanced review from Copilot August 7, 2026 15:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Updates Ed25519 cryptography to Dalek 3.0 while bridging incompatible RNG versions.

Changes:

  • Upgrades ed25519-dalek and its transitive dependencies.
  • Adds Dalek-compatible deterministic and system RNG adapters.
  • Updates Ed25519 and Cardano key generation imports.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
mithril-common/src/crypto_helper/ed25519.rs Adapts signer generation to new RNG APIs.
mithril-common/src/crypto_helper/cardano/cold_key.rs Uses the Dalek-compatible ChaCha RNG.
mithril-common/Cargo.toml Updates and adds cryptographic dependencies.
Cargo.lock Locks the updated dependency graph.

// in principle, fail). `UnwrapErr` makes `SysRng` Infallible to fit the `generate` bounds.
// It can panic on failure in the same way `OsRng` did so the chance of failure stays the
// same.
let rng = UnwrapErr(SysRng);
Comment thread mithril-common/Cargo.toml
ciborium = { workspace = true }
digest = { workspace = true }
ed25519-dalek = { version = "2.2.0", features = ["rand_core", "serde"] }
ed25519-dalek = { version = "3.0.0", features = ["rand_core", "serde"] }
@damrobi
damrobi temporarily deployed to testing-preview August 7, 2026 15:13 — with GitHub Actions Inactive
@damrobi
damrobi temporarily deployed to testing-2-preview August 7, 2026 15:13 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update ed25519-dalek dependency

2 participants