diff --git a/rs/consensus/src/cup_utils.rs b/rs/consensus/src/cup_utils.rs index 23e29506c4d..37ab1c98d14 100644 --- a/rs/consensus/src/cup_utils.rs +++ b/rs/consensus/src/cup_utils.rs @@ -82,16 +82,25 @@ pub fn make_registry_cup_from_cup_contents( } }; - let low_dkg_id = dkg_summary - .current_transcript(&NiDkgTag::LowThreshold) - .expect("No current low threshold transcript available") - .dkg_id - .clone(); - let high_dkg_id = dkg_summary - .current_transcript(&NiDkgTag::HighThreshold) - .expect("No current high threshold transcript available") - .dkg_id - .clone(); + let Some(low_threshold_transcript) = dkg_summary.current_transcript(&NiDkgTag::LowThreshold) + else { + warn!( + logger, + "No current low threshold transcript in registry CUP contents" + ); + return None; + }; + let low_dkg_id = low_threshold_transcript.dkg_id.clone(); + + let Some(high_threshold_transcript) = dkg_summary.current_transcript(&NiDkgTag::HighThreshold) + else { + warn!( + logger, + "No current high threshold transcript in registry CUP contents" + ); + return None; + }; + let high_dkg_id = high_threshold_transcript.dkg_id.clone(); // In a NNS subnet recovery case the block validation context needs to reference a registry // version of the NNS to be recovered. Otherwise the validation context points to a registry @@ -164,7 +173,14 @@ pub fn make_registry_cup( } }; - let cup_contents = versioned_record.value.expect("Missing CUP contents"); + let Some(cup_contents) = versioned_record.value else { + warn!( + logger, + "Missing registry CUP contents at version {}", versioned_record.version + ); + return None; + }; + make_registry_cup_from_cup_contents( registry, subnet_id,