Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[frost] EncodedFrostKey BorrowDecode and correct markers #175

Merged
merged 4 commits into from
Feb 18, 2024

Conversation

nickfarrow
Copy link
Collaborator

  • Implement BorrowDecode for EncodedFrostKey for use in Frostsnap.
  • Convenient helper impls for EncodedFrostKey.
    • I was finding I had to call things like Into::<FrostKey<Normal>>::into(session_progress.encoded_key.clone()) everywhere, .into_frost_key() is nicer.
  • Fully allow zero polynomial coeffs in share_backup (mistakenly missed a few functions last PR).
  • Keygen local poly Scalars should be secret.

@@ -1092,6 +1104,15 @@ impl crate::fun::bincode::Decode for EncodedFrostKey {
}
}

#[cfg(feature = "bincode")]
impl<'de> crate::fun::bincode::BorrowDecode<'de> for EncodedFrostKey {
Copy link
Owner

Choose a reason for hiding this comment

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

let polynomial: Vec<_> = poly::scalar::to_point_poly(&secret_poly)
.into_iter()
.map(|c| c.mark_zero())
.collect(); // some polynomial coefficients
Copy link
Owner

@LLFourn LLFourn Feb 13, 2024

Choose a reason for hiding this comment

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

why do we need all this map stuff now?

Maybe you can make whatever function is requiring this just take impl ZeroChoice instead of a concrete Zero.

(aside: I think // some polynomial coefficients is not doing much here)

@@ -694,7 +694,7 @@ impl<H: Digest<OutputSize = U32> + Clone, NG> Frost<H, NG> {
local_secret_polys: &BTreeMap<PartyIndex, S>,
) -> Result<KeyGen, NewKeyGenError>
where
S: AsRef<[Scalar]>,
S: AsRef<[Scalar<Secret>]>,
Copy link
Owner

Choose a reason for hiding this comment

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

Scalar is Secret by default.

@LLFourn
Copy link
Owner

LLFourn commented Feb 13, 2024

ConceptACK

nickfarrow and others added 2 commits February 17, 2024 12:37
- Implement BorrowDecode for EncodedFrostKey for use in Frostsnap.
- Convenient helper impls for EncodedFrostKey.
- Fully allow zero polynomial coeffs in share_backup (mistakenly
  missed a few functions last PR).
- Keygen local poly Scalars should be secret.
Because in 1.63.0 this was fixed: rust-lang/rust#83701
@LLFourn
Copy link
Owner

LLFourn commented Feb 17, 2024

I've pushed two commits:

  1. 3435eae to bump the MSRV so tests pass
  2. e6e217e to set the secret share to Scalar<Secret, Zero> and fix some misc things

One thing I noticed is that the shares index can be one u5 or 52 but nothing inbetween. I think it should be fine to allow it to be any length. I guess @nickfarrow didn't do this because it was tricky with the API (there is this convert_bits thing but it seems to be broken). It looks like it might be possible with the v0.10 branch.

@LLFourn LLFourn merged commit 86e2908 into LLFourn:master Feb 18, 2024
15 checks passed
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