fix: add missing type checks for the new bls primitives

This commit is contained in:
microproofs 2023-11-23 13:00:24 -05:00
parent 63f96d13ca
commit 45177cd08b
2 changed files with 13 additions and 1 deletions

View File

@ -4049,6 +4049,12 @@ impl<'a> CodeGenerator<'a> {
Term::equals_string() Term::equals_string()
} else if tipo.is_bytearray() { } else if tipo.is_bytearray() {
Term::equals_bytestring() 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 { } else {
Term::equals_data() Term::equals_data()
}; };

View File

@ -579,6 +579,12 @@ pub fn get_variant_name(t: &Rc<Type>) -> String {
"_bool".to_string() "_bool".to_string()
} else if t.is_bytearray() { } else if t.is_bytearray() {
"_bytearray".to_string() "_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() { } else if t.is_map() {
let mut full_type = vec!["_map".to_string()]; let mut full_type = vec!["_map".to_string()];
let pair_type = &t.get_inner_types()[0]; let pair_type = &t.get_inner_types()[0];
@ -1305,7 +1311,7 @@ pub fn convert_constants_to_data(constants: Vec<Rc<UplcConstant>>) -> Vec<UplcCo
UplcConstant::Bls12_381G2Element(b) => UplcConstant::Data(PlutusData::BoundedBytes( UplcConstant::Bls12_381G2Element(b) => UplcConstant::Data(PlutusData::BoundedBytes(
b.deref().clone().compress().into(), 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); new_constants.push(constant);
} }