MCPcopy Create free account
hub / github.com/docknetwork/crypto / check

Function check

bbs_plus/src/threshold/threshold_bbs_plus.rs:246–521  ·  view source on GitHub ↗
(
            rng: &mut StdRng,
            ote_params: MultiplicationOTEParams<KAPPA, STATISTICAL_SECURITY_PARAMETER>,
            threshold_signers: u16,
            total_signers: u16,
            

Source from the content-addressed store, hash-verified

244 >(ote_params, b"test-gadget-vector");
245
246 fn check(
247 rng: &mut StdRng,
248 ote_params: MultiplicationOTEParams<KAPPA, STATISTICAL_SECURITY_PARAMETER>,
249 threshold_signers: u16,
250 total_signers: u16,
251 sig_batch_size: u32,
252 message_count: u32,
253 gadget_vector: &GadgetVector<Fr, KAPPA, STATISTICAL_SECURITY_PARAMETER>,
254 ) {
255 let protocol_id = b"test".to_vec();
256
257 let total_party_set = (1..=total_signers).into_iter().collect::<BTreeSet<_>>();
258 let threshold_party_set = (1..=threshold_signers).into_iter().collect::<BTreeSet<_>>();
259 // The signers do a keygen. This is a one time setup.
260 let (sk, sk_shares) =
261 trusted_party_keygen::<_, Fr>(rng, threshold_signers, total_signers);
262
263 let params = SignatureParamsG1::<Bls12_381>::generate_using_rng(rng, message_count);
264 let public_key = PublicKeyG2::generate_using_secret_key(&SecretKey(sk), &params);
265
266 println!(
267 "For a batch size of {} BBS+ signatures on messages of size {} and {} signers",
268 sig_batch_size, message_count, threshold_signers
269 );
270
271 // The signers run OT protocol instances. This is also a one time setup.
272 let start = Instant::now();
273 let base_ot_outputs = do_pairwise_base_ot::<BASE_OT_KEY_SIZE>(
274 rng,
275 ote_params.num_base_ot(),
276 total_signers,
277 total_party_set.clone(),
278 );
279 println!("Base OT phase took {:?}", start.elapsed());
280
281 // Following have to happen for each new batch of signatures. Batch size can be 1 when creating one signature at a time
282 let mut round1s = vec![];
283 let mut commitments = vec![];
284 let mut commitments_zero_share = vec![];
285 let mut round1outs = vec![];
286 let total_phase1_time;
287 let mut phase1_times = BTreeMap::new();
288
289 // Signers initiate round-1 and each signer sends commitments to others
290 let start = Instant::now();
291 for i in 1..=threshold_signers {
292 let start = Instant::now();
293 let mut others = threshold_party_set.clone();
294 others.remove(&i);
295 let (round1, comm, comm_zero) =
296 Phase1::<Fr, 256>::init_for_bbs_plus::<_, Blake2b512>(
297 rng,
298 sig_batch_size,
299 i,
300 others,
301 protocol_id.clone(),
302 )
303 .unwrap();

Callers 1

signingFunction · 0.70

Calls 14

randFunction · 0.85
num_base_otMethod · 0.80
cloneMethod · 0.80
getMethod · 0.80
mapMethod · 0.80
SecretKeyClass · 0.50
into_iterMethod · 0.45
removeMethod · 0.45
receive_commitmentMethod · 0.45
iterMethod · 0.45

Tested by 1

signingFunction · 0.56