mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-09 04:39:24 +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(),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "modular-frost"
|
||||
version = "0.10.0"
|
||||
version = "0.10.1"
|
||||
description = "Modular implementation of FROST over ff/group"
|
||||
license = "MIT"
|
||||
repository = "https://github.com/serai-dex/serai/tree/develop/crypto/frost"
|
||||
@@ -39,7 +39,7 @@ multiexp = { path = "../multiexp", version = "0.4", default-features = false, fe
|
||||
|
||||
schnorr = { package = "schnorr-signatures", path = "../schnorr", version = "^0.5.1", default-features = false, features = ["std"] }
|
||||
|
||||
dkg = { path = "../dkg", version = "0.6", default-features = false, features = ["std"] }
|
||||
dkg = { path = "../dkg", version = "0.6.1", default-features = false, features = ["std"] }
|
||||
dkg-recovery = { path = "../dkg/recovery", version = "0.6", default-features = false, features = ["std"], optional = true }
|
||||
dkg-dealer = { path = "../dkg/dealer", version = "0.6", default-features = false, features = ["std"], optional = true }
|
||||
|
||||
|
||||
@@ -125,8 +125,11 @@ impl<C: Curve, A: Algorithm<C>> AlgorithmMachine<C, A> {
|
||||
let mut params = self.params;
|
||||
|
||||
let mut rng = ChaCha20Rng::from_seed(*seed.0);
|
||||
let (nonces, commitments) =
|
||||
Commitments::new::<_>(&mut rng, params.keys.secret_share(), ¶ms.algorithm.nonces());
|
||||
let (nonces, commitments) = Commitments::new::<_>(
|
||||
&mut rng,
|
||||
params.keys.original_secret_share(),
|
||||
¶ms.algorithm.nonces(),
|
||||
);
|
||||
let addendum = params.algorithm.preprocess_addendum(&mut rng, ¶ms.keys);
|
||||
|
||||
let preprocess = Preprocess { commitments, addendum };
|
||||
|
||||
@@ -133,7 +133,7 @@ fn vectors_to_multisig_keys<C: Curve>(vectors: &Vectors) -> HashMap<Participant,
|
||||
assert_eq!(usize::from(these_keys.params().n()), shares.len());
|
||||
let participant = Participant::new(i).unwrap();
|
||||
assert_eq!(these_keys.params().i(), participant);
|
||||
assert_eq!(these_keys.secret_share().deref(), &shares[usize::from(i - 1)]);
|
||||
assert_eq!(these_keys.original_secret_share().deref(), &shares[usize::from(i - 1)]);
|
||||
assert_eq!(hex::encode(these_keys.group_key().to_bytes().as_ref()), vectors.group_key);
|
||||
keys.insert(participant, these_keys);
|
||||
}
|
||||
@@ -346,14 +346,21 @@ pub fn test_with_vectors<R: RngCore + CryptoRng, C: Curve, H: Hram<C>>(
|
||||
|
||||
// Calculate the expected nonces
|
||||
let mut expected = (C::generator() *
|
||||
C::random_nonce(keys[i].secret_share(), &mut TransparentRng(vec![randomness.0])).deref())
|
||||
C::random_nonce(
|
||||
keys[i].original_secret_share(),
|
||||
&mut TransparentRng(vec![randomness.0]),
|
||||
)
|
||||
.deref())
|
||||
.to_bytes()
|
||||
.as_ref()
|
||||
.to_vec();
|
||||
expected.extend(
|
||||
(C::generator() *
|
||||
C::random_nonce(keys[i].secret_share(), &mut TransparentRng(vec![randomness.1]))
|
||||
.deref())
|
||||
C::random_nonce(
|
||||
keys[i].original_secret_share(),
|
||||
&mut TransparentRng(vec![randomness.1]),
|
||||
)
|
||||
.deref())
|
||||
.to_bytes()
|
||||
.as_ref(),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user