/// Create a random NI-DKG config that is a peer for another
/// configuration with the opposite threshold requirements so it
/// is possible to perform tests where a single subnet has both
/// high and low threshold transcripts
Create a random NI-DKG config that is a peer for another
configuration with the opposite threshold requirements so it
is possible to perform tests where a single subnet has both
high and low threshold transcripts
Create a random NI - DKG config that is a peer for another configuration with the opposite threshold requirements so it is possible to perform tests where a single subnet has both high and low threshold transcripts
pub fn new_with_inverted_threshold(&self) -> Self {
        let rng = &mut thread_rng();
        let dkg_tag = match self.0.dkg_id().dkg_tag {
            NiDkgTag::LowThreshold => NiDkgTag::HighThreshold,
            NiDkgTag::HighThreshold => NiDkgTag::LowThreshold,
        };
        let subnet_size = self.0.receivers().get().len();
        let receivers = self.0.receivers().get().clone();
        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.
            Self::random_node_ids_excluding(&receivers, required_dealer_count + dealer_surplus)
        };
        let config_data = NiDkgConfigData {
            dkg_id: NiDkgId {
                start_block_height: self.0.dkg_id().start_block_height,
                dealer_subnet: self.0.dkg_id().dealer_subnet,
                dkg_tag,
                target_subnet: self.0.dkg_id().target_subnet,
            },
            max_corrupt_dealers: Self::number_of_nodes_from_usize(rng.gen_range(0, dealers.len())),
            dealers,
            max_corrupt_receivers: {
                Self::number_of_nodes_from_usize(get_faults_tolerated(subnet_size))
            },
            receivers,
            threshold: Self::number_of_nodes_from_usize(threshold),
            registry_version: self.0.registry_version() + Self::ONE_REGISTRY_VERSION,
            resharing_transcript: None,
        };
        Self(NiDkgConfig::new(config_data).expect("invariant violated"))
    }
pub fn new_with_inverted_threshold ( & self ) -> Self { let rng = & mut thread_rng ( ) ; let dkg_tag = match self . 0 . dkg_id ( ) . dkg_tag { NiDkgTag :: LowThreshold => NiDkgTag :: HighThreshold , NiDkgTag :: HighThreshold => NiDkgTag :: LowThreshold , } ; let subnet_size = self . 0 . receivers ( ) . get ( ) . len ( ) ; let receivers = self . 0 . receivers ( ) . get ( ) . clone ( ) ; 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. Self :: random_node_ids_excluding ( & receivers , required_dealer_count + dealer_surplus ) } ; let config_data = NiDkgConfigData { dkg_id : NiDkgId { start_block_height : self . 0 . dkg_id ( ) . start_block_height , dealer_subnet : self . 0 . dkg_id ( ) . dealer_subnet , dkg_tag , target_subnet : self . 0 . dkg_id ( ) . target_subnet , } , max_corrupt_dealers : Self :: number_of_nodes_from_usize ( rng . gen_range ( 0 , dealers . len ( ) ) ) , dealers , max_corrupt_receivers : { Self :: number_of_nodes_from_usize ( get_faults_tolerated ( subnet_size ) ) } , receivers , threshold : Self :: number_of_nodes_from_usize ( threshold ) , registry_version : self . 0 . registry_version ( ) + Self :: ONE_REGISTRY_VERSION , resharing_transcript : None , } ; Self ( NiDkgConfig :: new ( config_data ) . expect ( " " ) ) }
Create a random NI-DKG config that is a peer for another
configuration with the opposite threshold requirements so it
is possible to perform tests where a single subnet has both
high and low threshold transcripts
Create a random NI - DKG config that is a peer for another configuration with the opposite threshold requirements so it is possible to perform tests where a single subnet has both high and low threshold transcripts
&self