fn should_threshold_sign_if_sufficient_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 random_combiner = random_node_in(&config.receivers().get());
    let combined_sig = threshold_sign_and_combine(
        SignersAndCombiner {
            signers: n_random_nodes_in(&config.receivers().get(), config.threshold().get()),
            combiner: random_combiner,
        },
        &msg,
        dkg_id,
        &crypto_components,
    );
    let random_verifier = random_node_in(&config.receivers().get());
    let verify_combined_result = crypto_for(random_verifier, &crypto_components)
        .verify_threshold_sig_combined(&combined_sig, &msg, dkg_id);

    assert!(verify_combined_result.is_ok());
}
// Test uses a random NI-DKG config.
// A random receiver is chosen to be both combiner and verifier.
Test uses a random NI-DKG config.
A random receiver is chosen to be both combiner and verifier.
Test uses a random NI - DKG config . A random receiver is chosen to be both combiner and verifier .
fn should_threshold_sign_if_sufficient_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 random_combiner = random_node_in(&config.receivers().get());
    let combined_sig = threshold_sign_and_combine(
        SignersAndCombiner {
            signers: n_random_nodes_in(&config.receivers().get(), config.threshold().get()),
            combiner: random_combiner,
        },
        &msg,
        dkg_id,
        &crypto_components,
    );
    let random_verifier = random_node_in(&config.receivers().get());
    let verify_combined_result = crypto_for(random_verifier, &crypto_components)
        .verify_threshold_sig_combined(&combined_sig, &msg, dkg_id);
    assert!(verify_combined_result.is_ok());
}
fn should_threshold_sign_if_sufficient_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 random_combiner = random_node_in ( & config . receivers ( ) . get ( ) ) ; let combined_sig = threshold_sign_and_combine ( SignersAndCombiner { signers : n_random_nodes_in ( & config . receivers ( ) . get ( ) , config . threshold ( ) . get ( ) ) , combiner : random_combiner , } , & msg , dkg_id , & crypto_components , ) ; let random_verifier = random_node_in ( & config . receivers ( ) . get ( ) ) ; let verify_combined_result = crypto_for ( random_verifier , & crypto_components ) . verify_threshold_sig_combined ( & combined_sig , & msg , dkg_id ) ; assert ! ( verify_combined_result is_ok ( ) ) ; }
Test uses a random NI-DKG config.
Test uses a random NI - DKG config .