Skip to content

Commit

Permalink
Linting and stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
cygnusv committed Sep 14, 2023
1 parent 29101b1 commit 1704f86
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 20 deletions.
2 changes: 1 addition & 1 deletion ferveo/src/dkg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ pub(crate) mod test_common {
my_index: usize,
) -> TestSetup {
let keypairs = gen_keypairs(shares_num);
let mut validators = gen_validators(&keypairs.as_slice());
let mut validators = gen_validators(keypairs.as_slice());
validators.sort();
let me = validators[my_index].clone();
let dkg = PubliclyVerifiableDkg::new(
Expand Down
14 changes: 7 additions & 7 deletions ferveo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,8 @@ mod test_dkg_full {
// Now, every participant separately:
// TODO: Move this logic outside tests (see #162, #163)
let updated_shares: Vec<_> = remaining_validators
.iter()
.map(|(_validator_address, validator)| {
.values()
.map(|validator| {
// Current participant receives updates from other participants
let updates_for_participant: Vec<_> = share_updates
.values()
Expand Down Expand Up @@ -496,9 +496,9 @@ mod test_dkg_full {
assert_eq!(domain_points.len(), security_threshold as usize);
assert_eq!(decryption_shares.len(), security_threshold as usize);

let lagrange = tpke::prepare_combine_simple::<E>(&domain_points);
let lagrange = tpke::prepare_combine_simple::<E>(domain_points);
let new_shared_secret =
tpke::share_combine_simple::<E>(&decryption_shares, &lagrange);
tpke::share_combine_simple::<E>(decryption_shares, &lagrange);

assert_eq!(
old_shared_secret, new_shared_secret,
Expand Down Expand Up @@ -552,8 +552,8 @@ mod test_dkg_full {
// TODO: Move this logic outside tests (see #162, #163)
let updated_shares: Vec<_> = dkg
.validators
.iter()
.map(|(_validator_address, validator)| {
.values()
.map(|validator| {
// Current participant receives updates from other participants
let updates_for_participant: Vec<_> = share_updates
.values()
Expand Down Expand Up @@ -585,7 +585,7 @@ mod test_dkg_full {
.map(|(share_index, validator_keypair)| {
DecryptionShareSimple::create(
&validator_keypair.decryption_key,
&updated_shares.get(share_index).unwrap(),
updated_shares.get(share_index).unwrap(),
&ciphertext.header().unwrap(),
aad,
&dkg.pvss_params.g_inv(),
Expand Down
13 changes: 7 additions & 6 deletions ferveo/src/refresh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,17 +130,17 @@ mod tests_refresh {
type E = ark_bls12_381::Bls12_381;
type ScalarField = <E as Pairing>::ScalarField;

use group_threshold_cryptography::{
test_common::setup_simple, PrivateDecryptionContextSimple,
PrivateKeyShare,
};

use crate::{
apply_updates_to_private_share, prepare_share_updates_for_recovery,
prepare_share_updates_for_refresh,
recover_share_from_updated_private_shares,
};

use group_threshold_cryptography::{
test_common::setup_simple, PrivateDecryptionContextSimple,
PrivateKeyShare,
};

fn make_new_share_fragments_for_recovery<R: RngCore>(
rng: &mut R,
threshold: usize,
Expand Down Expand Up @@ -241,6 +241,7 @@ mod tests_refresh {
assert_eq!(new_private_key_share, original_private_key_share);

// If we don't have enough private share updates, the resulting private share will be incorrect
assert_eq!(domain_points.len(), new_share_fragments.len());
let incorrect_private_key_share =
recover_share_from_updated_private_shares(
&x_r,
Expand Down Expand Up @@ -342,7 +343,7 @@ mod tests_refresh {
.iter()
.map(|p| {
let deltas_i = prepare_share_updates_for_refresh::<E>(
&domain_points,
domain_points,
&h,
threshold,
rng,
Expand Down
4 changes: 2 additions & 2 deletions tpke/benches/arkworks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ use ark_ec::{
pairing::{prepare_g1, prepare_g2, Pairing},
AffineRepr, CurveGroup,
};
use ark_ff::{BigInteger256, Field, One, UniformRand, Zero};
use ark_ff::{BigInteger256, Field, UniformRand};
use criterion::{
black_box, criterion_group, criterion_main, BenchmarkId, Criterion,
};
use itertools::izip;
use rand::prelude::StdRng;
use rand_core::{RngCore, SeedableRng};
use rand_core::SeedableRng;

type E = Bls12_381;
type G1Prepared = <E as Pairing>::G1Prepared;
Expand Down
5 changes: 1 addition & 4 deletions tpke/benches/tpke.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#![allow(clippy::redundant_closure)]

use std::collections::HashMap;

use ark_bls12_381::{Bls12_381, Fr, G1Affine as G1, G2Affine as G2};
use ark_ec::{pairing::Pairing, AffineRepr};
use ark_ff::Zero;
use ark_ec::pairing::Pairing;
use criterion::{
black_box, criterion_group, criterion_main, BenchmarkId, Criterion,
};
Expand Down

0 comments on commit 1704f86

Please sign in to comment.