1
0
Fork 0
mirror of synced 2025-09-23 12:18:44 +00:00

Merge pull request #772 from Zokrates/u64-playground

Adding u64 support, keccak and sha3 hashes
This commit is contained in:
Thibaut Schaeffer 2021-04-07 15:49:32 +02:00 committed by GitHub
commit 80ff39d428
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
186 changed files with 2638 additions and 324 deletions

View file

@ -0,0 +1 @@
Introduce u64 type, add keccak{256,384,512} and sha3{256,384,512} hash functions to stdlib

View file

@ -45,6 +45,7 @@ enum Value<T> {
U8(u8),
U16(u16),
U32(u32),
U64(u64),
Field(T),
Boolean(bool),
Array(Vec<Value<T>>),
@ -56,6 +57,7 @@ enum CheckedValue<T> {
U8(u8),
U16(u16),
U32(u32),
U64(u64),
Field(T),
Boolean(bool),
Array(Vec<CheckedValue<T>>),
@ -72,6 +74,7 @@ impl<T: Field> fmt::Display for Value<T> {
Value::U8(v) => write!(f, "{:#04x}", v),
Value::U16(v) => write!(f, "{:#06x}", v),
Value::U32(v) => write!(f, "{:#010x}", v),
Value::U64(v) => write!(f, "{:#018x}", v),
Value::Boolean(v) => write!(f, "{}", v),
Value::Array(v) => write!(
f,
@ -100,6 +103,7 @@ impl<T: Field> Value<T> {
(Value::U8(f), ConcreteType::Uint(UBitwidth::B8)) => Ok(CheckedValue::U8(f)),
(Value::U16(f), ConcreteType::Uint(UBitwidth::B16)) => Ok(CheckedValue::U16(f)),
(Value::U32(f), ConcreteType::Uint(UBitwidth::B32)) => Ok(CheckedValue::U32(f)),
(Value::U64(f), ConcreteType::Uint(UBitwidth::B64)) => Ok(CheckedValue::U64(f)),
(Value::Boolean(b), ConcreteType::Boolean) => Ok(CheckedValue::Boolean(b)),
(Value::Array(a), ConcreteType::Array(array_type)) => {
let size = array_type.size;
@ -162,6 +166,7 @@ impl<T: From<usize>> Encode<T> for CheckedValue<T> {
CheckedValue::U8(t) => vec![T::from(t as usize)],
CheckedValue::U16(t) => vec![T::from(t as usize)],
CheckedValue::U32(t) => vec![T::from(t as usize)],
CheckedValue::U64(t) => vec![T::from(t as usize)],
CheckedValue::Boolean(b) => vec![if b { 1.into() } else { 0.into() }],
CheckedValue::Array(a) => a.into_iter().flat_map(|v| v.encode()).collect(),
CheckedValue::Struct(s) => s.into_iter().flat_map(|(_, v)| v.encode()).collect(),
@ -205,6 +210,9 @@ impl<T: Field> Decode<T> for CheckedValue<T> {
ConcreteType::Uint(UBitwidth::B32) => {
CheckedValue::U32(raw.pop().unwrap().to_dec_string().parse().unwrap())
}
ConcreteType::Uint(UBitwidth::B64) => {
CheckedValue::U64(raw.pop().unwrap().to_dec_string().parse().unwrap())
}
ConcreteType::Boolean => {
let v = raw.pop().unwrap();
CheckedValue::Boolean(if v == 0.into() {
@ -276,6 +284,9 @@ impl<T: Field> TryFrom<serde_json::Value> for Value<T> {
10 => u32::from_str_radix(&s[2..], 16)
.map(Value::U32)
.map_err(|_| format!("Expected u32 value, found {}", s)),
18 => u64::from_str_radix(&s[2..], 16)
.map(Value::U64)
.map_err(|_| format!("Expected u64 value, found {}", s)),
_ => Err(format!("Cannot parse {} to any type", s)),
})
}
@ -306,6 +317,7 @@ impl<T: Field> CheckedValue<T> {
CheckedValue::U8(u) => serde_json::Value::String(format!("{:#04x}", u)),
CheckedValue::U16(u) => serde_json::Value::String(format!("{:#06x}", u)),
CheckedValue::U32(u) => serde_json::Value::String(format!("{:#010x}", u)),
CheckedValue::U64(u) => serde_json::Value::String(format!("{:#018x}", u)),
CheckedValue::Boolean(b) => serde_json::Value::Bool(b),
CheckedValue::Array(a) => {
serde_json::Value::Array(a.into_iter().map(|e| e.into_serde_json()).collect())

View file

@ -22,7 +22,7 @@ Note that for field elements, the division operation multiplies the numerator wi
Booleans are available in ZoKrates. When a boolean is used as a parameter of the main function, the program is constrained to only accept `0` or `1` for that parameter. A boolean can be asserted to be true using an `assert(bool)` statement.
### `u8/u16/u32`
### `u8/u16/u32/u64`
Unsigned integers represent positive numbers of the interval `[0, 2 ** bitwidth[`, where `bitwidth` is specified in the type's name, e.g., 32 bits in the case of u32. Their arithmetics are defined modulo `2 ** bitwidth`.
@ -34,9 +34,9 @@ The division operation calculates the standard floor division for integers. The
### Numeric inference
In the case of decimal literals like `42`, the compiler tries to find the appropriate type (`field`, `u8`, `u16` or `u32`) depending on the context. If it cannot converge to a single option, an error is returned. This means that there is no default type for decimal literals.
In the case of decimal literals like `42`, the compiler tries to find the appropriate type (`field`, `u8`, `u16`, `u32` or `u64`) depending on the context. If it cannot converge to a single option, an error is returned. This means that there is no default type for decimal literals.
All operations between literals have the semantics of the infered type.
All operations between literals have the semantics of the inferred type.
```zokrates
{{#include ../../../zokrates_cli/examples/book/numeric_inference.zok}}

View file

@ -583,6 +583,9 @@ impl<'ast> From<pest::DecimalLiteralExpression<'ast>> for absy::ExpressionNode<'
pest::DecimalSuffix::Field(_) => absy::Expression::FieldConstant(
BigUint::parse_bytes(&expression.value.span.as_str().as_bytes(), 10).unwrap(),
),
pest::DecimalSuffix::U64(_) => {
absy::Expression::U64Constant(expression.value.span.as_str().parse().unwrap())
}
pest::DecimalSuffix::U32(_) => {
absy::Expression::U32Constant(expression.value.span.as_str().parse().unwrap())
}
@ -607,6 +610,9 @@ impl<'ast> From<pest::HexLiteralExpression<'ast>> for absy::ExpressionNode<'ast>
use crate::absy::NodeValue;
match expression.value {
pest::HexNumberExpression::U64(e) => {
absy::Expression::U64Constant(u64::from_str_radix(&e.span.as_str(), 16).unwrap())
}
pest::HexNumberExpression::U32(e) => {
absy::Expression::U32Constant(u32::from_str_radix(&e.span.as_str(), 16).unwrap())
}
@ -683,6 +689,7 @@ impl<'ast> From<pest::Type<'ast>> for absy::UnresolvedTypeNode<'ast> {
pest::BasicType::U8(t) => UnresolvedType::Uint(8).span(t.span),
pest::BasicType::U16(t) => UnresolvedType::Uint(16).span(t.span),
pest::BasicType::U32(t) => UnresolvedType::Uint(32).span(t.span),
pest::BasicType::U64(t) => UnresolvedType::Uint(64).span(t.span),
},
pest::Type::Array(t) => {
let inner_type = match t.ty {
@ -692,6 +699,7 @@ impl<'ast> From<pest::Type<'ast>> for absy::UnresolvedTypeNode<'ast> {
pest::BasicType::U8(t) => UnresolvedType::Uint(8).span(t.span),
pest::BasicType::U16(t) => UnresolvedType::Uint(16).span(t.span),
pest::BasicType::U32(t) => UnresolvedType::Uint(32).span(t.span),
pest::BasicType::U64(t) => UnresolvedType::Uint(64).span(t.span),
},
pest::BasicOrStructType::Struct(t) => {
UnresolvedType::User(t.span.as_str().to_string()).span(t.span)

View file

@ -495,6 +495,7 @@ pub enum Expression<'ast> {
U8Constant(u8),
U16Constant(u16),
U32Constant(u32),
U64Constant(u64),
Identifier(Identifier<'ast>),
Add(Box<ExpressionNode<'ast>>, Box<ExpressionNode<'ast>>),
Sub(Box<ExpressionNode<'ast>>, Box<ExpressionNode<'ast>>),
@ -543,6 +544,7 @@ impl<'ast> fmt::Display for Expression<'ast> {
Expression::U8Constant(ref i) => write!(f, "{}", i),
Expression::U16Constant(ref i) => write!(f, "{}", i),
Expression::U32Constant(ref i) => write!(f, "{}", i),
Expression::U64Constant(ref i) => write!(f, "{}", i),
Expression::IntConstant(ref i) => write!(f, "{}", i),
Expression::Identifier(ref var) => write!(f, "{}", var),
Expression::Add(ref lhs, ref rhs) => write!(f, "({} + {})", lhs, rhs),
@ -628,6 +630,7 @@ impl<'ast> fmt::Debug for Expression<'ast> {
Expression::U8Constant(ref i) => write!(f, "U8({:x})", i),
Expression::U16Constant(ref i) => write!(f, "U16({:x})", i),
Expression::U32Constant(ref i) => write!(f, "U32({:x})", i),
Expression::U64Constant(ref i) => write!(f, "U64({:x})", i),
Expression::FieldConstant(ref i) => write!(f, "Field({:?})", i),
Expression::IntConstant(ref i) => write!(f, "Int({:?})", i),
Expression::Identifier(ref var) => write!(f, "Ide({})", var),

View file

@ -29,9 +29,11 @@ pub enum FlatEmbed {
U8ToBits,
U16ToBits,
U32ToBits,
U64ToBits,
U8FromBits,
U16FromBits,
U32FromBits,
U64FromBits,
}
impl FlatEmbed {
@ -65,6 +67,12 @@ impl FlatEmbed {
DeclarationType::Boolean,
32usize,
))]),
FlatEmbed::U64ToBits => DeclarationSignature::new()
.inputs(vec![DeclarationType::uint(64)])
.outputs(vec![DeclarationType::array((
DeclarationType::Boolean,
64usize,
))]),
FlatEmbed::U8FromBits => DeclarationSignature::new()
.outputs(vec![DeclarationType::uint(8)])
.inputs(vec![DeclarationType::array((
@ -83,6 +91,12 @@ impl FlatEmbed {
DeclarationType::Boolean,
32usize,
))]),
FlatEmbed::U64FromBits => DeclarationSignature::new()
.outputs(vec![DeclarationType::uint(64)])
.inputs(vec![DeclarationType::array((
DeclarationType::Boolean,
64usize,
))]),
#[cfg(feature = "bellman")]
FlatEmbed::Sha256Round => DeclarationSignature::new()
.inputs(vec![
@ -120,9 +134,11 @@ impl FlatEmbed {
FlatEmbed::U8ToBits => "_U8_TO_BITS",
FlatEmbed::U16ToBits => "_U16_TO_BITS",
FlatEmbed::U32ToBits => "_U32_TO_BITS",
FlatEmbed::U64ToBits => "_U64_TO_BITS",
FlatEmbed::U8FromBits => "_U8_FROM_BITS",
FlatEmbed::U16FromBits => "_U16_FROM_BITS",
FlatEmbed::U32FromBits => "_U32_FROM_BITS",
FlatEmbed::U64FromBits => "_U64_FROM_BITS",
}
}

View file

@ -857,6 +857,11 @@ impl<'ast, T: Field> Flattener<'ast, T> {
param_expressions: Vec<ZirExpression<'ast, T>>,
) -> Vec<FlatUExpression<T>> {
match embed {
crate::embed::FlatEmbed::U64ToBits => self.flatten_u_to_bits(
statements_flattened,
param_expressions[0].clone(),
64.into(),
),
crate::embed::FlatEmbed::U32ToBits => self.flatten_u_to_bits(
statements_flattened,
param_expressions[0].clone(),
@ -870,6 +875,9 @@ impl<'ast, T: Field> Flattener<'ast, T> {
crate::embed::FlatEmbed::U8ToBits => {
self.flatten_u_to_bits(statements_flattened, param_expressions[0].clone(), 8.into())
}
crate::embed::FlatEmbed::U64FromBits => {
vec![self.flatten_bits_to_u(statements_flattened, param_expressions, 64.into())]
}
crate::embed::FlatEmbed::U32FromBits => {
vec![self.flatten_bits_to_u(statements_flattened, param_expressions, 32.into())]
}
@ -1125,7 +1133,7 @@ impl<'ast, T: Field> Flattener<'ast, T> {
let _ = self.get_bits(
FlatUExpression::with_field(FlatExpression::Add(
box FlatExpression::Sub(box r.into(), box d.clone()),
box FlatExpression::Number(T::from(2usize.pow(target_bitwidth.to_usize() as u32))),
box FlatExpression::Number(T::from(2_u128.pow(target_bitwidth.to_usize() as u32))),
)),
target_bitwidth.to_usize(),
target_bitwidth,
@ -2077,7 +2085,8 @@ impl<'ast, T: Field> Flattener<'ast, T> {
.collect();
match embed {
FlatEmbed::U32FromBits
FlatEmbed::U64FromBits
| FlatEmbed::U32FromBits
| FlatEmbed::U16FromBits
| FlatEmbed::U8FromBits => {
let bits = exprs

View file

@ -179,6 +179,17 @@ impl Importer {
.start_end(pos.0, pos.1),
);
}
"EMBED/u64_to_bits" => {
let alias = alias.unwrap_or("u64_to_bits");
symbols.push(
SymbolDeclaration {
id: &alias,
symbol: Symbol::Flat(FlatEmbed::U64ToBits),
}
.start_end(pos.0, pos.1),
);
}
"EMBED/u32_to_bits" => {
let alias = alias.unwrap_or("u32_to_bits");
@ -212,6 +223,17 @@ impl Importer {
.start_end(pos.0, pos.1),
);
}
"EMBED/u64_from_bits" => {
let alias = alias.unwrap_or("u64_from_bits");
symbols.push(
SymbolDeclaration {
id: &alias,
symbol: Symbol::Flat(FlatEmbed::U64FromBits),
}
.start_end(pos.0, pos.1),
);
}
"EMBED/u32_from_bits" => {
let alias = alias.unwrap_or("u32_from_bits");

View file

@ -1840,6 +1840,7 @@ impl<'ast, T: Field> Checker<'ast, T> {
Expression::U8Constant(n) => Ok(UExpressionInner::Value(n.into()).annotate(8).into()),
Expression::U16Constant(n) => Ok(UExpressionInner::Value(n.into()).annotate(16).into()),
Expression::U32Constant(n) => Ok(UExpressionInner::Value(n.into()).annotate(32).into()),
Expression::U64Constant(n) => Ok(UExpressionInner::Value(n.into()).annotate(64).into()),
Expression::FunctionCall(fun_id, generics, arguments) => {
// check the generic arguments, if any
let generics_checked: Option<Vec<Option<UExpression<'ast, T>>>> = generics

View file

@ -438,6 +438,11 @@ impl<'ast, 'a, T: Field> ResultFolder<'ast, T> for Propagator<'ast, 'a, T> {
true => {
let r: Option<TypedExpression<'ast, T>> = match embed {
FlatEmbed::U32ToField => None, // todo
FlatEmbed::U64FromBits => Some(process_u_from_bits(
assignees.clone(),
arguments.clone(),
UBitwidth::B64,
)),
FlatEmbed::U32FromBits => Some(process_u_from_bits(
assignees.clone(),
arguments.clone(),
@ -453,6 +458,11 @@ impl<'ast, 'a, T: Field> ResultFolder<'ast, T> for Propagator<'ast, 'a, T> {
arguments.clone(),
UBitwidth::B8,
)),
FlatEmbed::U64ToBits => Some(process_u_to_bits(
assignees.clone(),
arguments.clone(),
UBitwidth::B64,
)),
FlatEmbed::U32ToBits => Some(process_u_to_bits(
assignees.clone(),
arguments.clone(),

View file

@ -117,7 +117,7 @@ impl<'ast, T: Field> Folder<'ast, T> for UintOptimizer<'ast, T> {
let range = e.bitwidth.to_usize();
let range_max: T = (2_usize.pow(range as u32) - 1).into();
let range_max: T = (2_u128.pow(range as u32) - 1).into();
assert!(range < max_bitwidth / 2);
@ -319,7 +319,7 @@ impl<'ast, T: Field> Folder<'ast, T> for UintOptimizer<'ast, T> {
let e = self.fold_uint_expression(e);
let by = self.fold_uint_expression(by);
let by_max: usize = by
let by_max: u128 = by
.metadata
.clone()
.unwrap()
@ -327,7 +327,7 @@ impl<'ast, T: Field> Folder<'ast, T> for UintOptimizer<'ast, T> {
.to_dec_string()
.parse()
.unwrap();
let e_max: usize = e
let e_max: u128 = e
.metadata
.clone()
.unwrap()
@ -336,7 +336,7 @@ impl<'ast, T: Field> Folder<'ast, T> for UintOptimizer<'ast, T> {
.parse()
.unwrap();
let max = T::from((e_max << by_max) & (2_usize.pow(range as u32) - 1));
let max = T::from((e_max << by_max) & (2_u128.pow(range as u32) - 1));
UExpression::left_shift(force_reduce(e), force_reduce(by)).with_max(max)
}
@ -351,7 +351,7 @@ impl<'ast, T: Field> Folder<'ast, T> for UintOptimizer<'ast, T> {
_ => 0,
};
let e_max: usize = e
let e_max: u128 = e
.metadata
.clone()
.unwrap()
@ -360,7 +360,7 @@ impl<'ast, T: Field> Folder<'ast, T> for UintOptimizer<'ast, T> {
.parse()
.unwrap();
let max = (e_max & (2_usize.pow(range as u32) - 1)) >> by_u;
let max = (e_max & (2_u128.pow(range as u32) - 1)) >> by_u;
let max = T::from(max);
@ -423,6 +423,21 @@ impl<'ast, T: Field> Folder<'ast, T> for UintOptimizer<'ast, T> {
)],
ZirStatement::MultipleDefinition(lhs, rhs) => match rhs {
ZirExpressionList::EmbedCall(embed, generics, arguments) => match embed {
FlatEmbed::U64FromBits => {
assert_eq!(lhs.len(), 1);
self.register(
lhs[0].clone(),
UMetadata {
max: T::from(2).pow(64) - T::from(1),
should_reduce: ShouldReduce::False,
},
);
vec![ZirStatement::MultipleDefinition(
lhs,
ZirExpressionList::EmbedCall(embed, generics, arguments),
)]
}
FlatEmbed::U32FromBits => {
assert_eq!(lhs.len(), 1);
self.register(

View file

@ -387,6 +387,8 @@ pub enum UBitwidth {
B16 = 16,
#[serde(rename = "32")]
B32 = 32,
#[serde(rename = "64")]
B64 = 64,
}
impl UBitwidth {
@ -401,6 +403,7 @@ impl From<usize> for UBitwidth {
8 => UBitwidth::B8,
16 => UBitwidth::B16,
32 => UBitwidth::B32,
64 => UBitwidth::B64,
_ => unreachable!(),
}
}
@ -512,6 +515,7 @@ impl<'de, S: Deserialize<'de>> Deserialize<'de> for GType<S> {
"u8" => strict_type(mapping, GType::Uint(UBitwidth::B8)),
"u16" => strict_type(mapping, GType::Uint(UBitwidth::B16)),
"u32" => strict_type(mapping, GType::Uint(UBitwidth::B32)),
"u64" => strict_type(mapping, GType::Uint(UBitwidth::B64)),
t => Err(D::Error::custom(format!("invalid type `{}`", t))),
}
}

View file

@ -18,6 +18,8 @@ pub enum UBitwidth {
B16 = 16,
#[serde(rename = "32")]
B32 = 32,
#[serde(rename = "64")]
B64 = 64,
}
impl UBitwidth {
@ -26,6 +28,7 @@ impl UBitwidth {
UBitwidth::B8 => 8,
UBitwidth::B16 => 16,
UBitwidth::B32 => 32,
UBitwidth::B64 => 64,
}
}
}
@ -36,6 +39,7 @@ impl From<usize> for UBitwidth {
8 => UBitwidth::B8,
16 => UBitwidth::B16,
32 => UBitwidth::B32,
64 => UBitwidth::B64,
_ => unreachable!(),
}
}

View file

@ -1,36 +0,0 @@
{
"entry_point": "./tests/tests/uint/add.zok",
"max_constraint_count": 29,
"tests": [
{
"input": {
"values": ["0xff", "0x01"]
},
"output": {
"Ok": {
"values": ["0x00"]
}
}
},
{
"input": {
"values": ["0x00", "0x01"]
},
"output": {
"Ok": {
"values": ["0x01"]
}
}
},
{
"input": {
"values": ["0xff", "0xff"]
},
"output": {
"Ok": {
"values": ["0xfe"]
}
}
}
]
}

View file

@ -1,36 +0,0 @@
{
"entry_point": "./tests/tests/uint/and.zok",
"max_constraint_count": 27,
"tests": [
{
"input": {
"values": ["0xff", "0xff"]
},
"output": {
"Ok": {
"values": ["0xff"]
}
}
},
{
"input": {
"values": ["0xff", "0x00"]
},
"output": {
"Ok": {
"values": ["0x00"]
}
}
},
{
"input": {
"values": ["0x23", "0x34"]
},
"output": {
"Ok": {
"values": ["0x20"]
}
}
}
]
}

View file

@ -1,26 +0,0 @@
{
"entry_point": "./tests/tests/uint/div.zok",
"max_constraint_count": 43,
"tests": [
{
"input": {
"values": ["255", "1"]
},
"output": {
"Ok": {
"values": ["255"]
}
}
},
{
"input": {
"values": ["42", "10"]
},
"output": {
"Ok": {
"values": ["4"]
}
}
}
]
}

View file

@ -1,6 +0,0 @@
def main(u8 x, u8 y) -> u8:
assert(0x02 / 0x02 == 0x01)
assert(0x04 / 0x02 == 0x02)
assert(0x05 / 0x02 == 0x02)
assert(0xff / 0x03 == 0x55)
return x / y

View file

@ -1,26 +0,0 @@
{
"entry_point": "./tests/tests/uint/div_rem.zok",
"max_constraint_count": 43,
"tests": [
{
"input": {
"values": ["255", "1"]
},
"output": {
"Ok": {
"values": ["255", "0"]
}
}
},
{
"input": {
"values": ["42", "10"]
},
"output": {
"Ok": {
"values": ["4", "2"]
}
}
}
]
}

View file

@ -1,2 +0,0 @@
def main(u8 n, u8 d) -> (u8, u8):
return n / d, n % d

View file

@ -1,34 +1,34 @@
{
"entry_point": "./tests/tests/uint/from_to_bits.zok",
"max_constraint_count": 34,
"max_constraint_count": 128,
"tests": [
{
"input": {
"values": ["0x00000000", "0x0000", "0x00"]
"values": ["0x0000000000000000", "0x00000000", "0x0000", "0x00"]
},
"output": {
"Ok": {
"values": ["0x00000000", "0x0000", "0x00"]
"values": ["0x0000000000000000", "0x00000000", "0x0000", "0x00"]
}
}
},
{
"input": {
"values": ["0xffffffff", "0xffff", "0xff"]
"values": ["0xffffffffffffffff", "0xffffffff", "0xffff", "0xff"]
},
"output": {
"Ok": {
"values": ["0xffffffff", "0xffff", "0xff"]
"values": ["0xffffffffffffffff", "0xffffffff", "0xffff", "0xff"]
}
}
},
{
"input": {
"values": ["0x12345678", "0x1234", "0x12"]
"values": ["0x1234567812345678", "0x12345678", "0x1234", "0x12"]
},
"output": {
"Ok": {
"values": ["0x12345678", "0x1234", "0x12"]
"values": ["0x1234567812345678", "0x12345678", "0x1234", "0x12"]
}
}
}

View file

@ -1,3 +1,5 @@
import "EMBED/u64_to_bits" as to_bits_64
import "EMBED/u64_from_bits" as from_bits_64
import "EMBED/u32_to_bits" as to_bits_32
import "EMBED/u32_from_bits" as from_bits_32
import "EMBED/u16_to_bits" as to_bits_16
@ -5,8 +7,9 @@ import "EMBED/u16_from_bits" as from_bits_16
import "EMBED/u8_to_bits" as to_bits_8
import "EMBED/u8_from_bits" as from_bits_8
def main(u32 e, u16 f, u8 g) -> (u32, u16, u8):
def main(u64 d, u32 e, u16 f, u8 g) -> (u64, u32, u16, u8):
bool[64] d_bits = to_bits_64(d)
bool[32] e_bits = to_bits_32(e)
bool[16] f_bits = to_bits_16(f)
bool[8] g_bits = to_bits_8(g)
return from_bits_32(e_bits), from_bits_16(f_bits), from_bits_8(g_bits)
return from_bits_64(d_bits), from_bits_32(e_bits), from_bits_16(f_bits), from_bits_8(g_bits)

View file

@ -1,16 +0,0 @@
{
"entry_point": "./tests/tests/uint/mul.zok",
"max_constraint_count": 37,
"tests": [
{
"input": {
"values": ["2", "2"]
},
"output": {
"Ok": {
"values": ["4"]
}
}
}
]
}

View file

@ -1,36 +0,0 @@
{
"entry_point": "./tests/tests/uint/or.zok",
"max_constraint_count": 27,
"tests": [
{
"input": {
"values": ["0xff", "0xff"]
},
"output": {
"Ok": {
"values": ["0xff"]
}
}
},
{
"input": {
"values": ["0xff", "0x00"]
},
"output": {
"Ok": {
"values": ["0xff"]
}
}
},
{
"input": {
"values": ["0x23", "0x34"]
},
"output": {
"Ok": {
"values": ["0x37"]
}
}
}
]
}

View file

@ -1,26 +0,0 @@
{
"entry_point": "./tests/tests/uint/rem.zok",
"max_constraint_count": 43,
"tests": [
{
"input": {
"values": ["255", "1"]
},
"output": {
"Ok": {
"values": ["0"]
}
}
},
{
"input": {
"values": ["42", "10"]
},
"output": {
"Ok": {
"values": ["2"]
}
}
}
]
}

View file

@ -1,7 +0,0 @@
def main(u8 x, u8 y) -> u8:
assert(0x02 % 0x02 == 0x00)
assert(0x04 % 0x02 == 0x00)
assert(0x05 % 0x02 == 0x01)
assert(0xff % 0x03 == 0x00)
assert(0xff % 0x01 == 0x00)
return x % y

View file

@ -1,26 +0,0 @@
{
"entry_point": "./tests/tests/uint/shift.zok",
"max_constraint_count": 34,
"tests": [
{
"input": {
"values": ["0x12345678"]
},
"output": {
"Ok": {
"values": ["0x01234567"]
}
}
},
{
"input": {
"values": ["0x01234567"]
},
"output": {
"Ok": {
"values": ["0x00123456"]
}
}
}
]
}

View file

@ -0,0 +1,36 @@
{
"entry_point": "./tests/tests/uint/u16/add.zok",
"max_constraint_count": 53,
"tests": [
{
"input": {
"values": ["0xffff", "0x0001"]
},
"output": {
"Ok": {
"values": ["0x0000"]
}
}
},
{
"input": {
"values": ["0x1000", "0x1000"]
},
"output": {
"Ok": {
"values": ["0x2000"]
}
}
},
{
"input": {
"values": ["0xffff", "0xffff"]
},
"output": {
"Ok": {
"values": ["0xfffe"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u16 a, u16 b) -> u16:
return a + b

View file

@ -0,0 +1,36 @@
{
"entry_point": "./tests/tests/uint/u16/and.zok",
"max_constraint_count": 51,
"tests": [
{
"input": {
"values": ["0xffff", "0xffff"]
},
"output": {
"Ok": {
"values": ["0xffff"]
}
}
},
{
"input": {
"values": ["0xffff", "0x0000"]
},
"output": {
"Ok": {
"values": ["0x0000"]
}
}
},
{
"input": {
"values": ["0x1234", "0x5678"]
},
"output": {
"Ok": {
"values": ["0x1230"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u16 a, u16 b) -> u16:
return a & b

View file

@ -0,0 +1,36 @@
{
"entry_point": "./tests/tests/uint/u16/div.zok",
"max_constraint_count": 88,
"tests": [
{
"input": {
"values": ["0x1000", "0x1000"]
},
"output": {
"Ok": {
"values": ["0x0001"]
}
}
},
{
"input": {
"values": ["0x1000", "0x0002"]
},
"output": {
"Ok": {
"values": ["0x0800"]
}
}
},
{
"input": {
"values": ["0x1001", "0x0002"]
},
"output": {
"Ok": {
"values": ["0x0800"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u16 x, u16 y) -> u16:
return x / y

View file

@ -0,0 +1,26 @@
{
"entry_point": "./tests/tests/uint/u16/eq.zok",
"max_constraint_count": 37,
"tests": [
{
"input": {
"values": ["0x0002", "0x0002"]
},
"output": {
"Ok": {
"values": ["1"]
}
}
},
{
"input": {
"values": ["0x0002", "0x0004"]
},
"output": {
"Ok": {
"values": ["0"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u16 a, u16 b) -> bool:
return a == b

View file

@ -0,0 +1,26 @@
{
"entry_point": "./tests/tests/uint/u16/gt.zok",
"max_constraint_count": 697,
"tests": [
{
"input": {
"values": ["0x0004", "0x0002"]
},
"output": {
"Ok": {
"values": ["1"]
}
}
},
{
"input": {
"values": ["0x0002", "0x0002"]
},
"output": {
"Ok": {
"values": ["0"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u16 a, u16 b) -> bool:
return a > b

View file

@ -0,0 +1,36 @@
{
"entry_point": "./tests/tests/uint/u16/gte.zok",
"max_constraint_count": 699,
"tests": [
{
"input": {
"values": ["0x0004", "0x0002"]
},
"output": {
"Ok": {
"values": ["1"]
}
}
},
{
"input": {
"values": ["0x0002", "0x0002"]
},
"output": {
"Ok": {
"values": ["1"]
}
}
},
{
"input": {
"values": ["0x0001", "0x0002"]
},
"output": {
"Ok": {
"values": ["0"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u16 a, u16 b) -> bool:
return a >= b

View file

@ -0,0 +1,26 @@
{
"entry_point": "./tests/tests/uint/u16/lshift.zok",
"max_constraint_count": 18,
"tests": [
{
"input": {
"values": ["0x0002"]
},
"output": {
"Ok": {
"values": ["0x0004"]
}
}
},
{
"input": {
"values": ["0xffff"]
},
"output": {
"Ok": {
"values": ["0xfffe"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u16 x) -> u16:
return x << 1

View file

@ -0,0 +1,26 @@
{
"entry_point": "./tests/tests/uint/u16/lt.zok",
"max_constraint_count": 697,
"tests": [
{
"input": {
"values": ["0x0002", "0x0004"]
},
"output": {
"Ok": {
"values": ["1"]
}
}
},
{
"input": {
"values": ["0x0002", "0x0002"]
},
"output": {
"Ok": {
"values": ["0"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u16 a, u16 b) -> bool:
return a < b

View file

@ -0,0 +1,36 @@
{
"entry_point": "./tests/tests/uint/u16/lte.zok",
"max_constraint_count": 699,
"tests": [
{
"input": {
"values": ["0x0002", "0x0004"]
},
"output": {
"Ok": {
"values": ["1"]
}
}
},
{
"input": {
"values": ["0x0002", "0x0002"]
},
"output": {
"Ok": {
"values": ["1"]
}
}
},
{
"input": {
"values": ["0x0003", "0x0002"]
},
"output": {
"Ok": {
"values": ["0"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u16 a, u16 b) -> bool:
return a <= b

View file

@ -0,0 +1,26 @@
{
"entry_point": "./tests/tests/uint/u16/mul.zok",
"max_constraint_count": 69,
"tests": [
{
"input": {
"values": ["0x0002", "0x0008"]
},
"output": {
"Ok": {
"values": ["0x0010"]
}
}
},
{
"input": {
"values": ["0xffff", "0x0002"]
},
"output": {
"Ok": {
"values": ["0xfffe"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u16 a, u16 b) -> u16:
return a * b

View file

@ -0,0 +1,26 @@
{
"entry_point": "./tests/tests/uint/u16/neq.zok",
"max_constraint_count": 37,
"tests": [
{
"input": {
"values": ["0x0002", "0x0002"]
},
"output": {
"Ok": {
"values": ["0"]
}
}
},
{
"input": {
"values": ["0x0002", "0x0004"]
},
"output": {
"Ok": {
"values": ["1"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u16 a, u16 b) -> bool:
return a != b

View file

@ -0,0 +1,26 @@
{
"entry_point": "./tests/tests/uint/u16/not.zok",
"max_constraint_count": 18,
"tests": [
{
"input": {
"values": ["0x0001"]
},
"output": {
"Ok": {
"values": ["0xfffe"]
}
}
},
{
"input": {
"values": ["0xffff"]
},
"output": {
"Ok": {
"values": ["0x0000"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u16 a) -> u16:
return !a

View file

@ -0,0 +1,36 @@
{
"entry_point": "./tests/tests/uint/u16/or.zok",
"max_constraint_count": 51,
"tests": [
{
"input": {
"values": ["0xffff", "0xffff"]
},
"output": {
"Ok": {
"values": ["0xffff"]
}
}
},
{
"input": {
"values": ["0xffff", "0x0000"]
},
"output": {
"Ok": {
"values": ["0xffff"]
}
}
},
{
"input": {
"values": ["0x1234", "0x5678"]
},
"output": {
"Ok": {
"values": ["0x567c"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u16 x, u16 y) -> u16:
return x | y

View file

@ -0,0 +1,36 @@
{
"entry_point": "./tests/tests/uint/u16/rem.zok",
"max_constraint_count": 88,
"tests": [
{
"input": {
"values": ["0x0002", "0x0004"]
},
"output": {
"Ok": {
"values": ["0x0002"]
}
}
},
{
"input": {
"values": ["0xffff", "0x0001"]
},
"output": {
"Ok": {
"values": ["0x0000"]
}
}
},
{
"input": {
"values": ["0x1001", "0x0002"]
},
"output": {
"Ok": {
"values": ["0x0001"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u16 x, u16 y) -> u16:
return x % y

View file

@ -0,0 +1,26 @@
{
"entry_point": "./tests/tests/uint/u16/rshift.zok",
"max_constraint_count": 18,
"tests": [
{
"input": {
"values": ["0x1000"]
},
"output": {
"Ok": {
"values": ["0x0800"]
}
}
},
{
"input": {
"values": ["0xffff"]
},
"output": {
"Ok": {
"values": ["0x7fff"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u16 x) -> u16:
return x >> 1

View file

@ -0,0 +1,26 @@
{
"entry_point": "./tests/tests/uint/u16/sub.zok",
"max_constraint_count": 53,
"tests": [
{
"input": {
"values": ["0xffff", "0x0001"]
},
"output": {
"Ok": {
"values": ["0xfffe"]
}
}
},
{
"input": {
"values": ["0x0000", "0x0001"]
},
"output": {
"Ok": {
"values": ["0xffff"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u16 a, u16 b) -> u16:
return a - b

View file

@ -0,0 +1,36 @@
{
"entry_point": "./tests/tests/uint/u16/xor.zok",
"max_constraint_count": 51,
"tests": [
{
"input": {
"values": ["0xffff", "0xffff"]
},
"output": {
"Ok": {
"values": ["0x0000"]
}
}
},
{
"input": {
"values": ["0xffff", "0x0000"]
},
"output": {
"Ok": {
"values": ["0xffff"]
}
}
},
{
"input": {
"values": ["0x1234", "0x5678"]
},
"output": {
"Ok": {
"values": ["0x444c"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u16 a, u16 b) -> u16:
return a ^ b

View file

@ -0,0 +1,36 @@
{
"entry_point": "./tests/tests/uint/u32/add.zok",
"max_constraint_count": 101,
"tests": [
{
"input": {
"values": ["0xffffffff", "0x00000001"]
},
"output": {
"Ok": {
"values": ["0x00000000"]
}
}
},
{
"input": {
"values": ["0x10000000", "0x10000000"]
},
"output": {
"Ok": {
"values": ["0x20000000"]
}
}
},
{
"input": {
"values": ["0xffffffff", "0xffffffff"]
},
"output": {
"Ok": {
"values": ["0xfffffffe"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u32 a, u32 b) -> u32:
return a + b

View file

@ -0,0 +1,36 @@
{
"entry_point": "./tests/tests/uint/u32/and.zok",
"max_constraint_count": 99,
"tests": [
{
"input": {
"values": ["0xffffffff", "0xffffffff"]
},
"output": {
"Ok": {
"values": ["0xffffffff"]
}
}
},
{
"input": {
"values": ["0xffffffff", "0x00000000"]
},
"output": {
"Ok": {
"values": ["0x00000000"]
}
}
},
{
"input": {
"values": ["0x12345678", "0x87654321"]
},
"output": {
"Ok": {
"values": ["0x02244220"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u32 a, u32 b) -> u32:
return a & b

View file

@ -0,0 +1,36 @@
{
"entry_point": "./tests/tests/uint/u32/div.zok",
"max_constraint_count": 168,
"tests": [
{
"input": {
"values": ["0x10000000", "0x10000000"]
},
"output": {
"Ok": {
"values": ["0x00000001"]
}
}
},
{
"input": {
"values": ["0x10000000", "0x00000002"]
},
"output": {
"Ok": {
"values": ["0x08000000"]
}
}
},
{
"input": {
"values": ["0x10000001", "0x00000002"]
},
"output": {
"Ok": {
"values": ["0x08000000"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u32 x, u32 y) -> u32:
return x / y

View file

@ -0,0 +1,26 @@
{
"entry_point": "./tests/tests/uint/u32/eq.zok",
"max_constraint_count": 69,
"tests": [
{
"input": {
"values": ["0x00000002", "0x00000002"]
},
"output": {
"Ok": {
"values": ["1"]
}
}
},
{
"input": {
"values": ["0x00000002", "0x00000004"]
},
"output": {
"Ok": {
"values": ["0"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u32 a, u32 b) -> bool:
return a == b

View file

@ -0,0 +1,26 @@
{
"entry_point": "./tests/tests/uint/u32/gt.zok",
"max_constraint_count": 729,
"tests": [
{
"input": {
"values": ["0x00000004", "0x00000002"]
},
"output": {
"Ok": {
"values": ["1"]
}
}
},
{
"input": {
"values": ["0x00000002", "0x00000002"]
},
"output": {
"Ok": {
"values": ["0"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u32 a, u32 b) -> bool:
return a > b

View file

@ -0,0 +1,36 @@
{
"entry_point": "./tests/tests/uint/u32/gte.zok",
"max_constraint_count": 731,
"tests": [
{
"input": {
"values": ["0x00000004", "0x00000002"]
},
"output": {
"Ok": {
"values": ["1"]
}
}
},
{
"input": {
"values": ["0x00000002", "0x00000002"]
},
"output": {
"Ok": {
"values": ["1"]
}
}
},
{
"input": {
"values": ["0x00000001", "0x00000002"]
},
"output": {
"Ok": {
"values": ["0"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u32 a, u32 b) -> bool:
return a >= b

View file

@ -0,0 +1,26 @@
{
"entry_point": "./tests/tests/uint/u32/lshift.zok",
"max_constraint_count": 34,
"tests": [
{
"input": {
"values": ["0x00000002"]
},
"output": {
"Ok": {
"values": ["0x00000004"]
}
}
},
{
"input": {
"values": ["0xffffffff"]
},
"output": {
"Ok": {
"values": ["0xfffffffe"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u32 x) -> u32:
return x << 1

View file

@ -0,0 +1,26 @@
{
"entry_point": "./tests/tests/uint/u32/lt.zok",
"max_constraint_count": 729,
"tests": [
{
"input": {
"values": ["0x00000002", "0x00000004"]
},
"output": {
"Ok": {
"values": ["1"]
}
}
},
{
"input": {
"values": ["0x00000002", "0x00000002"]
},
"output": {
"Ok": {
"values": ["0"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u32 a, u32 b) -> bool:
return a < b

View file

@ -0,0 +1,36 @@
{
"entry_point": "./tests/tests/uint/u32/lte.zok",
"max_constraint_count": 731,
"tests": [
{
"input": {
"values": ["0x00000002", "0x00000004"]
},
"output": {
"Ok": {
"values": ["1"]
}
}
},
{
"input": {
"values": ["0x00000002", "0x00000002"]
},
"output": {
"Ok": {
"values": ["1"]
}
}
},
{
"input": {
"values": ["0x00000003", "0x00000002"]
},
"output": {
"Ok": {
"values": ["0"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u32 a, u32 b) -> bool:
return a <= b

View file

@ -0,0 +1,26 @@
{
"entry_point": "./tests/tests/uint/u32/mul.zok",
"max_constraint_count": 133,
"tests": [
{
"input": {
"values": ["0x00000002", "0x00000008"]
},
"output": {
"Ok": {
"values": ["0x00000010"]
}
}
},
{
"input": {
"values": ["0xffffffff", "0x00000002"]
},
"output": {
"Ok": {
"values": ["0xfffffffe"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u32 a, u32 b) -> u32:
return a * b

View file

@ -0,0 +1,26 @@
{
"entry_point": "./tests/tests/uint/u32/neq.zok",
"max_constraint_count": 69,
"tests": [
{
"input": {
"values": ["0x00000002", "0x00000002"]
},
"output": {
"Ok": {
"values": ["0"]
}
}
},
{
"input": {
"values": ["0x00000002", "0x00000004"]
},
"output": {
"Ok": {
"values": ["1"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u32 a, u32 b) -> bool:
return a != b

View file

@ -0,0 +1,26 @@
{
"entry_point": "./tests/tests/uint/u32/not.zok",
"max_constraint_count": 34,
"tests": [
{
"input": {
"values": ["0x00000001"]
},
"output": {
"Ok": {
"values": ["0xfffffffe"]
}
}
},
{
"input": {
"values": ["0xffffffff"]
},
"output": {
"Ok": {
"values": ["0x00000000"]
}
}
}
]
}

View file

@ -1,2 +1,2 @@
def main(u32 a) -> u32:
return a >> 0x00000004
return !a

View file

@ -0,0 +1,36 @@
{
"entry_point": "./tests/tests/uint/u32/or.zok",
"max_constraint_count": 99,
"tests": [
{
"input": {
"values": ["0xffffffff", "0xffffffff"]
},
"output": {
"Ok": {
"values": ["0xffffffff"]
}
}
},
{
"input": {
"values": ["0xffffffff", "0x00000000"]
},
"output": {
"Ok": {
"values": ["0xffffffff"]
}
}
},
{
"input": {
"values": ["0x12345678", "0x87654321"]
},
"output": {
"Ok": {
"values": ["0x97755779"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u32 x, u32 y) -> u32:
return x | y

View file

@ -0,0 +1,36 @@
{
"entry_point": "./tests/tests/uint/u32/rem.zok",
"max_constraint_count": 168,
"tests": [
{
"input": {
"values": ["0x00000002", "0x00000004"]
},
"output": {
"Ok": {
"values": ["0x00000002"]
}
}
},
{
"input": {
"values": ["0xffffffff", "0x00000001"]
},
"output": {
"Ok": {
"values": ["0x00000000"]
}
}
},
{
"input": {
"values": ["0x10000001", "0x00000002"]
},
"output": {
"Ok": {
"values": ["0x00000001"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u32 x, u32 y) -> u32:
return x % y

View file

@ -0,0 +1,26 @@
{
"entry_point": "./tests/tests/uint/u32/rshift.zok",
"max_constraint_count": 34,
"tests": [
{
"input": {
"values": ["0x10000000"]
},
"output": {
"Ok": {
"values": ["0x08000000"]
}
}
},
{
"input": {
"values": ["0xffffffff"]
},
"output": {
"Ok": {
"values": ["0x7fffffff"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u32 x) -> u32:
return x >> 1

View file

@ -0,0 +1,26 @@
{
"entry_point": "./tests/tests/uint/u32/sub.zok",
"max_constraint_count": 101,
"tests": [
{
"input": {
"values": ["0xffffffff", "0x00000001"]
},
"output": {
"Ok": {
"values": ["0xfffffffe"]
}
}
},
{
"input": {
"values": ["0x00000000", "0x00000001"]
},
"output": {
"Ok": {
"values": ["0xffffffff"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u32 a, u32 b) -> u32:
return a - b

View file

@ -0,0 +1,36 @@
{
"entry_point": "./tests/tests/uint/u32/xor.zok",
"max_constraint_count": 99,
"tests": [
{
"input": {
"values": ["0xffffffff", "0xffffffff"]
},
"output": {
"Ok": {
"values": ["0x00000000"]
}
}
},
{
"input": {
"values": ["0xffffffff", "0x00000000"]
},
"output": {
"Ok": {
"values": ["0xffffffff"]
}
}
},
{
"input": {
"values": ["0x12345678", "0x87654321"]
},
"output": {
"Ok": {
"values": ["0x95511559"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u32 a, u32 b) -> u32:
return a ^ b

View file

@ -0,0 +1,36 @@
{
"entry_point": "./tests/tests/uint/u64/add.zok",
"max_constraint_count": 197,
"tests": [
{
"input": {
"values": ["0xffffffffffffffff", "0x0000000000000001"]
},
"output": {
"Ok": {
"values": ["0x0000000000000000"]
}
}
},
{
"input": {
"values": ["0x1000000000000000", "0x1000000000000000"]
},
"output": {
"Ok": {
"values": ["0x2000000000000000"]
}
}
},
{
"input": {
"values": ["0xffffffffffffffff", "0xffffffffffffffff"]
},
"output": {
"Ok": {
"values": ["0xfffffffffffffffe"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u64 a, u64 b) -> u64:
return a + b

View file

@ -0,0 +1,36 @@
{
"entry_point": "./tests/tests/uint/u64/and.zok",
"max_constraint_count": 195,
"tests": [
{
"input": {
"values": ["0xffffffffffffffff", "0xffffffffffffffff"]
},
"output": {
"Ok": {
"values": ["0xffffffffffffffff"]
}
}
},
{
"input": {
"values": ["0xffffffffffffffff", "0x0000000000000000"]
},
"output": {
"Ok": {
"values": ["0x0000000000000000"]
}
}
},
{
"input": {
"values": ["0x1234567812345678", "0x8765432187654321"]
},
"output": {
"Ok": {
"values": ["0x224422002244220"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u64 a, u64 b) -> u64:
return a & b

View file

@ -0,0 +1,36 @@
{
"entry_point": "./tests/tests/uint/u64/div.zok",
"max_constraint_count": 328,
"tests": [
{
"input": {
"values": ["0x1000000000000000", "0x1000000000000000"]
},
"output": {
"Ok": {
"values": ["0x0000000000000001"]
}
}
},
{
"input": {
"values": ["0x1000000000000000", "0x0000000000000002"]
},
"output": {
"Ok": {
"values": ["0x0800000000000000"]
}
}
},
{
"input": {
"values": ["0x1000000000000001", "0x0000000000000002"]
},
"output": {
"Ok": {
"values": ["0x0800000000000000"]
}
}
}
]
}

View file

@ -0,0 +1,2 @@
def main(u64 x, u64 y) -> u64:
return x / y

Some files were not shown because too many files have changed in this diff Show more