enable new builtins (*with gotcha)
We still need to adjust the writeBits one to work around its list<int> argument.
This commit is contained in:
parent
d3344528b3
commit
1105dbf3c6
|
@ -505,11 +505,14 @@ pub fn plutus(id_gen: &IdGenerator) -> TypeInfo {
|
||||||
annotations: HashMap::new(),
|
annotations: HashMap::new(),
|
||||||
};
|
};
|
||||||
|
|
||||||
for builtin in DefaultFunction::iter().take(75) {
|
for builtin in DefaultFunction::iter() {
|
||||||
|
// FIXME: Disabling WriteBits for now, since its signature requires the ability to create
|
||||||
|
// list of raw integers, which isn't possible through Aiken at the moment.
|
||||||
|
if !matches!(builtin, DefaultFunction::WriteBits) {
|
||||||
let value = from_default_function(builtin, id_gen);
|
let value = from_default_function(builtin, id_gen);
|
||||||
|
|
||||||
plutus.values.insert(builtin.aiken_name(), value);
|
plutus.values.insert(builtin.aiken_name(), value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
plutus
|
plutus
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,6 @@ use builder::{
|
||||||
introduce_name, introduce_pattern, pop_pattern, softcast_data_to_type_otherwise,
|
introduce_name, introduce_pattern, pop_pattern, softcast_data_to_type_otherwise,
|
||||||
unknown_data_to_type, DISCARDED,
|
unknown_data_to_type, DISCARDED,
|
||||||
};
|
};
|
||||||
|
|
||||||
use decision_tree::{get_tipo_by_path, Assigned, CaseTest, DecisionTree, TreeGen};
|
use decision_tree::{get_tipo_by_path, Assigned, CaseTest, DecisionTree, TreeGen};
|
||||||
use indexmap::IndexMap;
|
use indexmap::IndexMap;
|
||||||
use interner::AirInterner;
|
use interner::AirInterner;
|
||||||
|
|
|
@ -136,6 +136,8 @@ pub enum Error {
|
||||||
ReadBitOutOfBounds,
|
ReadBitOutOfBounds,
|
||||||
#[error("writeBits: index out of bounds")]
|
#[error("writeBits: index out of bounds")]
|
||||||
WriteBitsOutOfBounds,
|
WriteBitsOutOfBounds,
|
||||||
|
#[error("illegal operation on empty ByteArray")]
|
||||||
|
EmptyByteArray,
|
||||||
#[error("blst error {0:?}")]
|
#[error("blst error {0:?}")]
|
||||||
Blst(blst::BLST_ERROR),
|
Blst(blst::BLST_ERROR),
|
||||||
#[error("blst::hashToGroup")]
|
#[error("blst::hashToGroup")]
|
||||||
|
|
|
@ -1592,6 +1592,10 @@ impl DefaultFunction {
|
||||||
let bytes = args[0].unwrap_byte_string()?;
|
let bytes = args[0].unwrap_byte_string()?;
|
||||||
let bit_index = args[1].unwrap_integer()?;
|
let bit_index = args[1].unwrap_integer()?;
|
||||||
|
|
||||||
|
if bytes.is_empty() {
|
||||||
|
return Err(Error::EmptyByteArray);
|
||||||
|
}
|
||||||
|
|
||||||
// This ensures there is at least one byte in bytes
|
// This ensures there is at least one byte in bytes
|
||||||
if *bit_index < 0.into() || *bit_index >= (bytes.len() * 8).into() {
|
if *bit_index < 0.into() || *bit_index >= (bytes.len() * 8).into() {
|
||||||
return Err(Error::ReadBitOutOfBounds);
|
return Err(Error::ReadBitOutOfBounds);
|
||||||
|
|
Loading…
Reference in New Issue