Skip to content

Commit

Permalink
Use the right message size in test (#822)
Browse files Browse the repository at this point in the history
  • Loading branch information
benr-ml authored Aug 22, 2024
1 parent 0e944fc commit bd4999b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions fastcrypto-tbls/src/tests/dkg_v1_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ use crate::random_oracle::RandomOracle;
use crate::tbls::ThresholdBls;
use crate::types::ThresholdBls12381MinSig;
use fastcrypto::error::FastCryptoError;
use fastcrypto::groups::bls12381::G2Element;
use fastcrypto::groups::bls12381::{G2Element, Scalar};
use fastcrypto::groups::GroupElement;
use fastcrypto::traits::AllowedRng;
use itertools::Itertools;
use rand::prelude::StdRng;
use rand::{thread_rng, SeedableRng};

Expand Down Expand Up @@ -631,19 +632,23 @@ fn test_size_limits() {
let t = n / 3;
let k = 400;

// an approximation of the weights
let w = n / k;
let shares = (0..w).map(Scalar::from).collect_vec();

let p = Poly::<<G2Element as GroupElement>::ScalarType>::rand(t as u16, &mut thread_rng());
let ro = RandomOracle::new("test");
let keys_and_msg = (0..k)
.map(|i| {
.map(|_| {
let sk = PrivateKey::<EG>::new(&mut thread_rng());
let pk = PublicKey::<EG>::from_private_key(&sk);
(sk, pk, format!("test {}", i))
(sk, pk, bcs::to_bytes(&shares).unwrap())
})
.collect::<Vec<_>>();
let encrypted_shares = MultiRecipientEncryption::encrypt(
&keys_and_msg
.iter()
.map(|(_, pk, msg)| (pk.clone(), msg.as_bytes().to_vec()))
.map(|(_, pk, msg)| (pk.clone(), msg.clone()))
.collect::<Vec<_>>(),
&ro,
&mut thread_rng(),
Expand Down

0 comments on commit bd4999b

Please sign in to comment.