-
Notifications
You must be signed in to change notification settings - Fork 361
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1027 from Zokrates/rc/0.7.7
Release 0.7.7
- Loading branch information
Showing
93 changed files
with
5,801 additions
and
2,516 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
book | ||
mdbook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
def myFct<N, N2>(u64[N] ignored) -> u64[N2]: | ||
assert(2*N == N2) | ||
return [0; N2] | ||
|
||
const u32 N = 3 | ||
|
||
const u32 N2 = 2*N | ||
|
||
def main(u64[N] arg) -> bool: | ||
u64[N2] someVariable = myFct(arg) | ||
return true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from "./call_in_const_aux.zok" import A, foo, F | ||
|
||
def bar(field[A] x) -> field[A]: | ||
return x | ||
|
||
const field[A] Y = [...bar(foo::<A>(F))[..A - 1], 1] | ||
|
||
def main(field[A] X): | ||
assert(X == Y) | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const field F = 10 | ||
const u32 A = 10 | ||
const u32 B = A | ||
|
||
def foo<N>(field X) -> field[N]: | ||
return [X; N] | ||
|
||
def main(): | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
def yes() -> bool: | ||
return true | ||
|
||
const bool TRUE = yes() | ||
|
||
def main(): | ||
return |
14 changes: 14 additions & 0 deletions
14
zokrates_cli/examples/compile_errors/ambiguous_generic_call.zok
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// this should not compile, as A == B | ||
|
||
const u32 A = 1 | ||
const u32 B = 1 | ||
|
||
def foo(field[A] a) -> bool: | ||
return true | ||
|
||
def foo(field[B] a) -> bool: | ||
return true | ||
|
||
def main(): | ||
assert(foo([1])) | ||
return |
14 changes: 14 additions & 0 deletions
14
zokrates_cli/examples/compile_errors/ambiguous_generic_call_too_strict.zok
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// this should actually compile, as A != B | ||
|
||
const u32 A = 2 | ||
const u32 B = 1 | ||
|
||
def foo(field[A] a) -> bool: | ||
return true | ||
|
||
def foo(field[B] a) -> bool: | ||
return true | ||
|
||
def main(): | ||
assert(foo([1])) | ||
return |
7 changes: 7 additions & 0 deletions
7
zokrates_cli/examples/compile_errors/const_complex_type_mismatch.zok
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const u32 ONE = 1 | ||
const u32 TWO = 2 | ||
const field[ONE] ONE_FIELD = [1; TWO] // actually set the value to an array of 2 elements | ||
|
||
def main(field[TWO] TWO_FIELDS): | ||
assert(TWO_FIELDS == ONE_FIELD) // use the value as is | ||
return |
6 changes: 6 additions & 0 deletions
6
zokrates_cli/examples/compile_errors/constant_reduction_fail.zok
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from "EMBED" import bit_array_le | ||
|
||
const bool CONST = bit_array_le([true], [true]) | ||
|
||
def main() -> bool: | ||
return CONST |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
def main(field input) -> field: | ||
field divisor = if [input, 0] != [input, 1] then 0 else 1 fi | ||
return input / divisor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
def main(field a, field b) -> field: | ||
field[10] arr = [0; 10] | ||
u32 index = if [a, 1] != [b, 0] then 1000 else 0 fi | ||
return arr[index] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
def foo(field[1] a) -> field[1]: | ||
return a | ||
|
||
def main(field a): | ||
field[1] h = foo([a]) | ||
field f = h[1] | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
def foo(field[1] a) -> field[1]: | ||
return a | ||
|
||
def main(field a): | ||
field[1] h = foo([a]) | ||
h[1] = 1 | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
def main(private field a) -> field: | ||
return 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
def constant() -> u32: | ||
u32 res = 0 | ||
u32 x = 3 | ||
for u32 y in 0..x do | ||
res = res + 1 | ||
endfor | ||
return res | ||
|
||
const u32 CONSTANT = 1 + constant() | ||
|
||
const u32 OTHER_CONSTANT = 42 | ||
|
||
def main(field[CONSTANT] a) -> u32: | ||
return CONSTANT + OTHER_CONSTANT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
def func<N>() -> bool: | ||
for u32 i in 0..N do | ||
endfor | ||
|
||
u64[N] y = [...[0; N-1], 1] // the rhs should *not* be reduced to [1] because the spread is not empty | ||
u64 q = 0 | ||
|
||
for u32 i in 0..N do | ||
q = y[i] | ||
endfor | ||
|
||
return true | ||
|
||
def main(): | ||
assert(func::<2>()) | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
struct SomeStruct<N> { | ||
u64[N] f | ||
} | ||
|
||
def myFct<N, N2, N3>(SomeStruct<N> ignored) -> u32[N2]: | ||
assert(2*N == N2) | ||
return [N3; N2] | ||
|
||
const u32 N = 3 | ||
|
||
const u32 N2 = 2*N | ||
|
||
def main(SomeStruct<N> arg) -> u32: | ||
u32[N2] someVariable = myFct::<_, _, 42>(arg) | ||
return someVariable[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.