Skip to content

Conversation

cronokirby
Copy link
Collaborator

from_iter is useful to avoid needing to call collect yourself, and enables a useful function, which sets the 0 value of the polynomial to a particular element, which is needed in a DKG reshare.

I think there's enough value in the simple change to merit inclusion, even without propagating the change. (I'm working on a refactor of the DKG code which will use this method).

@cronokirby cronokirby force-pushed the cronokirby/new-poly-methods branch from f802a4a to 7a731dd Compare October 13, 2025 17:46
Copy link

cloudflare-workers-and-pages bot commented Oct 13, 2025

Deploying monorepo with  Cloudflare Pages  Cloudflare Pages

Latest commit: 38f3415
Status: ✅  Deploy successful!
Preview URL: https://667401e3.monorepo-eu0.pages.dev
Branch Preview URL: https://cronokirby-new-poly-methods.monorepo-eu0.pages.dev

View logs

pub fn new_with_constant(
degree: u32,
mut rng: impl CryptoRngCore,
constant: Scalar,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: put constant as the first argument

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I had it this way to respect the argument order of the other functions, for consistency ; I thought having this extend new_from with an additional argument was best.

}

/// Create a new scalar polynomial with a particular value for the constant coefficient.
pub fn new_with_constant(
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if it would be cleaner to accept Option<Scalar> for this? May alleviate some cognitive overhead from dkg.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

My thinking with the DKG logic is that, instead, you want to quickly transition from having no share to have a share that's been randomly generated, and always use that. Then, you'd just call this method.

@cronokirby cronokirby force-pushed the cronokirby/new-poly-methods branch from bf9656d to 0819011 Compare October 13, 2025 22:01
Copy link

codecov bot commented Oct 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.20%. Comparing base (e2917c4) to head (38f3415).
⚠️ Report is 2 commits behind head on main.

@@           Coverage Diff           @@
##             main    #1877   +/-   ##
=======================================
  Coverage   92.20%   92.20%           
=======================================
  Files         308      308           
  Lines       81072    81087   +15     
=======================================
+ Hits        74750    74765   +15     
  Misses       6322     6322           
Files with missing lines Coverage Δ
cryptography/src/bls12381/primitives/poly.rs 98.54% <100.00%> (+0.08%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e2917c4...38f3415. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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