-
Notifications
You must be signed in to change notification settings - Fork 29
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
Conversation
schnorr_fun/src/frost.rs
Outdated
@@ -1092,6 +1104,15 @@ impl crate::fun::bincode::Decode for EncodedFrostKey { | |||
} | |||
} | |||
|
|||
#[cfg(feature = "bincode")] | |||
impl<'de> crate::fun::bincode::BorrowDecode<'de> for EncodedFrostKey { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you try this: https://docs.rs/bincode/2.0.0-rc.3/bincode/macro.impl_borrow_decode.html?
schnorr_fun/tests/share_backup.rs
Outdated
let polynomial: Vec<_> = poly::scalar::to_point_poly(&secret_poly) | ||
.into_iter() | ||
.map(|c| c.mark_zero()) | ||
.collect(); // some polynomial coefficients |
There was a problem hiding this comment.
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)
schnorr_fun/src/frost.rs
Outdated
@@ -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>]>, |
There was a problem hiding this comment.
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.
ConceptACK |
- 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
I've pushed two commits:
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 |
BorrowDecode
forEncodedFrostKey
for use in Frostsnap.EncodedFrostKey
.Into::<FrostKey<Normal>>::into(session_progress.encoded_key.clone())
everywhere,.into_frost_key()
is nicer.