pub fn make_genesis_summary(
    registry: &dyn RegistryClient,
    subnet_id: SubnetId,
    registry_version_to_put_in_summary: Option<RegistryVersion>,
) -> ic_types::consensus::dkg::Summary {
    let max_backoff = Duration::from_secs(32);
    let mut backoff = Duration::from_secs(1);
    loop {
        match registry.get_cup_contents(subnet_id, registry.get_latest_version()) {
            // Here the `registry_version` corresponds to the registry version at which the
            // initial CUP contents were inserted.
            Ok(versioned_record) => {
                let registry_version = versioned_record.version;
                let summary_registry_version =
                    registry_version_to_put_in_summary.unwrap_or(registry_version);
                let cup_contents = versioned_record.value.expect("Missing CUP contents");
                let cup_height = Height::new(cup_contents.height);

                let transcripts = get_dkg_transcripts_from_cup_contents(cup_contents);
                let transcripts = vec![
                    (NiDkgTag::LowThreshold, transcripts.low_threshold),
                    (NiDkgTag::HighThreshold, transcripts.high_threshold),
                ]
                .into_iter()
                .collect();

                let committee = get_node_list(subnet_id, registry, registry_version)
                    .expect("Could not retrieve committee list");

                let configs = get_configs_for_local_transcripts(
                    subnet_id,
                    committee,
                    cup_height,
                    &transcripts,
                    registry_version,
                )
                .expect("Couldn't generate configs for the genesis summary");
                // For the first 2 intervals we use the length value contained in the
                // genesis subnet record.
                let interval_length =
                    get_dkg_interval_length(registry, registry_version, subnet_id)
                        .expect("Could not retieve the interval length for the genesis summary.");
                let next_interval_length = interval_length;
                return Summary::new(
                    configs,
                    transcripts,
                    BTreeMap::new(), // next transcripts
                    BTreeMap::new(), // transcripts for other subnets
                    summary_registry_version,
                    interval_length,
                    next_interval_length,
                    cup_height,
                    BTreeMap::new(), // initial_dkg_attempts
                );
            }
            _ => {
                if backoff > max_backoff {
                    panic!("Retrieving the Dkg transcripts from registry timed out.")
                }
                std::thread::sleep(backoff);
                backoff *= 2;
            }
        }
    }
}
/// Generates the summary for the genesis block.
Generates the summary for the genesis block.
Generates the summary for the genesis block .
pub fn make_genesis_summary(
    registry: &dyn RegistryClient,
    subnet_id: SubnetId,
    registry_version_to_put_in_summary: Option<RegistryVersion>,
) -> ic_types::consensus::dkg::Summary {
    let max_backoff = Duration::from_secs(32);
    let mut backoff = Duration::from_secs(1);
    loop {
        match registry.get_cup_contents(subnet_id, registry.get_latest_version()) {
            // Here the `registry_version` corresponds to the registry version at which the
            // initial CUP contents were inserted.
            Ok(versioned_record) => {
                let registry_version = versioned_record.version;
                let summary_registry_version =
                    registry_version_to_put_in_summary.unwrap_or(registry_version);
                let cup_contents = versioned_record.value.expect("Missing CUP contents");
                let cup_height = Height::new(cup_contents.height);
                let transcripts = get_dkg_transcripts_from_cup_contents(cup_contents);
                let transcripts = vec![
                    (NiDkgTag::LowThreshold, transcripts.low_threshold),
                    (NiDkgTag::HighThreshold, transcripts.high_threshold),
                ]
                .into_iter()
                .collect();
                let committee = get_node_list(subnet_id, registry, registry_version)
                    .expect("Could not retrieve committee list");
                let configs = get_configs_for_local_transcripts(
                    subnet_id,
                    committee,
                    cup_height,
                    &transcripts,
                    registry_version,
                )
                .expect("Couldn't generate configs for the genesis summary");
                // For the first 2 intervals we use the length value contained in the
                // genesis subnet record.
                let interval_length =
                    get_dkg_interval_length(registry, registry_version, subnet_id)
                        .expect("Could not retieve the interval length for the genesis summary.");
                let next_interval_length = interval_length;
                return Summary::new(
                    configs,
                    transcripts,
                    BTreeMap::new(), // next transcripts
                    BTreeMap::new(), // transcripts for other subnets
                    summary_registry_version,
                    interval_length,
                    next_interval_length,
                    cup_height,
                    BTreeMap::new(), // initial_dkg_attempts
                );
            }
            _ => {
                if backoff > max_backoff {
                    panic!("Retrieving the Dkg transcripts from registry timed out.")
                }
                std::thread::sleep(backoff);
                backoff *= 2;
            }
        }
    }
}
pub fn make_genesis_summary ( registry : & dyn RegistryClient , subnet_id : SubnetId , registry_version_to_put_in_summary : Option < RegistryVersion > , ) -> ic_types :: consensus :: dkg :: Summary { let max_backoff = Duration :: from_secs ( 32 ) ; let mut backoff = Duration :: from_secs ( 1 ) ; loop { match registry . get_cup_contents ( subnet_id , registry . get_latest_version ( ) ) { // Here the `registry_version` corresponds to the registry version at which the // initial CUP contents were inserted. Ok ( versioned_record ) => { let registry_version = versioned_record . version ; let summary_registry_version = registry_version_to_put_in_summary . unwrap_or ( registry_version ) ; let cup_contents = versioned_record . value . expect ( " " ) ; let cup_height = Height :: new ( cup_contents . height ) ; let transcripts = get_dkg_transcripts_from_cup_contents ( cup_contents ) ; let transcripts = vec ! [ ( NiDkgTag LowThreshold transcripts low_threshold ) ( NiDkgTag HighThreshold transcripts high_threshold ) ] . into_iter ( ) . collect ( ) ; let committee = get_node_list ( subnet_id , registry , registry_version ) . expect ( " " ) ; let configs = get_configs_for_local_transcripts ( subnet_id , committee , cup_height , & transcripts , registry_version , ) . expect ( " " ) ; // For the first 2 intervals we use the length value contained in the // genesis subnet record. let interval_length = get_dkg_interval_length ( registry , registry_version , subnet_id ) . expect ( " " ) ; let next_interval_length = interval_length ; return Summary :: new ( configs , transcripts , BTreeMap :: new ( ) , // next transcripts BTreeMap :: new ( ) , // transcripts for other subnets summary_registry_version , interval_length , next_interval_length , cup_height , BTreeMap :: new ( ) , // initial_dkg_attempts ) ; } _ => { if backoff > max_backoff { panic ! ( " " ) } std :: thread :: sleep ( backoff ) ; backoff *= 2 ; } } } }
Generates the summary for the genesis block.
Generates the summary for the genesis block .
registry
&dyn RegistryClient
subnet_id
SubnetId
registry_version_to_put_in_summary
Option<RegistryVersion>
registry
&dyn RegistryClient
subnet_id
SubnetId
registry_version_to_put_in_summary
Option<RegistryVersion>