pub fn new_with_tag_and_registry_version(
            subnet_size: usize,
            dkg_tag: NiDkgTag,
            registry_version: RegistryVersion,
        ) -> Self {
            assert!(subnet_size > 0, "subnet must not be empty");
            let rng = &mut thread_rng();

            let receivers = random_node_ids(subnet_size);
            let threshold = dkg_tag.threshold_for_subnet_of_size(subnet_size);
            let dealers = {
                let required_dealer_count = threshold;
                let dealer_surplus = rng.gen_range(0, 3);
                // Exclude receivers from being dealers because initial DKG is done by NNS for
                // another (remote) subnet, which means the dealers and receivers are disjoint.
                random_node_ids_excluding(&receivers, required_dealer_count + dealer_surplus)
            };

            let config_data = NiDkgConfigData {
                dkg_id: NiDkgId {
                    start_block_height: Height::new(random()),
                    dealer_subnet: subnet_test_id(random()),
                    dkg_tag,
                    // The first DKG is always done by NNS for another (remote) subnet
                    target_subnet: NiDkgTargetSubnet::Remote(NiDkgTargetId::new(random())),
                },
                max_corrupt_dealers: number_of_nodes_from_usize(rng.gen_range(0, dealers.len())),
                dealers,
                max_corrupt_receivers: {
                    number_of_nodes_from_usize(get_faults_tolerated(subnet_size))
                },
                receivers,
                threshold: number_of_nodes_from_usize(threshold),
                registry_version,
                resharing_transcript: None,
            };
            Self(NiDkgConfig::new(config_data).expect("invariant violated"))
        }
/// Creates a random NI-DKG config for `dkg_tag` satisfying all
/// invariants.
Creates a random NI-DKG config for `dkg_tag` satisfying all
invariants.
Creates a random NI - DKG config for ` dkg_tag ` satisfying all invariants .
pub fn new_with_tag_and_registry_version(
            subnet_size: usize,
            dkg_tag: NiDkgTag,
            registry_version: RegistryVersion,
        ) -> Self {
            assert!(subnet_size > 0, "subnet must not be empty");
            let rng = &mut thread_rng();
            let receivers = random_node_ids(subnet_size);
            let threshold = dkg_tag.threshold_for_subnet_of_size(subnet_size);
            let dealers = {
                let required_dealer_count = threshold;
                let dealer_surplus = rng.gen_range(0, 3);
                // Exclude receivers from being dealers because initial DKG is done by NNS for
                // another (remote) subnet, which means the dealers and receivers are disjoint.
                random_node_ids_excluding(&receivers, required_dealer_count + dealer_surplus)
            };
            let config_data = NiDkgConfigData {
                dkg_id: NiDkgId {
                    start_block_height: Height::new(random()),
                    dealer_subnet: subnet_test_id(random()),
                    dkg_tag,
                    // The first DKG is always done by NNS for another (remote) subnet
                    target_subnet: NiDkgTargetSubnet::Remote(NiDkgTargetId::new(random())),
                },
                max_corrupt_dealers: number_of_nodes_from_usize(rng.gen_range(0, dealers.len())),
                dealers,
                max_corrupt_receivers: {
                    number_of_nodes_from_usize(get_faults_tolerated(subnet_size))
                },
                receivers,
                threshold: number_of_nodes_from_usize(threshold),
                registry_version,
                resharing_transcript: None,
            };
            Self(NiDkgConfig::new(config_data).expect("invariant violated"))
        }
pub fn new_with_tag_and_registry_version ( subnet_size : usize , dkg_tag : NiDkgTag , registry_version : RegistryVersion , ) -> Self { assert ! ( subnet_size 0 " " ) ; let rng = & mut thread_rng ( ) ; let receivers = random_node_ids ( subnet_size ) ; let threshold = dkg_tag . threshold_for_subnet_of_size ( subnet_size ) ; let dealers = { let required_dealer_count = threshold ; let dealer_surplus = rng . gen_range ( 0 , 3 ) ; // Exclude receivers from being dealers because initial DKG is done by NNS for // another (remote) subnet, which means the dealers and receivers are disjoint. random_node_ids_excluding ( & receivers , required_dealer_count + dealer_surplus ) } ; let config_data = NiDkgConfigData { dkg_id : NiDkgId { start_block_height : Height :: new ( random ( ) ) , dealer_subnet : subnet_test_id ( random ( ) ) , dkg_tag , // The first DKG is always done by NNS for another (remote) subnet target_subnet : NiDkgTargetSubnet :: Remote ( NiDkgTargetId :: new ( random ( ) ) ) , } , max_corrupt_dealers : number_of_nodes_from_usize ( rng . gen_range ( 0 , dealers . len ( ) ) ) , dealers , max_corrupt_receivers : { number_of_nodes_from_usize ( get_faults_tolerated ( subnet_size ) ) } , receivers , threshold : number_of_nodes_from_usize ( threshold ) , registry_version , resharing_transcript : None , } ; Self ( NiDkgConfig :: new ( config_data ) . expect ( " " ) ) }
Creates a random NI-DKG config for `dkg_tag` satisfying all
invariants.
Creates a random NI - DKG config for ` dkg_tag ` satisfying all invariants .
subnet_size
usize
dkg_tag
NiDkgTag
registry_version
RegistryVersion
subnet_size
usize
dkg_tag
NiDkgTag
registry_version
RegistryVersion