Rename derive_lagrange_coefficient to derive_interpolating_value (#224)

* Rename rename_derive_lagrange_coefficient_to_derive_interpolating_value

Co-authored-by: conrado <conrado@zfnd.org>

* Fix formatting

Co-authored-by: conrado <conrado@zfnd.org>

* Fix lint errors

Co-authored-by: conrado <conrado@zfnd.org>

* Update README with pre commit check info

Co-authored-by: conrado <conrado@zfnd.org>

---------

Co-authored-by: Natalie Eskinazi <nat@trees.local>
Co-authored-by: conrado <conrado@zfnd.org>
This commit is contained in:
Natalie Eskinazi 2023-02-06 15:51:16 +00:00 committed by GitHub
parent 956d8d3c7f
commit 984f421d47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 12 deletions

View File

@ -30,5 +30,8 @@ scratch. End-users should not use `frost-core` if they want to sign and verify s
should use the crate specific to their ciphersuite/curve parameters that uses `frost-core` as a
dependency.
## Pre-commit checks
1. Run tests `cargo test`
2. Run formatter `cargo fmt`
3. Check linter `cargo clippy` and if you want to automatically fix then run `cargo clippy --fix`

View File

@ -31,7 +31,7 @@ pub fn bench_batch_verify<C: Ciphersuite, R: RngCore + CryptoRng + Clone>(
name: &str,
rng: &mut R,
) {
let mut group = c.benchmark_group(format!("Batch Verification {}", name));
let mut group = c.benchmark_group(format!("Batch Verification {name}"));
for &n in [8usize, 16, 24, 32, 40, 48, 56, 64].iter() {
group.throughput(Throughput::Elements(n as u64));
@ -81,7 +81,7 @@ pub fn bench_sign<C: Ciphersuite, R: RngCore + CryptoRng + Clone>(
name: &str,
rng: &mut R,
) {
let mut group = c.benchmark_group(format!("FROST Signing {}", name));
let mut group = c.benchmark_group(format!("FROST Signing {name}"));
for &n in [3u16, 10, 100, 1000].iter() {
let max_signers = n;
let min_signers = (n * 2 + 2) / 3;

View File

@ -147,7 +147,7 @@ where
/// Generates the lagrange coefficient for the i'th participant.
#[cfg_attr(feature = "internals", visibility::make(pub))]
fn derive_lagrange_coeff<C: Ciphersuite>(
fn derive_interpolating_value<C: Ciphersuite>(
signer_id: &Identifier<C>,
signing_package: &SigningPackage<C>,
) -> Result<Scalar<C>, Error<C>> {
@ -395,7 +395,8 @@ where
.unwrap();
// Compute Lagrange coefficient.
let lambda_i = derive_lagrange_coeff(&signature_share.identifier, signing_package)?;
let lambda_i =
derive_interpolating_value(&signature_share.identifier, signing_package)?;
let binding_factor = binding_factor_list[signature_share.identifier].clone();

View File

@ -166,7 +166,7 @@ pub fn sign<C: Ciphersuite>(
let group_commitment = compute_group_commitment(signing_package, &binding_factor_list)?;
// Compute Lagrange coefficient.
let lambda_i = frost::derive_lagrange_coeff(key_package.identifier(), signing_package)?;
let lambda_i = frost::derive_interpolating_value(key_package.identifier(), signing_package)?;
// Compute the per-message challenge.
let challenge = challenge::<C>(

View File

@ -47,7 +47,7 @@ pub fn sign<C: Ciphersuite>(
let group_commitment = frost::compute_group_commitment(signing_package, &binding_factor_list)?;
// Compute Lagrange coefficient.
let lambda_i = frost::derive_lagrange_coeff(key_package.identifier(), signing_package)?;
let lambda_i = frost::derive_interpolating_value(key_package.identifier(), signing_package)?;
// Compute the per-message challenge.
let challenge = frost_core::challenge::<C>(
@ -121,7 +121,8 @@ where
.unwrap();
// Compute Lagrange coefficient.
let lambda_i = frost::derive_lagrange_coeff(&signature_share.identifier, signing_package)?;
let lambda_i =
frost::derive_interpolating_value(&signature_share.identifier, signing_package)?;
let rho = binding_factor_list[signature_share.identifier].clone();

View File

@ -196,8 +196,8 @@ fn main() -> ExitCode {
],
),
] {
let lib_filename = format!("{}/src/lib.rs", folder);
let dkg_filename = format!("{}/src/keys/dkg.rs", folder);
let lib_filename = format!("{folder}/src/lib.rs");
let dkg_filename = format!("{folder}/src/keys/dkg.rs");
// Copy the documentation of public items in Rust code, replacing ciphersuite-specific strings inside
// them in the process.
for (docs, filename) in [(&docs, lib_filename), (&dkg_docs, dkg_filename)] {
@ -207,8 +207,8 @@ fn main() -> ExitCode {
// them in the process.
for filename in ["README.md", "dkg.md"] {
replaced |= copy_and_replace(
format!("{}/{}", original_folder, filename).as_str(),
format!("{}/{}", folder, filename).as_str(),
format!("{original_folder}/{filename}").as_str(),
format!("{folder}/{filename}").as_str(),
original_strings,
replacement_strings,
);