feat: implemented the Bls381-12 builtins and types

also implemented Keccak256 and Blake2b_224

TODO: cost model, flat serialization, pretty

Co-authored-by: rvcas <x@rvcas.dev>
This commit is contained in:
microproofs
2023-11-01 22:32:42 -04:00
committed by Lucas
parent 446ef11606
commit 0d2ac952d0
13 changed files with 809 additions and 5 deletions

View File

@@ -452,7 +452,11 @@ pub fn from_default_function(
Some((tipo, 2))
}
DefaultFunction::Sha2_256 | DefaultFunction::Sha3_256 | DefaultFunction::Blake2b_256 => {
DefaultFunction::Sha2_256
| DefaultFunction::Sha3_256
| DefaultFunction::Blake2b_224
| DefaultFunction::Blake2b_256
| DefaultFunction::Keccak_256 => {
let tipo = function(vec![byte_array()], byte_array());
Some((tipo, 1))
@@ -643,6 +647,24 @@ pub fn from_default_function(
let tipo = function(vec![a.clone(), list(a.clone())], list(a));
Some((tipo, 2))
}
DefaultFunction::Bls12_381_G1_Add => todo!(),
DefaultFunction::Bls12_381_G1_Neg => todo!(),
DefaultFunction::Bls12_381_G1_Scalarmul => todo!(),
DefaultFunction::Bls12_381_G1_Equal => todo!(),
DefaultFunction::Bls12_381_G1_Compress => todo!(),
DefaultFunction::Bls12_381_G1_Uncompress => todo!(),
DefaultFunction::Bls12_381_G1_Hashtogroup => todo!(),
DefaultFunction::Bls12_381_G2_Add => todo!(),
DefaultFunction::Bls12_381_G2_Neg => todo!(),
DefaultFunction::Bls12_381_G2_Scalarmul => todo!(),
DefaultFunction::Bls12_381_G2_Equal => todo!(),
DefaultFunction::Bls12_381_G2_Compress => todo!(),
DefaultFunction::Bls12_381_G2_Uncompress => todo!(),
DefaultFunction::Bls12_381_G2_Hashtogroup => todo!(),
DefaultFunction::Bls12_381_MillerLoop => todo!(),
DefaultFunction::Bls12_381_MulMlResult => todo!(),
DefaultFunction::Bls12_381_FinalVerify => todo!(),
};
info.map(|(tipo, arity)| {

View File

@@ -1292,6 +1292,9 @@ pub fn convert_constants_to_data(constants: Vec<Rc<UplcConstant>>) -> Vec<UplcCo
any_constructor: None,
fields: vec![],
})),
UplcConstant::Bls12_381G1Element(_) => todo!(),
UplcConstant::Bls12_381G2Element(_) => todo!(),
UplcConstant::Bls12_381MlResult(_) => todo!(),
};
new_constants.push(constant);
}