Skip to content

Conversation

sunshowers
Copy link
Contributor

With this PR, almost all code now uses rand 0.9. The only exception is the bootstore which uses vsss-rs (and which I believe will be going away at some point).

Created using spr 1.3.6-beta.1
@sunshowers sunshowers mentioned this pull request Aug 12, 2025
1 task
Created using spr 1.3.6-beta.1
@@ -129,7 +129,7 @@ pub fn create_pkgs(
let shares = rack_secret.split(threshold, total_shares)?;
let share_digests = share_digests(&shares);
let mut salt = [0u8; 32];
OsRng.fill_bytes(&mut salt);
OsRng.try_fill_bytes(&mut salt).expect("fetched random bytes");
Copy link
Contributor

Choose a reason for hiding this comment

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

This is fine, but I'm curious why you changed it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

rand 0.9 no longer has OsRng be infallible (previously it would panic internally, now the error is bubbled up so we get to panic lmao)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, and you wanted to make 0.8 work the same as 0.9 in the codebase. And the failure mode seems better. Thanks!

RackSecret {
secret: SecretBox::new(Box::new(Scalar::random(&mut rng))),
secret: SecretBox::new(Box::new(
Scalar::from_bytes_mod_order_wide(&scalar_bytes),
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here. Why the change if we are using the same rand version (0.8.5) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was trying to switch this over to rand 0.9 but unfortunately failed, haha. Reverted this change.

Created using spr 1.3.6-beta.1
@sunshowers sunshowers enabled auto-merge (squash) August 22, 2025 22:03
@sunshowers sunshowers merged commit 8516b40 into main Aug 23, 2025
18 checks passed
@sunshowers sunshowers deleted the sunshowers/spr/update-most-code-to-rand-09 branch August 23, 2025 00:10
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.

2 participants