Skip to content

Commit

Permalink
Rename calculate_zero_key to compute_refreshing_shares (#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
natalieesk committed Jul 18, 2024
1 parent 6bb17f2 commit fd3886e
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion book/src/tutorial/refreshing-shares.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ channel](https://frost.zfnd.org/terminology.html#peer-to-peer-channel).

<!-- ![Diagram of Refreshing shares, illustrating what is explained in the text](refreshing.png) -->

The Trusted Dealer needs to first run `calculate_zero_key` where the new SecretShares are generated and then verified.
The Trusted Dealer needs to first run `compute_refreshing_shares` where the new SecretShares are generated and then verified.
This is done with
[`KeyPackage::try_from()`](https://docs.rs/frost-core/latest/frost_core/frost/keys/struct.KeyPackage.html#method.try_from):
`caluclate_zero_key` returns a new SecretShare and PublicKeyPackage
Expand Down
2 changes: 1 addition & 1 deletion frost-core/src/keys/refresh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use super::{KeyPackage, SecretShare, VerifiableSecretSharingCommitment};
/// Generates new zero key shares and a public key package using a trusted dealer
/// Building a new public key package is done by taking the verifying shares from the new public key package and adding
/// them to the original verifying shares
pub fn calculate_zero_key<C: Ciphersuite, R: RngCore + CryptoRng>(
pub fn compute_refreshing_shares<C: Ciphersuite, R: RngCore + CryptoRng>(
old_pub_key_package: PublicKeyPackage<C>,
max_signers: u16,
min_signers: u16,
Expand Down
10 changes: 5 additions & 5 deletions frost-core/src/tests/refresh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::collections::BTreeMap;
use rand_core::{CryptoRng, RngCore};

use crate::keys::generate_with_dealer;
use crate::keys::refresh::{calculate_zero_key, refresh_share};
use crate::keys::refresh::{compute_refreshing_shares, refresh_share};
use crate::{self as frost};
use crate::{
keys::{KeyPackage, PublicKeyPackage, SecretShare},
Expand Down Expand Up @@ -56,7 +56,7 @@ pub fn check_refresh_shares_with_dealer<C: Ciphersuite, R: RngCore + CryptoRng>(

// Trusted Dealer generates zero keys and new public key package

let (zero_shares, new_pub_key_package) = calculate_zero_key(
let (zero_shares, new_pub_key_package) = compute_refreshing_shares(
pub_key_package,
NEW_MAX_SIGNERS,
MIN_SIGNERS,
Expand Down Expand Up @@ -97,7 +97,7 @@ pub fn check_refresh_shares_with_dealer_fails_with_invalid_signers<
) {
let (_old_shares, pub_key_package) =
generate_with_dealer::<C, R>(5, 2, frost::keys::IdentifierList::Default, &mut rng).unwrap();
let out = calculate_zero_key(
let out = compute_refreshing_shares(
pub_key_package,
new_max_signers,
min_signers,
Expand Down Expand Up @@ -157,7 +157,7 @@ pub fn check_refresh_shares_with_dealer_fails_with_invalid_public_key_package<

// Trusted Dealer generates zero keys and new public key package

let e = calculate_zero_key(
let e = compute_refreshing_shares(
incorrect_pub_key_package,
NEW_MAX_SIGNERS,
MIN_SIGNERS,
Expand Down Expand Up @@ -203,7 +203,7 @@ pub fn check_refresh_shares_with_dealer_serialisation<C: Ciphersuite, R: RngCore

const NEW_MAX_SIGNERS: u16 = 4;

let (zero_shares, new_pub_key_package) = calculate_zero_key(
let (zero_shares, new_pub_key_package) = compute_refreshing_shares(
pub_key_package,
NEW_MAX_SIGNERS,
MIN_SIGNERS,
Expand Down
4 changes: 2 additions & 2 deletions frost-ed25519/src/keys/refresh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ use crate::{frost, Ciphersuite, CryptoRng, Error, Identifier, RngCore};
use super::{KeyPackage, PublicKeyPackage, SecretShare};

/// Refreshes shares using a trusted dealer
pub fn calculate_zero_key<C: Ciphersuite, R: RngCore + CryptoRng>(
pub fn compute_refreshing_shares<C: Ciphersuite, R: RngCore + CryptoRng>(
old_pub_key_package: PublicKeyPackage,
max_signers: u16,
min_signers: u16,
identifiers: &[Identifier],
mut rng: &mut R,
) -> Result<(Vec<SecretShare>, PublicKeyPackage), Error> {
frost::keys::refresh::calculate_zero_key(
frost::keys::refresh::compute_refreshing_shares(
old_pub_key_package,
max_signers,
min_signers,
Expand Down
4 changes: 2 additions & 2 deletions frost-ed448/src/keys/refresh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ use crate::{frost, Ciphersuite, CryptoRng, Error, Identifier, RngCore};
use super::{KeyPackage, PublicKeyPackage, SecretShare};

/// Refreshes shares using a trusted dealer
pub fn calculate_zero_key<C: Ciphersuite, R: RngCore + CryptoRng>(
pub fn compute_refreshing_shares<C: Ciphersuite, R: RngCore + CryptoRng>(
old_pub_key_package: PublicKeyPackage,
max_signers: u16,
min_signers: u16,
identifiers: &[Identifier],
mut rng: &mut R,
) -> Result<(Vec<SecretShare>, PublicKeyPackage), Error> {
frost::keys::refresh::calculate_zero_key(
frost::keys::refresh::compute_refreshing_shares(
old_pub_key_package,
max_signers,
min_signers,
Expand Down
4 changes: 2 additions & 2 deletions frost-p256/src/keys/refresh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ use crate::{frost, Ciphersuite, CryptoRng, Error, Identifier, RngCore};
use super::{KeyPackage, PublicKeyPackage, SecretShare};

/// Refreshes shares using a trusted dealer
pub fn calculate_zero_key<C: Ciphersuite, R: RngCore + CryptoRng>(
pub fn compute_refreshing_shares<C: Ciphersuite, R: RngCore + CryptoRng>(
old_pub_key_package: PublicKeyPackage,
max_signers: u16,
min_signers: u16,
identifiers: &[Identifier],
mut rng: &mut R,
) -> Result<(Vec<SecretShare>, PublicKeyPackage), Error> {
frost::keys::refresh::calculate_zero_key(
frost::keys::refresh::compute_refreshing_shares(
old_pub_key_package,
max_signers,
min_signers,
Expand Down
4 changes: 2 additions & 2 deletions frost-ristretto255/src/keys/refresh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ use crate::{frost, Ciphersuite, CryptoRng, Error, Identifier, RngCore};
use super::{KeyPackage, PublicKeyPackage, SecretShare};

/// Refreshes shares using a trusted dealer
pub fn calculate_zero_key<C: Ciphersuite, R: RngCore + CryptoRng>(
pub fn compute_refreshing_shares<C: Ciphersuite, R: RngCore + CryptoRng>(
old_pub_key_package: PublicKeyPackage,
max_signers: u16,
min_signers: u16,
identifiers: &[Identifier],
mut rng: &mut R,
) -> Result<(Vec<SecretShare>, PublicKeyPackage), Error> {
frost::keys::refresh::calculate_zero_key(
frost::keys::refresh::compute_refreshing_shares(
old_pub_key_package,
max_signers,
min_signers,
Expand Down
4 changes: 2 additions & 2 deletions frost-secp256k1/src/keys/refresh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ use crate::{frost, Ciphersuite, CryptoRng, Error, Identifier, RngCore};
use super::{KeyPackage, PublicKeyPackage, SecretShare};

/// Refreshes shares using a trusted dealer
pub fn calculate_zero_key<C: Ciphersuite, R: RngCore + CryptoRng>(
pub fn compute_refreshing_shares<C: Ciphersuite, R: RngCore + CryptoRng>(
old_pub_key_package: PublicKeyPackage,
max_signers: u16,
min_signers: u16,
identifiers: &[Identifier],
mut rng: &mut R,
) -> Result<(Vec<SecretShare>, PublicKeyPackage), Error> {
frost::keys::refresh::calculate_zero_key(
frost::keys::refresh::compute_refreshing_shares(
old_pub_key_package,
max_signers,
min_signers,
Expand Down

0 comments on commit fd3886e

Please sign in to comment.