mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 04:09:23 +00:00
Rename ThresholdKeys::secret_share to ThresholdKeys::original_secret_share
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "dkg"
|
||||
version = "0.6.0"
|
||||
version = "0.6.1"
|
||||
description = "Distributed key generation over ff/group"
|
||||
license = "MIT"
|
||||
repository = "https://github.com/serai-dex/serai/tree/develop/crypto/dkg"
|
||||
|
||||
@@ -47,7 +47,7 @@ pub fn test_musig() {
|
||||
|
||||
verification_shares.insert(
|
||||
these_keys.params().i(),
|
||||
<Ristretto as Ciphersuite>::generator() * **these_keys.secret_share(),
|
||||
<Ristretto as Ciphersuite>::generator() * **these_keys.original_secret_share(),
|
||||
);
|
||||
|
||||
assert_eq!(these_keys.group_key(), group_key);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "dkg-promote"
|
||||
version = "0.6.0"
|
||||
version = "0.6.1"
|
||||
description = "Promotions for keys from the dkg crate"
|
||||
license = "MIT"
|
||||
repository = "https://github.com/serai-dex/serai/tree/develop/crypto/dkg/promote"
|
||||
@@ -25,7 +25,7 @@ transcript = { package = "flexible-transcript", path = "../../transcript", versi
|
||||
ciphersuite = { path = "../../ciphersuite", version = "^0.4.1", default-features = false, features = ["std"] }
|
||||
dleq = { path = "../../dleq", version = "^0.4.1", default-features = false, features = ["std", "serialize"] }
|
||||
|
||||
dkg = { path = "../", version = "0.6", default-features = false, features = ["std"] }
|
||||
dkg = { path = "../", version = "0.6.1", default-features = false, features = ["std"] }
|
||||
|
||||
[dev-dependencies]
|
||||
zeroize = { version = "^1.5", default-features = false, features = ["std", "zeroize_derive"] }
|
||||
|
||||
@@ -104,12 +104,12 @@ impl<C1: Ciphersuite, C2: Ciphersuite<F = C1::F, G = C1::G>> GeneratorPromotion<
|
||||
) -> (GeneratorPromotion<C1, C2>, GeneratorProof<C1>) {
|
||||
// Do a DLEqProof for the new generator
|
||||
let proof = GeneratorProof {
|
||||
share: C2::generator() * base.secret_share().deref(),
|
||||
share: C2::generator() * base.original_secret_share().deref(),
|
||||
proof: DLEqProof::prove(
|
||||
rng,
|
||||
&mut transcript(&base.original_group_key(), base.params().i()),
|
||||
&[C1::generator(), C2::generator()],
|
||||
base.secret_share(),
|
||||
base.original_secret_share(),
|
||||
),
|
||||
};
|
||||
|
||||
@@ -159,7 +159,7 @@ impl<C1: Ciphersuite, C2: Ciphersuite<F = C1::F, G = C1::G>> GeneratorPromotion<
|
||||
ThresholdKeys::new(
|
||||
params,
|
||||
self.base.interpolation().clone(),
|
||||
self.base.secret_share().clone(),
|
||||
self.base.original_secret_share().clone(),
|
||||
verification_shares,
|
||||
)
|
||||
.unwrap(),
|
||||
|
||||
@@ -99,13 +99,16 @@ fn test_generator_promotion() {
|
||||
for (i, promoting) in promotions.drain() {
|
||||
let promoted = promoting.complete(&clone_without(&proofs, &i)).unwrap();
|
||||
assert_eq!(keys[usize::from(u16::from(i) - 1)].params(), promoted.params());
|
||||
assert_eq!(keys[usize::from(u16::from(i) - 1)].secret_share(), promoted.secret_share());
|
||||
assert_eq!(
|
||||
keys[usize::from(u16::from(i) - 1)].original_secret_share(),
|
||||
promoted.original_secret_share()
|
||||
);
|
||||
assert_eq!(new_group_key, promoted.group_key());
|
||||
for l in 0 .. PARTICIPANTS {
|
||||
let verification_share =
|
||||
promoted.original_verification_share(Participant::new(l + 1).unwrap());
|
||||
assert_eq!(
|
||||
AltGenerator::<Ristretto>::generator() * **keys[usize::from(l)].secret_share(),
|
||||
AltGenerator::<Ristretto>::generator() * **keys[usize::from(l)].original_secret_share(),
|
||||
verification_share
|
||||
);
|
||||
}
|
||||
|
||||
@@ -444,8 +444,8 @@ impl<C: Ciphersuite> ThresholdKeys<C> {
|
||||
(self.core.group_key * self.scalar) + (C::generator() * self.offset)
|
||||
}
|
||||
|
||||
/// Return the secret share for these keys.
|
||||
pub fn secret_share(&self) -> &Zeroizing<C::F> {
|
||||
/// Return the underlying secret share for these keys, without any tweaks applied.
|
||||
pub fn original_secret_share(&self) -> &Zeroizing<C::F> {
|
||||
&self.core.secret_share
|
||||
}
|
||||
|
||||
@@ -489,7 +489,7 @@ impl<C: Ciphersuite> ThresholdKeys<C> {
|
||||
}
|
||||
|
||||
// The interpolation occurs multiplicatively, letting us scale by the scalar now
|
||||
let secret_share_scaled = Zeroizing::new(self.scalar * self.secret_share().deref());
|
||||
let secret_share_scaled = Zeroizing::new(self.scalar * self.original_secret_share().deref());
|
||||
let mut secret_share = Zeroizing::new(
|
||||
self.core.interpolation.interpolation_factor(self.params().i(), &included) *
|
||||
secret_share_scaled.deref(),
|
||||
|
||||
Reference in New Issue
Block a user