fn create_remote_dkg_configs(
    start_block_height: Height,
    dealer_subnet: SubnetId,
    target_subnet: NiDkgTargetSubnet,
    dealers: &BTreeSet<NodeId>,
    receivers: &BTreeSet<NodeId>,
    registry_version: &RegistryVersion,
    logger: &ReplicaLogger,
) -> Result<(NiDkgConfig, NiDkgConfig), Vec<(NiDkgId, String)>> {
    let low_thr_dkg_id = NiDkgId {
        start_block_height,
        dealer_subnet,
        dkg_tag: NiDkgTag::LowThreshold,
        target_subnet,
    };

    let high_thr_dkg_id = NiDkgId {
        start_block_height,
        dealer_subnet,
        dkg_tag: NiDkgTag::HighThreshold,
        target_subnet,
    };

    let low_thr_config =
        do_create_remote_dkg_config(&low_thr_dkg_id, dealers, receivers, registry_version);
    let high_thr_config =
        do_create_remote_dkg_config(&high_thr_dkg_id, dealers, receivers, registry_version);
    let sibl_err = String::from("Failed to create the sibling config");
    match (low_thr_config, high_thr_config) {
        (Ok(config0), Ok(config1)) => Ok((config0, config1)),
        (Err(err0), Err(err1)) => {
            error!(logger, "Failled to create a remote DKG config {}", err0);
            error!(logger, "Failled to create a remote DKG config {}", err1);
            Err(vec![
                (low_thr_dkg_id, err0.to_string()),
                (high_thr_dkg_id, err1.to_string()),
            ])
        }
        (Ok(_), Err(err1)) => {
            error!(logger, "Failled to create a remote DKG config {}", err1);
            Err(vec![
                (low_thr_dkg_id, sibl_err),
                (high_thr_dkg_id, err1.to_string()),
            ])
        }
        (Err(err0), Ok(_)) => {
            error!(logger, "Failled to create a remote DKG config {}", err0);
            Err(vec![
                (low_thr_dkg_id, err0.to_string()),
                (high_thr_dkg_id, sibl_err),
            ])
        }
    }
}
// This function is called for each entry on the SubnetCallContext. It returns
// either the created high and low configs for the entry or returns two errors
// identified by the NiDkgId.
This function is called for each entry on the SubnetCallContext. It returns
either the created high and low configs for the entry or returns two errors
identified by the NiDkgId.
This function is called for each entry on the SubnetCallContext . It returns either the created high and low configs for the entry or returns two errors identified by the NiDkgId .
fn create_remote_dkg_configs(
    start_block_height: Height,
    dealer_subnet: SubnetId,
    target_subnet: NiDkgTargetSubnet,
    dealers: &BTreeSet<NodeId>,
    receivers: &BTreeSet<NodeId>,
    registry_version: &RegistryVersion,
    logger: &ReplicaLogger,
) -> Result<(NiDkgConfig, NiDkgConfig), Vec<(NiDkgId, String)>> {
    let low_thr_dkg_id = NiDkgId {
        start_block_height,
        dealer_subnet,
        dkg_tag: NiDkgTag::LowThreshold,
        target_subnet,
    };
    let high_thr_dkg_id = NiDkgId {
        start_block_height,
        dealer_subnet,
        dkg_tag: NiDkgTag::HighThreshold,
        target_subnet,
    };
    let low_thr_config =
        do_create_remote_dkg_config(&low_thr_dkg_id, dealers, receivers, registry_version);
    let high_thr_config =
        do_create_remote_dkg_config(&high_thr_dkg_id, dealers, receivers, registry_version);
    let sibl_err = String::from("Failed to create the sibling config");
    match (low_thr_config, high_thr_config) {
        (Ok(config0), Ok(config1)) => Ok((config0, config1)),
        (Err(err0), Err(err1)) => {
            error!(logger, "Failled to create a remote DKG config {}", err0);
            error!(logger, "Failled to create a remote DKG config {}", err1);
            Err(vec![
                (low_thr_dkg_id, err0.to_string()),
                (high_thr_dkg_id, err1.to_string()),
            ])
        }
        (Ok(_), Err(err1)) => {
            error!(logger, "Failled to create a remote DKG config {}", err1);
            Err(vec![
                (low_thr_dkg_id, sibl_err),
                (high_thr_dkg_id, err1.to_string()),
            ])
        }
        (Err(err0), Ok(_)) => {
            error!(logger, "Failled to create a remote DKG config {}", err0);
            Err(vec![
                (low_thr_dkg_id, err0.to_string()),
                (high_thr_dkg_id, sibl_err),
            ])
        }
    }
}
fn create_remote_dkg_configs ( start_block_height : Height , dealer_subnet : SubnetId , target_subnet : NiDkgTargetSubnet , dealers : & BTreeSet < NodeId > , receivers : & BTreeSet < NodeId > , registry_version : & RegistryVersion , logger : & ReplicaLogger , ) -> Result < ( NiDkgConfig , NiDkgConfig ) , Vec < ( NiDkgId , String ) > > { let low_thr_dkg_id = NiDkgId { start_block_height , dealer_subnet , dkg_tag : NiDkgTag :: LowThreshold , target_subnet , } ; let high_thr_dkg_id = NiDkgId { start_block_height , dealer_subnet , dkg_tag : NiDkgTag :: HighThreshold , target_subnet , } ; let low_thr_config = do_create_remote_dkg_config ( & low_thr_dkg_id , dealers , receivers , registry_version ) ; let high_thr_config = do_create_remote_dkg_config ( & high_thr_dkg_id , dealers , receivers , registry_version ) ; let sibl_err = String :: from ( " " ) ; match ( low_thr_config , high_thr_config ) { ( Ok ( config0 ) , Ok ( config1 ) ) => Ok ( ( config0 , config1 ) ) , ( Err ( err0 ) , Err ( err1 ) ) => { error ! ( logger " " err0 ) ; error ! ( logger " " err1 ) ; Err ( vec ! [ ( low_thr_dkg_id err0 to_string ( ) ) ( high_thr_dkg_id err1 to_string ( ) ) ] ) } ( Ok ( _ ) , Err ( err1 ) ) => { error ! ( logger " " err1 ) ; Err ( vec ! [ ( low_thr_dkg_id sibl_err ) ( high_thr_dkg_id err1 to_string ( ) ) ] ) } ( Err ( err0 ) , Ok ( _ ) ) => { error ! ( logger " " err0 ) ; Err ( vec ! [ ( low_thr_dkg_id err0 to_string ( ) ) ( high_thr_dkg_id sibl_err ) ] ) } } }
This function is called for each entry on the SubnetCallContext.
This function is called for each entry on the SubnetCallContext .
start_block_height
Height
dealer_subnet
SubnetId
target_subnet
NiDkgTargetSubnet
dealers
&BTreeSet<NodeId>
receivers
&BTreeSet<NodeId>
registry_version
&RegistryVersion
logger
&ReplicaLogger
start_block_height
Height
dealer_subnet
SubnetId
target_subnet
NiDkgTargetSubnet
dealers
&BTreeSet<NodeId>
receivers
&BTreeSet<NodeId>
registry_version
&RegistryVersion
logger
&ReplicaLogger