pub fn cmd_set_recovery_cup(
    agent: &Agent,
    player: &crate::Player,
    cmd: &SetRecoveryCupCmd,
    context_time: Time,
) -> Result<SignedIngress, String> {
    use ic_crypto::utils::ni_dkg::initial_ni_dkg_transcript_record_from_transcript;
    use ic_types::crypto::threshold_sig::ni_dkg::NiDkgTag;

    let time = context_time + Duration::from_secs(60);
    let state_hash = hex::decode(&cmd.state_hash).map_err(|err| format!("{}", err))?;
    let cup = player.get_highest_catch_up_package();
    let payload = cup.content.block.as_ref().payload.as_ref();
    let summary = payload.as_summary();
    let low_threshold_transcript = summary
        .dkg
        .current_transcript(&NiDkgTag::LowThreshold)
        .clone();
    let high_threshold_transcript = summary
        .dkg
        .current_transcript(&NiDkgTag::HighThreshold)
        .clone();
    let initial_ni_dkg_transcript_low_threshold = Some(
        initial_ni_dkg_transcript_record_from_transcript(low_threshold_transcript),
    );
    let initial_ni_dkg_transcript_high_threshold = Some(
        initial_ni_dkg_transcript_record_from_transcript(high_threshold_transcript),
    );
    let cup_contents = CatchUpPackageContents {
        initial_ni_dkg_transcript_low_threshold,
        initial_ni_dkg_transcript_high_threshold,
        height: cmd.height,
        time: time.as_nanos_since_unix_epoch(),
        state_hash,
        registry_store_uri: Some(RegistryStoreUri {
            uri: cmd.registry_store_uri.clone().unwrap_or_default(),
            hash: cmd.registry_store_sha256.clone().unwrap_or_default(),
            registry_version: player.get_latest_registry_version(context_time)?.get(),
        }),
    };

    update_catch_up_package_contents(agent, player.subnet_id, cup_contents, context_time)
}
/// Creates a recovery CUP by using the latest CUP and overriding the height and
/// the state hash.
Creates a recovery CUP by using the latest CUP and overriding the height and
the state hash.
Creates a recovery CUP by using the latest CUP and overriding the height and the state hash .
pub fn cmd_set_recovery_cup(
    agent: &Agent,
    player: &crate::Player,
    cmd: &SetRecoveryCupCmd,
    context_time: Time,
) -> Result<SignedIngress, String> {
    use ic_crypto::utils::ni_dkg::initial_ni_dkg_transcript_record_from_transcript;
    use ic_types::crypto::threshold_sig::ni_dkg::NiDkgTag;
    let time = context_time + Duration::from_secs(60);
    let state_hash = hex::decode(&cmd.state_hash).map_err(|err| format!("{}", err))?;
    let cup = player.get_highest_catch_up_package();
    let payload = cup.content.block.as_ref().payload.as_ref();
    let summary = payload.as_summary();
    let low_threshold_transcript = summary
        .dkg
        .current_transcript(&NiDkgTag::LowThreshold)
        .clone();
    let high_threshold_transcript = summary
        .dkg
        .current_transcript(&NiDkgTag::HighThreshold)
        .clone();
    let initial_ni_dkg_transcript_low_threshold = Some(
        initial_ni_dkg_transcript_record_from_transcript(low_threshold_transcript),
    );
    let initial_ni_dkg_transcript_high_threshold = Some(
        initial_ni_dkg_transcript_record_from_transcript(high_threshold_transcript),
    );
    let cup_contents = CatchUpPackageContents {
        initial_ni_dkg_transcript_low_threshold,
        initial_ni_dkg_transcript_high_threshold,
        height: cmd.height,
        time: time.as_nanos_since_unix_epoch(),
        state_hash,
        registry_store_uri: Some(RegistryStoreUri {
            uri: cmd.registry_store_uri.clone().unwrap_or_default(),
            hash: cmd.registry_store_sha256.clone().unwrap_or_default(),
            registry_version: player.get_latest_registry_version(context_time)?.get(),
        }),
    };
    update_catch_up_package_contents(agent, player.subnet_id, cup_contents, context_time)
}
pub fn cmd_set_recovery_cup ( agent : & Agent , player : & crate :: Player , cmd : & SetRecoveryCupCmd , context_time : Time , ) -> Result < SignedIngress , String > { use ic_crypto :: utils :: ni_dkg :: initial_ni_dkg_transcript_record_from_transcript ; use ic_types :: crypto :: threshold_sig :: ni_dkg :: NiDkgTag ; let time = context_time + Duration :: from_secs ( 60 ) ; let state_hash = hex :: decode ( & cmd . state_hash ) . map_err ( | err | format ! ( " " err ) ) ? ; let cup = player . get_highest_catch_up_package ( ) ; let payload = cup . content . block . as_ref ( ) . payload . as_ref ( ) ; let summary = payload . as_summary ( ) ; let low_threshold_transcript = summary . dkg . current_transcript ( & NiDkgTag :: LowThreshold ) . clone ( ) ; let high_threshold_transcript = summary . dkg . current_transcript ( & NiDkgTag :: HighThreshold ) . clone ( ) ; let initial_ni_dkg_transcript_low_threshold = Some ( initial_ni_dkg_transcript_record_from_transcript ( low_threshold_transcript ) , ) ; let initial_ni_dkg_transcript_high_threshold = Some ( initial_ni_dkg_transcript_record_from_transcript ( high_threshold_transcript ) , ) ; let cup_contents = CatchUpPackageContents { initial_ni_dkg_transcript_low_threshold , initial_ni_dkg_transcript_high_threshold , height : cmd . height , time : time . as_nanos_since_unix_epoch ( ) , state_hash , registry_store_uri : Some ( RegistryStoreUri { uri : cmd . registry_store_uri . clone ( ) . unwrap_or_default ( ) , hash : cmd . registry_store_sha256 . clone ( ) . unwrap_or_default ( ) , registry_version : player . get_latest_registry_version ( context_time ) ? . get ( ) , } ) , } ; update_catch_up_package_contents ( agent , player . subnet_id , cup_contents , context_time ) }
Creates a recovery CUP by using the latest CUP and overriding the height and
the state hash.
Creates a recovery CUP by using the latest CUP and overriding the height and the state hash .
agent
&Agent
player
&crate::Player
cmd
&SetRecoveryCupCmd
context_time
Time
agent
&Agent
player
&crate::Player
cmd
&SetRecoveryCupCmd
context_time
Time