From 45177cd08b372ebefc34bad5c21f08c4ec5a74e8 Mon Sep 17 00:00:00 2001 From: microproofs Date: Thu, 23 Nov 2023 13:00:24 -0500 Subject: [PATCH] fix: add missing type checks for the new bls primitives --- crates/aiken-lang/src/gen_uplc.rs | 6 ++++++ crates/aiken-lang/src/gen_uplc/builder.rs | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/crates/aiken-lang/src/gen_uplc.rs b/crates/aiken-lang/src/gen_uplc.rs index 787c1a2d..23ee3c2f 100644 --- a/crates/aiken-lang/src/gen_uplc.rs +++ b/crates/aiken-lang/src/gen_uplc.rs @@ -4049,6 +4049,12 @@ impl<'a> CodeGenerator<'a> { Term::equals_string() } else if tipo.is_bytearray() { Term::equals_bytestring() + } else if tipo.is_bls381_12_g1() { + Term::bls12_381_g1_equal() + } else if tipo.is_bls381_12_g2() { + Term::bls12_381_g2_equal() + } else if tipo.is_ml_result() { + panic!("ML Result equality is not supported") } else { Term::equals_data() }; diff --git a/crates/aiken-lang/src/gen_uplc/builder.rs b/crates/aiken-lang/src/gen_uplc/builder.rs index d5732214..782be3dc 100644 --- a/crates/aiken-lang/src/gen_uplc/builder.rs +++ b/crates/aiken-lang/src/gen_uplc/builder.rs @@ -579,6 +579,12 @@ pub fn get_variant_name(t: &Rc) -> String { "_bool".to_string() } else if t.is_bytearray() { "_bytearray".to_string() + } else if t.is_bls381_12_g1() { + "_bls381_12_g1".to_string() + } else if t.is_bls381_12_g2() { + "_bls381_12_g2".to_string() + } else if t.is_ml_result() { + "_ml_result".to_string() } else if t.is_map() { let mut full_type = vec!["_map".to_string()]; let pair_type = &t.get_inner_types()[0]; @@ -1305,7 +1311,7 @@ pub fn convert_constants_to_data(constants: Vec>) -> Vec UplcConstant::Data(PlutusData::BoundedBytes( b.deref().clone().compress().into(), )), - UplcConstant::Bls12_381MlResult(_) => unreachable!("Bls12_381MlResult not supported"), + UplcConstant::Bls12_381MlResult(_) => panic!("Bls12_381MlResult not supported"), }; new_constants.push(constant); }