From f290de2b58e4ead8de4b4b469d434f0e14fa5da1 Mon Sep 17 00:00:00 2001 From: schaeff Date: Fri, 9 Apr 2021 15:09:34 +0200 Subject: [PATCH 1/7] bump version, generate changelog --- Cargo.lock | 18 +++++++++--------- asserts.zok | 7 ------- changelogs/unreleased/695-schaeff | 1 - changelogs/unreleased/751-dark64 | 1 - changelogs/unreleased/754-schaeff | 1 - changelogs/unreleased/762-schaeff | 1 - changelogs/unreleased/772-dark64 | 1 - changelogs/unreleased/783-schaeff | 1 - changelogs/unreleased/801-dark64 | 1 - example.zok | 11 ----------- zokrates_abi/Cargo.toml | 6 +++--- zokrates_cli/Cargo.toml | 6 +++--- zokrates_core/Cargo.toml | 8 ++++---- zokrates_core_test/Cargo.toml | 2 +- zokrates_embed/Cargo.toml | 2 +- zokrates_field/Cargo.toml | 2 +- zokrates_js/Cargo.toml | 2 +- zokrates_js/package.json | 2 +- zokrates_parser/Cargo.toml | 2 +- zokrates_pest_ast/Cargo.toml | 4 ++-- zokrates_stdlib/Cargo.toml | 2 +- zokrates_test/Cargo.toml | 4 ++-- 22 files changed, 30 insertions(+), 55 deletions(-) delete mode 100644 asserts.zok delete mode 100644 changelogs/unreleased/695-schaeff delete mode 100644 changelogs/unreleased/751-dark64 delete mode 100644 changelogs/unreleased/754-schaeff delete mode 100644 changelogs/unreleased/762-schaeff delete mode 100644 changelogs/unreleased/772-dark64 delete mode 100644 changelogs/unreleased/783-schaeff delete mode 100644 changelogs/unreleased/801-dark64 delete mode 100644 example.zok diff --git a/Cargo.lock b/Cargo.lock index 1e7b1891..44f43a5a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2258,7 +2258,7 @@ dependencies = [ [[package]] name = "zokrates_abi" -version = "0.1.3" +version = "0.1.4" dependencies = [ "serde", "serde_derive", @@ -2269,7 +2269,7 @@ dependencies = [ [[package]] name = "zokrates_cli" -version = "0.6.4" +version = "0.7.0" dependencies = [ "assert_cli", "bincode", @@ -2294,7 +2294,7 @@ version = "0.1.0" [[package]] name = "zokrates_core" -version = "0.5.4" +version = "0.6.0" dependencies = [ "ark-bls12-377", "ark-bn254", @@ -2335,7 +2335,7 @@ dependencies = [ [[package]] name = "zokrates_core_test" -version = "0.1.5" +version = "0.2.0" dependencies = [ "zokrates_test", "zokrates_test_derive", @@ -2343,7 +2343,7 @@ dependencies = [ [[package]] name = "zokrates_embed" -version = "0.1.1" +version = "0.1.2" dependencies = [ "bellman_ce", "sapling-crypto_ce", @@ -2351,7 +2351,7 @@ dependencies = [ [[package]] name = "zokrates_field" -version = "0.3.8" +version = "0.4.0" dependencies = [ "ark-bls12-377", "ark-bn254", @@ -2381,7 +2381,7 @@ dependencies = [ [[package]] name = "zokrates_parser" -version = "0.1.6" +version = "0.2.0" dependencies = [ "glob 0.2.11", "pest", @@ -2390,7 +2390,7 @@ dependencies = [ [[package]] name = "zokrates_pest_ast" -version = "0.1.5" +version = "0.2.0" dependencies = [ "from-pest", "glob 0.2.11", @@ -2402,7 +2402,7 @@ dependencies = [ [[package]] name = "zokrates_stdlib" -version = "0.1.8" +version = "0.2.0" dependencies = [ "fs_extra", "zokrates_test", diff --git a/asserts.zok b/asserts.zok deleted file mode 100644 index 2a2f1751..00000000 --- a/asserts.zok +++ /dev/null @@ -1,7 +0,0 @@ -def id() -> u32: - return N - -def main(): - assert(id::<5>() == 5) - assert(id::<6>() == 6) - return \ No newline at end of file diff --git a/changelogs/unreleased/695-schaeff b/changelogs/unreleased/695-schaeff deleted file mode 100644 index 539b5391..00000000 --- a/changelogs/unreleased/695-schaeff +++ /dev/null @@ -1 +0,0 @@ -Introduce constant generics for `u32` values. Introduce literal inference \ No newline at end of file diff --git a/changelogs/unreleased/751-dark64 b/changelogs/unreleased/751-dark64 deleted file mode 100644 index a65f3e9a..00000000 --- a/changelogs/unreleased/751-dark64 +++ /dev/null @@ -1 +0,0 @@ -Add global `--verbose` flag to CLI for verbose logging, add `--ztf` flag to `compile` command, deprecate `--light` flag as its behaviour is now a default. \ No newline at end of file diff --git a/changelogs/unreleased/754-schaeff b/changelogs/unreleased/754-schaeff deleted file mode 100644 index ef7829ae..00000000 --- a/changelogs/unreleased/754-schaeff +++ /dev/null @@ -1 +0,0 @@ -Make embed functions generic, enabling unpacking to any width at minimal cost \ No newline at end of file diff --git a/changelogs/unreleased/762-schaeff b/changelogs/unreleased/762-schaeff deleted file mode 100644 index eb62bfeb..00000000 --- a/changelogs/unreleased/762-schaeff +++ /dev/null @@ -1 +0,0 @@ -Add negative `-` and positive `+` unary operators, restricting accepted expressions in some places (exponent) to allow for better parsing \ No newline at end of file diff --git a/changelogs/unreleased/772-dark64 b/changelogs/unreleased/772-dark64 deleted file mode 100644 index 31cb80ac..00000000 --- a/changelogs/unreleased/772-dark64 +++ /dev/null @@ -1 +0,0 @@ -Introduce u64 type, add keccak{256,384,512} and sha3{256,384,512} hash functions to stdlib \ No newline at end of file diff --git a/changelogs/unreleased/783-schaeff b/changelogs/unreleased/783-schaeff deleted file mode 100644 index c3b2d110..00000000 --- a/changelogs/unreleased/783-schaeff +++ /dev/null @@ -1 +0,0 @@ -Change left `<<` and right `>>` shifts to take `u32` as a second parameter \ No newline at end of file diff --git a/changelogs/unreleased/801-dark64 b/changelogs/unreleased/801-dark64 deleted file mode 100644 index c914c7a7..00000000 --- a/changelogs/unreleased/801-dark64 +++ /dev/null @@ -1 +0,0 @@ -Re-export embed functions as stdlib modules, add field to uint casts to stdlib \ No newline at end of file diff --git a/example.zok b/example.zok deleted file mode 100644 index be818e32..00000000 --- a/example.zok +++ /dev/null @@ -1,11 +0,0 @@ -def foo(field[N] x) -> field[N]: - return x - -def bar(field[N] x) -> field[N]: - field[N] r = x - return r - -def main(field[3] x) -> field[2]: - field[2] z = foo(x)[0..2] - - return bar(z) \ No newline at end of file diff --git a/zokrates_abi/Cargo.toml b/zokrates_abi/Cargo.toml index f3d9e75e..0813a144 100644 --- a/zokrates_abi/Cargo.toml +++ b/zokrates_abi/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "zokrates_abi" -version = "0.1.3" +version = "0.1.4" authors = ["Thibaut Schaeffer "] edition = "2018" [dependencies] -zokrates_field = { version = "0.3", path = "../zokrates_field", default-features = false } -zokrates_core = { version = "0.5", path = "../zokrates_core", default-features = false } +zokrates_field = { version = "0.4", path = "../zokrates_field", default-features = false } +zokrates_core = { version = "0.6", path = "../zokrates_core", default-features = false } serde = "1.0" serde_derive = "1.0" serde_json = "1.0" \ No newline at end of file diff --git a/zokrates_cli/Cargo.toml b/zokrates_cli/Cargo.toml index eba1f77d..d4344c91 100644 --- a/zokrates_cli/Cargo.toml +++ b/zokrates_cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zokrates_cli" -version = "0.6.4" +version = "0.7.0" authors = ["Jacob Eberhardt ", "Dennis Kuhnert ", "Thibaut Schaeffer "] repository = "https://github.com/JacobEberhardt/ZoKrates.git" edition = "2018" @@ -16,9 +16,9 @@ cfg-if = "0.1" clap = "2.26.2" bincode = "0.8.0" regex = "0.2" -zokrates_field = { version = "0.3", path = "../zokrates_field", default-features = false } +zokrates_field = { version = "0.4", path = "../zokrates_field", default-features = false } zokrates_abi = { version = "0.1", path = "../zokrates_abi" } -zokrates_core = { version = "0.5", path = "../zokrates_core", default-features = false } +zokrates_core = { version = "0.6", path = "../zokrates_core", default-features = false } zokrates_fs_resolver = { version = "0.5", path = "../zokrates_fs_resolver"} serde_json = "1.0" dirs = "3.0.1" diff --git a/zokrates_core/Cargo.toml b/zokrates_core/Cargo.toml index 3d747bf3..cbff9f5a 100644 --- a/zokrates_core/Cargo.toml +++ b/zokrates_core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zokrates_core" -version = "0.5.4" +version = "0.6.0" edition = "2018" authors = ["Jacob Eberhardt ", "Dennis Kuhnert "] repository = "https://github.com/JacobEberhardt/ZoKrates" @@ -28,10 +28,10 @@ serde_json = "1.0" bincode = "0.8.0" hex = "0.4.2" regex = "0.2" -zokrates_field = { version = "0.3.0", path = "../zokrates_field", default-features = false } -zokrates_pest_ast = { version = "0.1.0", path = "../zokrates_pest_ast" } +zokrates_field = { version = "0.4.0", path = "../zokrates_field", default-features = false } +zokrates_pest_ast = { version = "0.2.0", path = "../zokrates_pest_ast" } zokrates_common = { path = "../zokrates_common" } -zokrates_embed = { path = "../zokrates_embed" } +zokrates_embed = { version = "0.1.0", path = "../zokrates_embed" } getrandom = { version = "0.2", features = ["js"] } rand_0_4 = { version = "0.4", package = "rand" } rand_0_7 = { version = "0.7", package = "rand" } diff --git a/zokrates_core_test/Cargo.toml b/zokrates_core_test/Cargo.toml index c8db7078..e0dbcfc1 100644 --- a/zokrates_core_test/Cargo.toml +++ b/zokrates_core_test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zokrates_core_test" -version = "0.1.5" +version = "0.2.0" authors = ["schaeff "] edition = "2018" diff --git a/zokrates_embed/Cargo.toml b/zokrates_embed/Cargo.toml index 90e9cccb..6135df31 100644 --- a/zokrates_embed/Cargo.toml +++ b/zokrates_embed/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zokrates_embed" -version = "0.1.1" +version = "0.1.2" authors = ["schaeff "] edition = "2018" diff --git a/zokrates_field/Cargo.toml b/zokrates_field/Cargo.toml index 44ff7061..cea2f9ec 100644 --- a/zokrates_field/Cargo.toml +++ b/zokrates_field/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zokrates_field" -version = "0.3.8" +version = "0.4.0" authors = ["Thibaut Schaeffer ", "Guillaume Ballet "] edition = "2018" diff --git a/zokrates_js/Cargo.toml b/zokrates_js/Cargo.toml index 8add49d4..bb2585a7 100644 --- a/zokrates_js/Cargo.toml +++ b/zokrates_js/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zokrates_js" -version = "1.0.28" +version = "1.0.29" authors = ["Darko Macesic"] edition = "2018" diff --git a/zokrates_js/package.json b/zokrates_js/package.json index 6765f16f..294ccf46 100644 --- a/zokrates_js/package.json +++ b/zokrates_js/package.json @@ -2,7 +2,7 @@ "name": "zokrates-js", "main": "index.js", "author": "Darko Macesic ", - "version": "1.0.28", + "version": "1.0.29", "keywords": [ "zokrates", "wasm-bindgen", diff --git a/zokrates_parser/Cargo.toml b/zokrates_parser/Cargo.toml index cc77f702..df7b876d 100644 --- a/zokrates_parser/Cargo.toml +++ b/zokrates_parser/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zokrates_parser" -version = "0.1.6" +version = "0.2.0" authors = ["JacobEberhardt "] edition = "2018" diff --git a/zokrates_pest_ast/Cargo.toml b/zokrates_pest_ast/Cargo.toml index d9f2dddd..3cbe56e7 100644 --- a/zokrates_pest_ast/Cargo.toml +++ b/zokrates_pest_ast/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "zokrates_pest_ast" -version = "0.1.5" +version = "0.2.0" authors = ["schaeff "] edition = "2018" [dependencies] -zokrates_parser = { version = "0.1.0", path = "../zokrates_parser" } +zokrates_parser = { version = "0.2.0", path = "../zokrates_parser" } pest = "2.0" pest-ast = "0.3.3" from-pest = "0.3.1" diff --git a/zokrates_stdlib/Cargo.toml b/zokrates_stdlib/Cargo.toml index 3aa0ac99..84264cb4 100644 --- a/zokrates_stdlib/Cargo.toml +++ b/zokrates_stdlib/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zokrates_stdlib" -version = "0.1.8" +version = "0.2.0" authors = ["Stefan Deml ", "schaeff "] edition = "2018" diff --git a/zokrates_test/Cargo.toml b/zokrates_test/Cargo.toml index ef9ea39a..f14507e2 100644 --- a/zokrates_test/Cargo.toml +++ b/zokrates_test/Cargo.toml @@ -5,8 +5,8 @@ authors = ["schaeff "] edition = "2018" [dependencies] -zokrates_field = { version = "0.3", path = "../zokrates_field" } -zokrates_core = { version = "0.5", path = "../zokrates_core" } +zokrates_field = { version = "0.4", path = "../zokrates_field" } +zokrates_core = { version = "0.6", path = "../zokrates_core" } zokrates_fs_resolver = { version = "0.5", path = "../zokrates_fs_resolver" } serde = "1.0" serde_derive = "1.0" From 59b6befc368673de7494d6eb3021a150a1bcac4d Mon Sep 17 00:00:00 2001 From: schaeff Date: Fri, 9 Apr 2021 15:47:04 +0200 Subject: [PATCH 2/7] replace master with deploy --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 54333de9..20fc36bd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -67,7 +67,7 @@ branches: only: # release tags - /^\d+\.\d+\.\d+.*$/ - - master + - deploy notifications: email: From 34c0c9a12172f3eee164beb4ee16f89ca7e41130 Mon Sep 17 00:00:00 2001 From: schaeff Date: Fri, 9 Apr 2021 16:53:46 +0200 Subject: [PATCH 3/7] trigger build --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 20fc36bd..0d3be6e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ sudo: required env: global: - CRATE_NAME=zokrates + matrix: include: From 68df35bf17151319543e662156d14a1eee993cc3 Mon Sep 17 00:00:00 2001 From: schaeff Date: Mon, 12 Apr 2021 16:05:10 +0200 Subject: [PATCH 4/7] add changelog --- CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5015c98..c82363d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file. ## [Unreleased] https://github.com/Zokrates/ZoKrates/compare/latest...develop +## [0.7.0] - 2021-04-09 + +### Release +- https://github.com/Zokrates/ZoKrates/releases/tag/0.7.0 + +### Changes +- Re-export embed functions as stdlib modules, add field to uint casts to stdlib (#801, @dark64) +- Change left `<<` and right `>>` shifts to take `u32` as a second parameter (#783, @schaeff) +- Introduce u64 type, add keccak{256,384,512} and sha3{256,384,512} hash functions to stdlib (#772, @dark64) +- Add negative `-` and positive `+` unary operators, restricting accepted expressions in some places (exponent) to allow for better parsing (#762, @schaeff) +- Make embed functions generic, enabling unpacking to any width at minimal cost (#754, @schaeff) +- Add global `--verbose` flag to CLI for verbose logging, add `--ztf` flag to `compile` command, deprecate `--light` flag as its behaviour is now a default. (#751, @dark64) +- Introduce constant generics for `u32` values. Introduce literal inference (#695, @schaeff) + ## [0.6.4] - 2021-03-19 ### Release - https://github.com/Zokrates/ZoKrates/releases/tag/0.6.4 From dae95c99d2a53331a2a6bc78185ded16fb4d0fe7 Mon Sep 17 00:00:00 2001 From: schaeff Date: Tue, 13 Apr 2021 15:50:52 +0200 Subject: [PATCH 5/7] make sure libsnark is activated in cross compilation and scripts --- build.sh | 6 +++++- ci/before_deploy.sh | 9 ++++++++- full_test.sh | 6 +++++- test.sh | 6 +++++- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index f5d1d997..033e5189 100755 --- a/build.sh +++ b/build.sh @@ -3,4 +3,8 @@ # Exit if any subcommand fails set -e -cargo build +if [ -n "$WITH_LIBSNARK" ]; then + cargo -Z package-features build --package zokrates_cli --features="libsnark" +else + cargo build +fi \ No newline at end of file diff --git a/ci/before_deploy.sh b/ci/before_deploy.sh index 4cfd421c..7dc2dff6 100755 --- a/ci/before_deploy.sh +++ b/ci/before_deploy.sh @@ -28,7 +28,14 @@ main() { test -f Cargo.lock || cargo generate-lockfile - cross build --bin zokrates --target $TARGET --release + case $TRAVIS_OS_NAME in + linux) + cross build --bin zokrates --package zokrates_cli --features="libsnark" --target $TARGET --release + ;; + *) + cross build --bin zokrates --package zokrates_cli --target $TARGET --release + ;; + esac # Package artifacts # Binary diff --git a/full_test.sh b/full_test.sh index afbbc09a..8d8bf032 100755 --- a/full_test.sh +++ b/full_test.sh @@ -3,4 +3,8 @@ # Exit if any subcommand fails set -e -cargo test --release -- --ignored --test-threads=1 +if [ -n "$WITH_LIBSNARK" ]; then + cargo -Z package-features test --release --package zokrates_cli --features="libsnark" -- --ignored --test-threads=1 +else + cargo test --release -- --ignored --test-threads=1 +fi \ No newline at end of file diff --git a/test.sh b/test.sh index 43945977..3a909dd6 100755 --- a/test.sh +++ b/test.sh @@ -3,4 +3,8 @@ # Exit if any subcommand fails set -e -cargo test --release -- --test-threads=1 +if [ -n "$WITH_LIBSNARK" ]; then + cargo -Z package-features test --release --package zokrates_cli --features="libsnark" -- --test-threads=1 +else + cargo test --release -- --test-threads=1 +fi From 4c73b7cc70ebd116c21ae613ff298f0f1751b26a Mon Sep 17 00:00:00 2001 From: schaeff Date: Tue, 13 Apr 2021 15:56:22 +0200 Subject: [PATCH 6/7] actually fix the libsnark compile error --- zokrates_core/src/proof_system/libsnark/mod.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/zokrates_core/src/proof_system/libsnark/mod.rs b/zokrates_core/src/proof_system/libsnark/mod.rs index 10dba493..fe81a285 100644 --- a/zokrates_core/src/proof_system/libsnark/mod.rs +++ b/zokrates_core/src/proof_system/libsnark/mod.rs @@ -25,7 +25,7 @@ pub fn prepare_public_inputs(public_inputs: Vec) -> (Vec<[u8; 32]>, let mut public_inputs_arr: Vec<[u8; 32]> = vec![[0u8; 32]; public_inputs_length]; for (index, value) in public_inputs.into_iter().enumerate() { - public_inputs_arr[index] = vec_as_u8_32_array(&value.into_byte_vector()); + public_inputs_arr[index] = vec_as_u8_32_array(&value.to_byte_vector()); } (public_inputs_arr, public_inputs_length) @@ -62,21 +62,21 @@ pub fn prepare_setup( a_vec.push(( row as i32, idx as i32, - vec_as_u8_32_array(&val.into_byte_vector()), + vec_as_u8_32_array(&val.to_byte_vector()), )); } for &(idx, ref val) in &b[row] { b_vec.push(( row as i32, idx as i32, - vec_as_u8_32_array(&val.into_byte_vector()), + vec_as_u8_32_array(&val.to_byte_vector()), )); } for &(idx, ref val) in &c[row] { c_vec.push(( row as i32, idx as i32, - vec_as_u8_32_array(&val.into_byte_vector()), + vec_as_u8_32_array(&val.to_byte_vector()), )); } } @@ -177,10 +177,10 @@ pub fn prepare_generate_proof( //convert inputs for (index, value) in public_inputs.into_iter().enumerate() { - public_inputs_arr[index] = vec_as_u8_32_array(&value.into_byte_vector()); + public_inputs_arr[index] = vec_as_u8_32_array(&value.to_byte_vector()); } for (index, value) in private_inputs.into_iter().enumerate() { - private_inputs_arr[index] = vec_as_u8_32_array(&value.into_byte_vector()); + private_inputs_arr[index] = vec_as_u8_32_array(&value.to_byte_vector()); } ( From 07e27d0d242cfd2cc3de0136661e30eb4650adac Mon Sep 17 00:00:00 2001 From: schaeff Date: Tue, 13 Apr 2021 16:11:54 +0200 Subject: [PATCH 7/7] remove no input test --- zokrates_cli/tests/code/no_public.arguments.json | 1 - zokrates_cli/tests/code/no_public.expected.witness | 0 zokrates_cli/tests/code/no_public.zok | 2 -- 3 files changed, 3 deletions(-) delete mode 100644 zokrates_cli/tests/code/no_public.arguments.json delete mode 100644 zokrates_cli/tests/code/no_public.expected.witness delete mode 100644 zokrates_cli/tests/code/no_public.zok diff --git a/zokrates_cli/tests/code/no_public.arguments.json b/zokrates_cli/tests/code/no_public.arguments.json deleted file mode 100644 index 0637a088..00000000 --- a/zokrates_cli/tests/code/no_public.arguments.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/zokrates_cli/tests/code/no_public.expected.witness b/zokrates_cli/tests/code/no_public.expected.witness deleted file mode 100644 index e69de29b..00000000 diff --git a/zokrates_cli/tests/code/no_public.zok b/zokrates_cli/tests/code/no_public.zok deleted file mode 100644 index 90b2476b..00000000 --- a/zokrates_cli/tests/code/no_public.zok +++ /dev/null @@ -1,2 +0,0 @@ -def main(): - return \ No newline at end of file