fn should_produce_valid_signature_shares() {
    let subnet_size = thread_rng().gen_range(1, 7);
    let (config, dkg_id, crypto_components) = setup_with_random_ni_dkg_config(subnet_size);

    run_ni_dkg_and_load_transcript_for_receivers(&config, &crypto_components);

    let msg = message();
    let sig_shares = sign_threshold_for_each(
        &config.receivers().get().iter().copied().collect::<Vec<_>>(),
        &msg,
        dkg_id,
        &crypto_components,
    );

    let verifier = random_node_in(config.receivers().get());
    sig_shares.iter().for_each(|(signer, sig_share)| {
        assert!(
            crypto_for(verifier, &crypto_components)
                .verify_threshold_sig_share(sig_share, &msg, dkg_id, *signer)
                .is_ok(),
            "node {:?} failed to verify threshold sig share of signer {:?}",
            verifier,
            *signer
        );
    });
}
// Test uses a random NI-DKG config. A random receiver is chosen as verifier.
Test uses a random NI-DKG config. A random receiver is chosen as verifier.
Test uses a random NI - DKG config . A random receiver is chosen as verifier .
fn should_produce_valid_signature_shares() {
    let subnet_size = thread_rng().gen_range(1, 7);
    let (config, dkg_id, crypto_components) = setup_with_random_ni_dkg_config(subnet_size);
    run_ni_dkg_and_load_transcript_for_receivers(&config, &crypto_components);
    let msg = message();
    let sig_shares = sign_threshold_for_each(
        &config.receivers().get().iter().copied().collect::<Vec<_>>(),
        &msg,
        dkg_id,
        &crypto_components,
    );
    let verifier = random_node_in(config.receivers().get());
    sig_shares.iter().for_each(|(signer, sig_share)| {
        assert!(
            crypto_for(verifier, &crypto_components)
                .verify_threshold_sig_share(sig_share, &msg, dkg_id, *signer)
                .is_ok(),
            "node {:?} failed to verify threshold sig share of signer {:?}",
            verifier,
            *signer
        );
    });
}
fn should_produce_valid_signature_shares ( ) { let subnet_size = thread_rng ( ) . gen_range ( 1 , 7 ) ; let ( config , dkg_id , crypto_components ) = setup_with_random_ni_dkg_config ( subnet_size ) ; run_ni_dkg_and_load_transcript_for_receivers ( & config , & crypto_components ) ; let msg = message ( ) ; let sig_shares = sign_threshold_for_each ( & config . receivers ( ) . get ( ) . iter ( ) . copied ( ) . collect :: < Vec < _ > > ( ) , & msg , dkg_id , & crypto_components , ) ; let verifier = random_node_in ( config . receivers ( ) . get ( ) ) ; sig_shares . iter ( ) . for_each ( | ( signer , sig_share ) | { assert ! ( crypto_for ( verifier crypto_components ) verify_threshold_sig_share ( sig_share msg dkg_id signer ) is_ok ( ) " " verifier signer ) ; } ) ; }
Test uses a random NI-DKG config.
Test uses a random NI - DKG config .