1
0
Fork 0
mirror of synced 2025-09-23 20:28:36 +00:00

merge dev, fix flags

This commit is contained in:
schaeff 2019-10-25 13:13:14 +02:00
commit 400a2205f3
42 changed files with 973 additions and 328 deletions

View file

@ -42,9 +42,9 @@ jobs:
- restore_cache:
keys:
- v4-cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
- run:
name: Check format
command: rustup component add rustfmt; cargo fmt --all -- --check
# - run:
# name: Check format
# command: rustup component add rustfmt; cargo fmt --all -- --check
- run:
name: Install libsnark prerequisites
command: ./scripts/install_libsnark_prerequisites.sh

View file

@ -27,7 +27,7 @@ matrix:
os: osx
# *BSD
- env: TARGET=x86_64-unknown-freebsd
# - env: TARGET=x86_64-unknown-freebsd
# Windows
- env: TARGET=x86_64-pc-windows-gnu

322
Cargo.lock generated
View file

@ -15,10 +15,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "arrayvec"
version = "0.4.11"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
"nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -30,33 +30,33 @@ dependencies = [
"difference 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"environment 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)",
"skeptic 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "autocfg"
version = "0.1.6"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "backtrace"
version = "0.3.38"
version = "0.3.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)",
"backtrace-sys 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "backtrace-sys"
version = "0.1.31"
version = "0.1.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -81,7 +81,7 @@ dependencies = [
"num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"pairing_ce 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"web-sys 0.3.28 (registry+https://github.com/rust-lang/crates.io-index)",
"web-sys 0.3.29 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -101,7 +101,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bitflags"
version = "1.2.0"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -109,7 +109,7 @@ name = "blake2-rfc_bellman_edition"
version = "0.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
"arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"constant_time_eq 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -166,11 +166,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "c2-chacha"
version = "0.2.2"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -182,12 +181,12 @@ dependencies = [
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cc"
version = "1.0.45"
version = "1.0.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"jobserver 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
@ -214,7 +213,7 @@ name = "cmake"
version = "0.1.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -266,7 +265,7 @@ name = "crossbeam-epoch"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
"arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -304,7 +303,7 @@ dependencies = [
"bstr 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"csv-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -318,13 +317,13 @@ dependencies = [
[[package]]
name = "curl-sys"
version = "0.4.22"
version = "0.4.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
"libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-sys 0.9.50 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-sys 0.9.52 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -366,7 +365,7 @@ name = "error-chain"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"backtrace 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)",
"backtrace 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -374,28 +373,28 @@ name = "error-chain"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"backtrace 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)",
"backtrace 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)",
"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "failure"
version = "0.1.5"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"backtrace 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"backtrace 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "failure_derive"
version = "0.1.5"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)",
"synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"synstructure 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -487,7 +486,7 @@ version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
"wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -496,12 +495,12 @@ name = "git2"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
"libgit2-sys 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-sys 0.9.50 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-sys 0.9.52 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -562,16 +561,16 @@ version = "0.1.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"getrandom 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "js-sys"
version = "0.3.28"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"wasm-bindgen 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen 0.2.52 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -581,7 +580,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "libc"
version = "0.2.62"
version = "0.2.65"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -589,24 +588,24 @@ name = "libgit2-sys"
version = "0.7.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)",
"curl-sys 0.4.22 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"libssh2-sys 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)",
"curl-sys 0.4.23 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
"libssh2-sys 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
"libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-sys 0.9.50 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-sys 0.9.52 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "libssh2-sys"
version = "0.2.12"
version = "0.2.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
"libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-sys 0.9.50 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-sys 0.9.52 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -616,8 +615,8 @@ name = "libz-sys"
version = "1.0.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -645,7 +644,7 @@ name = "memchr"
version = "2.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -663,7 +662,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "nodrop"
version = "0.1.13"
version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -699,7 +698,7 @@ name = "num-bigint"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
@ -710,7 +709,7 @@ name = "num-integer"
version = "0.1.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -719,7 +718,7 @@ name = "num-iter"
version = "0.1.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -737,7 +736,7 @@ name = "num-traits"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -745,7 +744,7 @@ name = "num_cpus"
version = "1.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -760,12 +759,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "openssl-sys"
version = "0.9.50"
version = "0.9.52"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -837,7 +836,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"pest 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"pest_meta 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -859,7 +858,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "ppv-lite86"
version = "0.2.5"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -872,7 +871,7 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.4"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -883,7 +882,7 @@ name = "pulldown-cmark"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -899,7 +898,7 @@ name = "quote"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -907,7 +906,7 @@ name = "rand"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -917,7 +916,7 @@ version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -929,7 +928,7 @@ version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"getrandom 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -940,7 +939,7 @@ name = "rand_chacha"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1040,7 +1039,7 @@ dependencies = [
"base64 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)",
"hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1065,7 +1064,7 @@ dependencies = [
[[package]]
name = "ryu"
version = "1.0.0"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -1079,7 +1078,7 @@ dependencies = [
[[package]]
name = "sapling-crypto_ce"
version = "0.1.0"
source = "git+https://github.com/dark64/sapling-crypto#2aa4c68f2b4415eb608178bb2230e5c5d687aef4"
source = "git+https://github.com/dark64/sapling-crypto#18c221a6ea5473c37af3eaa551596c1132e6b192"
dependencies = [
"bellman_ce 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"blake2-rfc_bellman_edition 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1129,18 +1128,18 @@ name = "serde_derive"
version = "1.0.101"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "serde_json"
version = "1.0.40"
version = "1.0.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1160,7 +1159,7 @@ name = "single"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1173,7 +1172,7 @@ dependencies = [
"error-chain 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"pulldown-cmark 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)",
"tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1213,20 +1212,20 @@ name = "syn"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "synstructure"
version = "0.10.2"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1244,7 +1243,7 @@ version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
"remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1264,7 +1263,7 @@ name = "time"
version = "0.1.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1375,65 +1374,65 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "wasm-bindgen"
version = "0.2.51"
version = "0.2.52"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-macro 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-macro 0.2.52 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.51"
version = "0.2.52"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bumpalo 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-shared 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-shared 0.2.52 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.51"
version = "0.2.52"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-macro-support 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-macro-support 0.2.52 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.51"
version = "0.2.52"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-backend 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-shared 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-backend 0.2.52 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-shared 0.2.52 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.51"
version = "0.2.52"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "wasm-bindgen-webidl"
version = "0.2.51"
version = "0.2.52"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-backend 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-backend 0.2.52 (registry+https://github.com/rust-lang/crates.io-index)",
"weedle 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1457,14 +1456,14 @@ dependencies = [
[[package]]
name = "web-sys"
version = "0.3.28"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"js-sys 0.3.28 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"js-sys 0.3.29 (registry+https://github.com/rust-lang/crates.io-index)",
"sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-webidl 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen 0.2.52 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-webidl 0.2.52 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1513,21 +1512,32 @@ dependencies = [
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "zokrates_abi"
version = "0.1.0"
dependencies = [
"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)",
"zokrates_core 0.4.0",
"zokrates_field 0.3.4",
]
[[package]]
name = "zokrates_core"
version = "0.3.14"
version = "0.4.0"
dependencies = [
"assert_cli 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
"bellman_ce 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"bincode 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)",
"cmake 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
"csv 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ff_ce 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"git2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
"num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
"num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)",
"pairing_ce 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1539,12 +1549,12 @@ dependencies = [
"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_bytes 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)",
"typed-arena 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmi 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"zokrates_embed 0.1.0",
"zokrates_field 0.3.3",
"zokrates_pest_ast 0.1.2",
"zokrates_field 0.3.4",
"zokrates_pest_ast 0.1.3",
]
[[package]]
@ -1565,7 +1575,7 @@ dependencies = [
[[package]]
name = "zokrates_field"
version = "0.3.3"
version = "0.3.4"
dependencies = [
"bincode 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ff_ce 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1577,19 +1587,19 @@ dependencies = [
"rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "zokrates_fs_resolver"
version = "0.4.1"
version = "0.4.2"
dependencies = [
"tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "zokrates_parser"
version = "0.1.2"
version = "0.1.3"
dependencies = [
"glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"pest 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1598,20 +1608,20 @@ dependencies = [
[[package]]
name = "zokrates_pest_ast"
version = "0.1.2"
version = "0.1.3"
dependencies = [
"from-pest 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pest 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"pest-ast 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"zokrates_field 0.3.3",
"zokrates_parser 0.1.2",
"zokrates_field 0.3.4",
"zokrates_parser 0.1.3",
]
[[package]]
name = "zokrates_stdlib"
version = "0.1.3"
version = "0.1.4"
dependencies = [
"fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"zokrates_test 0.1.0",
@ -1625,25 +1635,25 @@ dependencies = [
"glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
"zokrates_core 0.3.14",
"zokrates_field 0.3.3",
"zokrates_fs_resolver 0.4.1",
"serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)",
"zokrates_core 0.4.0",
"zokrates_field 0.3.4",
"zokrates_fs_resolver 0.4.2",
]
[metadata]
"checksum aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "81ce3d38065e618af2d7b77e10c5ad9a069859b4be3c2250f674af3840d9c8a5"
"checksum approx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08abcc3b4e9339e33a3d0a5ed15d84a687350c05689d825e0f6655eef9e76a94"
"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba"
"checksum arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9"
"checksum assert_cli 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "72342c21057a3cb5f7c2d849bf7999a83795434dd36d74fa8c24680581bd1930"
"checksum autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875"
"checksum backtrace 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)" = "690a62be8920ccf773ee00ef0968649b0e724cda8bd5b12286302b4ae955fdf5"
"checksum backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "82a830b4ef2d1124a711c71d263c5abdc710ef8e907bd508c88be475cebc422b"
"checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"
"checksum backtrace 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)" = "924c76597f0d9ca25d762c25a4d369d51267536465dc5064bdf0eb073ed477ea"
"checksum backtrace-sys 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6575f128516de27e3ce99689419835fce9643a9b215a14d2b5b685be018491"
"checksum base64 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "30e93c03064e7590d0466209155251b90c22e37fab1daf2771582598b5827557"
"checksum bellman_ce 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "938ec0feff00f9dfda0e7cbfe8db8b717966a84f6a12e63ed0943c4a90d6a5de"
"checksum bincode 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e103c8b299b28a9c6990458b7013dc4a8356a9b854c51b9883241f5866fac36e"
"checksum bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "02b4ff8b16e6076c3e14220b39fbc1fabb6737522281a388998046859400895f"
"checksum bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8a606a02debe2813760609f57a64a2ffd27d9fdf5b2f133eaca0b248dd92cdd2"
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
"checksum blake2-rfc_bellman_edition 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fdc60350286c7c3db13b98e91dbe5c8b6830a6821bc20af5b0c310ce94d74915"
"checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b"
"checksum block-padding 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6d4dc3af3ee2e12f3e5d224e5e1e3d73668abbeb69e566d361f7d5563a4fdf09"
@ -1652,9 +1662,9 @@ dependencies = [
"checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7"
"checksum bytecount 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b92204551573580e078dc80017f36a213eb77a0450e4ddd8cfa0f3f2d1f0178f"
"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"
"checksum c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7d64d04786e0f528460fc884753cf8dddcc466be308f6026f8e355c41a0e4101"
"checksum c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb"
"checksum cargo_metadata 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e5d1b4d380e1bab994591a24c2bdd1b054f64b60bef483a8c598c7c345bc3bbe"
"checksum cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)" = "4fc9a35e1f4290eb9e5fc54ba6cf40671ed2a2514c3eeb2b2a908dda2ea5a1be"
"checksum cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)" = "0213d356d3c4ea2c18c40b037c3be23cd639825c18f25ee670ac7813beeef99c"
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
"checksum cgmath 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)" = "64a4b57c8f4e3a2e9ac07e0f6abc9c24b6fc9e1b54c3478cfb598f3d0023e51c"
"checksum cmake 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "81fb25b677f8bf1eb325017cb6bb8452f87969db0fedb4f757b297bee78a7c62"
@ -1669,7 +1679,7 @@ dependencies = [
"checksum crunchy 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
"checksum csv 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "37519ccdfd73a75821cac9319d4fce15a81b9fcf75f951df5b9988aa3a0af87d"
"checksum csv-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9b5cadb6b25c77aeff80ba701712494213f4a8418fcda2ee11b6560c3ad0bf4c"
"checksum curl-sys 0.4.22 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9a9a4e417722876332136a00cacf92c2ceb331fab4b52b6a1ad16c6cd79255"
"checksum curl-sys 0.4.23 (registry+https://github.com/rust-lang/crates.io-index)" = "f71cd2dbddb49c744c1c9e0b96106f50a634e8759ec51bcd5399a578700a3ab3"
"checksum difference 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b3304d19798a8e067e48d8e69b2c37f0b5e9b4e462504ad9e27e9f3fce02bba8"
"checksum digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "03b072242a8cbaf9c145665af9d250c59af3b958f83ed6824e13533cf76d5b90"
"checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5"
@ -1677,8 +1687,8 @@ dependencies = [
"checksum environment 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1f4b14e20978669064c33b4c1e0fb4083412e40fe56cbea2eae80fd7591503ee"
"checksum error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3"
"checksum error-chain 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3ab49e9dcb602294bc42f9a7dfc9bc6e936fca4418ea300dbfb84fe16de0b7d9"
"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2"
"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1"
"checksum failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f8273f13c977665c5db7eb2b99ae520952fe5ac831ae4cd09d80c4c7042b5ed9"
"checksum failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0bc225b78e0391e4b8683440bf2e63c2deeeb2ce5189eab46e2b68c6d3725d08"
"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
"checksum ff_ce 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "18af1ea1b80a4b474fae13af4c58cf0a5a2bc33832d5fa70f68a4b286178fdb5"
"checksum ff_derive_ce 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1d245b4e76c5b36bb7721ea15b7fbc61bebf0c5d2890eaf49fe1e2a3eed36db9"
@ -1701,11 +1711,11 @@ dependencies = [
"checksum itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0d47946d458e94a1b7bcabbf6521ea7c037062c81f534615abcad76e84d4970d"
"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f"
"checksum jobserver 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b1d42ef453b30b7387e113da1c83ab1605d90c5b4e0eb8e96d016ed3b8c160"
"checksum js-sys 0.3.28 (registry+https://github.com/rust-lang/crates.io-index)" = "2cc9a97d7cec30128fd8b28a7c1f9df1c001ceb9b441e2b755e24130a6b43c79"
"checksum js-sys 0.3.29 (registry+https://github.com/rust-lang/crates.io-index)" = "5061eb59a5afd4f6ff96dc565963e4e2737b915d070233cb26b88e3f58af41b4"
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
"checksum libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba"
"checksum libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "1a31a0627fdf1f6a39ec0dd577e101440b7db22672c0901fe00a9a6fbb5c24e8"
"checksum libgit2-sys 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)" = "48441cb35dc255da8ae72825689a95368bf510659ae1ad55dc4aa88cb1789bf1"
"checksum libssh2-sys 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "8914d10b159fc288f2b6f253c94bd0c15a777fd5a297691141d89674b87e66fd"
"checksum libssh2-sys 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "5fcd5a428a31cbbfe059812d74f4b6cd3b9b7426c2bdaec56993c5365da1c328"
"checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe"
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
"checksum maplit 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
@ -1713,7 +1723,7 @@ dependencies = [
"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
"checksum memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ce6075db033bbbb7ee5a0bbd3a3186bbae616f57fb001c485c7ff77955f8177f"
"checksum memory_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882"
"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945"
"checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb"
"checksum nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6"
"checksum num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "4703ad64153382334aa8db57c637364c322d3372e097840c72000dabdcf6156e"
"checksum num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "e63899ad0da84ce718c14936262a41cee2c79c981fc0a0e7c7beb47d5a07e8c1"
@ -1725,7 +1735,7 @@ dependencies = [
"checksum num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273"
"checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
"checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
"checksum openssl-sys 0.9.50 (registry+https://github.com/rust-lang/crates.io-index)" = "2c42dcccb832556b5926bc9ae61e8775f2a61e725ab07ab3d1e7fcf8ae62c3b6"
"checksum openssl-sys 0.9.52 (registry+https://github.com/rust-lang/crates.io-index)" = "c977d08e1312e2f7e4b86f9ebaa0ed3b19d1daff75fae88bbb88108afbd801fc"
"checksum pairing_ce 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f075a9c570e2026111cb6dddf6a320e5163c42aa32500b315ec34acbcf7c9b36"
"checksum parity-wasm 0.31.3 (registry+https://github.com/rust-lang/crates.io-index)" = "511379a8194230c2395d2f5fa627a5a7e108a9f976656ce723ae68fca4097bfc"
"checksum parity-wasm 0.35.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3e1e076c4e01399b6cd0793a8df42f90bba3ae424671ef421d1608a943155d93"
@ -1736,9 +1746,9 @@ dependencies = [
"checksum pest_generator 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7b9fcf299b5712d06ee128a556c94709aaa04512c4dffb8ead07c5c998447fc0"
"checksum pest_meta 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "df43fd99896fd72c485fe47542c7b500e4ac1e8700bf995544d1317a60ded547"
"checksum pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "72d5370d90f49f70bd033c3d75e87fc529fbfff9d6f7cccef07d6170079d91ea"
"checksum ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e3cbf9f658cdb5000fcf6f362b8ea2ba154b9f146a61c7a20d647034c6b6561b"
"checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b"
"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
"checksum proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "afdc77cc74ec70ed262262942ebb7dac3d479e9e5cfa2da1841c0806f6cdabcc"
"checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27"
"checksum pulldown-cmark 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "eef52fac62d0ea7b9b4dc7da092aa64ea7ec3d90af6679422d3d7e0e14b6ee15"
"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
@ -1762,7 +1772,7 @@ dependencies = [
"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783"
"checksum rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0ceb8ce7a5e520de349e1fa172baeba4a9e8d5ef06c47471863530bc4972ee1e"
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
"checksum ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c92464b447c0ee8c4fb3824ecc8383b81717b9f1e74ba2e72540aef7b9f82997"
"checksum ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8"
"checksum same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421"
"checksum sapling-crypto_ce 0.1.0 (git+https://github.com/dark64/sapling-crypto)" = "<none>"
"checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d"
@ -1771,7 +1781,7 @@ dependencies = [
"checksum serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)" = "9796c9b7ba2ffe7a9ce53c2287dfc48080f4b2b362fcc245a259b3a7201119dd"
"checksum serde_bytes 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)" = "defbb8a83d7f34cc8380751eeb892b825944222888aff18996ea7901f24aec88"
"checksum serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)" = "4b133a43a1ecd55d4086bd5b4dc6c1751c68b1bfbeba7a5040442022c7e7c02e"
"checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704"
"checksum serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)" = "2f72eb2a68a7dc3f9a691bfda9305a1c017a6215e5a4545c258500d2099a37c2"
"checksum sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "23962131a91661d643c98940b20fcaffe62d776a823247be80a48fcb8b6fce68"
"checksum single 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bd5add732a1ab689845591a1b50339cf5310b563e08dc5813c65991f30369ea2"
"checksum skeptic 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d6fb8ed853fdc19ce09752d63f3a2e5b5158aeb261520cd75eb618bd60305165"
@ -1780,7 +1790,7 @@ dependencies = [
"checksum syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)" = "261ae9ecaa397c42b960649561949d69311f08eeaea86a65696e6e46517cf741"
"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5"
"checksum syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf"
"checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f"
"checksum synstructure 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3f085a5855930c0441ca1288cf044ea4aecf4f43a91668abdb870b4ba546a203"
"checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
@ -1802,15 +1812,15 @@ dependencies = [
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
"checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e"
"checksum wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b89c3ce4ce14bdc6fb6beaf9ec7928ca331de5df7e5ea278375642a2f478570d"
"checksum wasm-bindgen 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)" = "cd34c5ba0d228317ce388e87724633c57edca3e7531feb4e25e35aaa07a656af"
"checksum wasm-bindgen-backend 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)" = "927196b315c23eed2748442ba675a4c54a1a079d90d9bdc5ad16ce31cf90b15b"
"checksum wasm-bindgen-macro 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)" = "92c2442bf04d89792816650820c3fb407af8da987a9f10028d5317f5b04c2b4a"
"checksum wasm-bindgen-macro-support 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)" = "9c075d27b7991c68ca0f77fe628c3513e64f8c477d422b859e03f28751b46fc5"
"checksum wasm-bindgen-shared 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)" = "83d61fe986a7af038dd8b5ec660e5849cbd9f38e7492b9404cc48b2b4df731d1"
"checksum wasm-bindgen-webidl 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)" = "9b979afb0535fe4749906a674082db1211de8aef466331d43232f63accb7c07c"
"checksum wasm-bindgen 0.2.52 (registry+https://github.com/rust-lang/crates.io-index)" = "637353fd57864c20f1968dc21680fe03985ca3a7ef6a5ce027777513bdecc282"
"checksum wasm-bindgen-backend 0.2.52 (registry+https://github.com/rust-lang/crates.io-index)" = "c85481ca7d1aad8cf40e0140830b2197ce89184a80e54e307b55fd64d78ed63e"
"checksum wasm-bindgen-macro 0.2.52 (registry+https://github.com/rust-lang/crates.io-index)" = "9f627667b5f4f8bd923c93107b96907c60e7e8eb2636802499fce468c87e3689"
"checksum wasm-bindgen-macro-support 0.2.52 (registry+https://github.com/rust-lang/crates.io-index)" = "a48f5147b0c049bc306d5b9e53c891056a1fd8c4e7311fffbce233e4f200d45e"
"checksum wasm-bindgen-shared 0.2.52 (registry+https://github.com/rust-lang/crates.io-index)" = "1e272b0d31b78cdcaf5ad440d28276546d99b059a953e5afb387aefce66c3c5a"
"checksum wasm-bindgen-webidl 0.2.52 (registry+https://github.com/rust-lang/crates.io-index)" = "6965845db6189148d8b26387aee0bbf1c84f3da78f57ac543f364fc8ff7ab6e9"
"checksum wasmi 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "aebbaef470840d157a5c47c8c49f024da7b1b80e90ff729ca982b2b80447e78b"
"checksum wasmi-validation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ab380192444b3e8522ae79c0a1976e42a82920916ccdfbce3def89f456ea33f3"
"checksum web-sys 0.3.28 (registry+https://github.com/rust-lang/crates.io-index)" = "c84440699cd02ca23bed6f045ffb1497bc18a3c2628bd13e2093186faaaacf6b"
"checksum web-sys 0.3.29 (registry+https://github.com/rust-lang/crates.io-index)" = "0a8b4b06314fd2ce36977e9487607ccff4030779129813f89d0e618710910146"
"checksum weedle 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3bb43f70885151e629e2a19ce9e50bd730fd436cfd4b666894c9ce4de9141164"
"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"

View file

@ -2,9 +2,9 @@
members = [
"zokrates_core",
"zokrates_fs_resolver",
"zokrates_stdlib",
"zokrates_embed",
"zokrates_abi",
"zokrates_test",
"zokrates_core_test",
]

View file

@ -1,6 +0,0 @@
def main() -> (4):
(1 * ~one) * (42 * ~one) == 1 * ~out_0
(1 * ~one) * (43 * ~one) == 1 * ~out_1
(1 * ~one) * (0) == 1 * ~out_2
(1 * ~one) * (1 * ~one) == 1 * ~out_3
return ~out_0, ~out_1, ~out_2, ~out_3

12
zokrates_abi/Cargo.toml Normal file
View file

@ -0,0 +1,12 @@
[package]
name = "zokrates_abi"
version = "0.1.0"
authors = ["Thibaut Schaeffer <thibaut@schaeff.fr>"]
edition = "2018"
[dependencies]
zokrates_field = { version = "0.3", path = "../zokrates_field" }
zokrates_core = { version = "0.4", path = "../zokrates_core" }
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"

491
zokrates_abi/src/lib.rs Normal file
View file

@ -0,0 +1,491 @@
#![feature(box_patterns, box_syntax)]
pub enum Inputs<T> {
Raw(Vec<T>),
Abi(CheckedValues<T>),
}
impl<T: From<usize>> Encode<T> for Inputs<T> {
fn encode(self) -> Vec<T> {
match self {
Inputs::Raw(v) => v,
Inputs::Abi(v) => v.encode(),
}
}
}
use std::collections::BTreeMap;
use std::convert::TryFrom;
use std::fmt;
use zokrates_core::typed_absy::Type;
use zokrates_field::field::Field;
type Map<K, V> = BTreeMap<K, V>;
#[derive(Debug, PartialEq)]
pub enum Error {
Json(String),
Conversion(String),
Type(String),
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Error::Json(e) => write!(f, "Invalid JSON: {}", e),
Error::Conversion(e) => write!(f, "Invalid ZoKrates values: {}", e),
Error::Type(e) => write!(f, "Type error: {}", e),
}
}
}
#[derive(PartialEq, Debug)]
enum Value<T> {
Field(T),
Boolean(bool),
Array(Vec<Value<T>>),
Struct(Map<String, Value<T>>),
}
#[derive(PartialEq, Debug)]
enum CheckedValue<T> {
Field(T),
Boolean(bool),
Array(Vec<CheckedValue<T>>),
Struct(Vec<(String, CheckedValue<T>)>),
}
#[derive(PartialEq, Debug)]
pub struct CheckedValues<T>(Vec<CheckedValue<T>>);
impl<T: Field> fmt::Display for Value<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Value::Field(v) => write!(f, "{}", v),
Value::Boolean(v) => write!(f, "{}", v),
Value::Array(v) => write!(
f,
"[{}]",
v.iter()
.map(|v| format!("{}", v))
.collect::<Vec<_>>()
.join(", ")
),
Value::Struct(v) => write!(
f,
"{{{}}}",
v.iter()
.map(|(k, v)| format!("{}: {}", k, v))
.collect::<Vec<_>>()
.join(", ")
),
}
}
}
impl<T: Field> Value<T> {
fn check(self, ty: Type) -> Result<CheckedValue<T>, String> {
match (self, ty) {
(Value::Field(f), Type::FieldElement) => Ok(CheckedValue::Field(f)),
(Value::Boolean(b), Type::Boolean) => Ok(CheckedValue::Boolean(b)),
(Value::Array(a), Type::Array(box inner_ty, size)) => {
if a.len() != size {
Err(format!(
"Expected array of size {}, found array of size {}",
size,
a.len()
))
} else {
let a = a
.into_iter()
.map(|val| val.check(inner_ty.clone()))
.collect::<Result<Vec<_>, _>>()?;
Ok(CheckedValue::Array(a))
}
}
(Value::Struct(mut s), Type::Struct(members)) => {
if s.len() != members.len() {
Err(format!(
"Expected {} member(s), found {}",
members.len(),
s.len()
))
} else {
let s = members
.into_iter()
.map(|(id, ty)| {
s.remove(&id)
.ok_or_else(|| format!("Member with id `{}` not found", id))
.map(|v| v.check(ty).map(|v| (id, v)))
})
.collect::<Result<Vec<_>, _>>()?
.into_iter()
.collect::<Result<_, _>>()?;
Ok(CheckedValue::Struct(s))
}
}
(v, t) => Err(format!("Value `{}` doesn't match expected type `{}`", v, t)),
}
}
}
pub trait Encode<T> {
fn encode(self) -> Vec<T>;
}
pub trait Decode<T> {
type Expected;
fn decode(raw: Vec<T>, expected: Self::Expected) -> Self;
}
impl<T: From<usize>> Encode<T> for CheckedValue<T> {
fn encode(self) -> Vec<T> {
match self {
CheckedValue::Field(t) => vec![t],
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(),
}
}
}
impl<T: Clone + From<usize> + PartialEq> Decode<T> for CheckedValues<T> {
type Expected = Vec<Type>;
fn decode(raw: Vec<T>, expected: Self::Expected) -> Self {
CheckedValues(
expected
.into_iter()
.scan(0, |state, e| {
let new_state = *state + e.get_primitive_count();
let res = CheckedValue::decode(raw[*state..new_state].to_vec(), e);
*state = new_state;
Some(res)
})
.collect(),
)
}
}
impl<T: From<usize> + PartialEq + Clone> Decode<T> for CheckedValue<T> {
type Expected = Type;
fn decode(raw: Vec<T>, expected: Self::Expected) -> Self {
let mut raw = raw;
match expected {
Type::FieldElement => CheckedValue::Field(raw.pop().unwrap()),
Type::Boolean => {
let v = raw.pop().unwrap();
CheckedValue::Boolean(if v == 0.into() {
false
} else if v == 1.into() {
true
} else {
unreachable!()
})
}
Type::Array(box inner_ty, _) => CheckedValue::Array(
raw.chunks(inner_ty.get_primitive_count())
.map(|c| CheckedValue::decode(c.to_vec(), inner_ty.clone()))
.collect(),
),
Type::Struct(members) => CheckedValue::Struct(
members
.into_iter()
.scan(0, |state, (id, ty)| {
let new_state = *state + ty.get_primitive_count();
let res = CheckedValue::decode(raw[*state..new_state].to_vec(), ty);
*state = new_state;
Some((id, res))
})
.collect(),
),
}
}
}
impl<T: From<usize>> Encode<T> for CheckedValues<T> {
fn encode(self) -> Vec<T> {
self.0.into_iter().flat_map(|v| v.encode()).collect()
}
}
#[derive(PartialEq, Debug)]
struct Values<T>(Vec<Value<T>>);
impl<T: Field> TryFrom<serde_json::Value> for Values<T> {
type Error = String;
fn try_from(v: serde_json::Value) -> Result<Values<T>, Self::Error> {
match v {
serde_json::Value::Array(a) => a
.into_iter()
.map(|v| Value::try_from(v))
.collect::<Result<_, _>>()
.map(|v| Values(v)),
v => Err(format!("Expected an array of values, found `{}`", v)),
}
}
}
impl<T: Field> TryFrom<serde_json::Value> for Value<T> {
type Error = String;
fn try_from(v: serde_json::Value) -> Result<Value<T>, Self::Error> {
match v {
serde_json::Value::String(s) => T::try_from_dec_str(&s)
.map(|v| Value::Field(v))
.map_err(|_| format!("Could not parse `{}` as field element", s)),
serde_json::Value::Bool(b) => Ok(Value::Boolean(b)),
serde_json::Value::Number(n) => Err(format!(
"Value `{}` isn't allowed, did you mean `\"{}\"`?",
n, n
)),
serde_json::Value::Array(a) => a
.into_iter()
.map(|v| Value::try_from(v))
.collect::<Result<_, _>>()
.map(|v| Value::Array(v)),
serde_json::Value::Object(o) => o
.into_iter()
.map(|(k, v)| Value::try_from(v).map(|v| (k, v)))
.collect::<Result<Map<_, _>, _>>()
.map(|v| Value::Struct(v)),
v => Err(format!("Value `{}` isn't allowed", v)),
}
}
}
impl<T: Field> Into<serde_json::Value> for CheckedValue<T> {
fn into(self) -> serde_json::Value {
match self {
CheckedValue::Field(f) => serde_json::Value::String(f.to_dec_string()),
CheckedValue::Boolean(b) => serde_json::Value::Bool(b),
CheckedValue::Array(a) => {
serde_json::Value::Array(a.into_iter().map(|e| e.into()).collect())
}
CheckedValue::Struct(s) => {
serde_json::Value::Object(s.into_iter().map(|(k, v)| (k, v.into())).collect())
}
}
}
}
impl<T: Field> Into<serde_json::Value> for CheckedValues<T> {
fn into(self) -> serde_json::Value {
serde_json::Value::Array(self.0.into_iter().map(|e| e.into()).collect())
}
}
fn parse<T: Field>(s: &str) -> Result<Values<T>, Error> {
let json_values: serde_json::Value =
serde_json::from_str(s).map_err(|e| Error::Json(e.to_string()))?;
Values::try_from(json_values).map_err(|e| Error::Conversion(e))
}
pub fn parse_strict<T: Field>(s: &str, types: Vec<Type>) -> Result<CheckedValues<T>, Error> {
let parsed = parse(s)?;
if parsed.0.len() != types.len() {
return Err(Error::Type(format!(
"Expected {} inputs, found {}",
types.len(),
parsed.0.len()
)));
}
let checked = parsed
.0
.into_iter()
.zip(types.into_iter())
.map(|(v, ty)| v.check(ty))
.collect::<Result<Vec<_>, _>>()
.map_err(|e| Error::Type(e))?;
Ok(CheckedValues(checked))
}
#[cfg(test)]
mod tests {
use super::*;
use zokrates_field::field::FieldPrime;
#[test]
fn numbers() {
let s = "[1, 2]";
assert_eq!(
parse::<FieldPrime>(s).unwrap_err(),
Error::Conversion(String::from(
"Value `1` isn't allowed, did you mean `\"1\"`?"
))
);
}
#[test]
fn fields() {
let s = r#"["1", "2"]"#;
assert_eq!(
parse::<FieldPrime>(s).unwrap(),
Values(vec![Value::Field(1.into()), Value::Field(2.into())])
);
}
#[test]
fn bools() {
let s = "[true, false]";
assert_eq!(
parse::<FieldPrime>(s).unwrap(),
Values(vec![Value::Boolean(true), Value::Boolean(false)])
);
}
#[test]
fn array() {
let s = "[[true, false]]";
assert_eq!(
parse::<FieldPrime>(s).unwrap(),
Values(vec![Value::Array(vec![
Value::Boolean(true),
Value::Boolean(false)
])])
);
}
#[test]
fn struc() {
let s = r#"[{"a": "42"}]"#;
assert_eq!(
parse::<FieldPrime>(s).unwrap(),
Values(vec![Value::Struct(
vec![("a".to_string(), Value::Field(42.into()))]
.into_iter()
.collect()
)])
);
}
mod strict {
use super::*;
#[test]
fn fields() {
let s = r#"["1", "2"]"#;
assert_eq!(
parse_strict::<FieldPrime>(s, vec![Type::FieldElement, Type::FieldElement])
.unwrap(),
CheckedValues(vec![
CheckedValue::Field(1.into()),
CheckedValue::Field(2.into())
])
);
}
#[test]
fn bools() {
let s = "[true, false]";
assert_eq!(
parse_strict::<FieldPrime>(s, vec![Type::Boolean, Type::Boolean]).unwrap(),
CheckedValues(vec![
CheckedValue::Boolean(true),
CheckedValue::Boolean(false)
])
);
}
#[test]
fn array() {
let s = "[[true, false]]";
assert_eq!(
parse_strict::<FieldPrime>(s, vec![Type::array(Type::Boolean, 2)]).unwrap(),
CheckedValues(vec![CheckedValue::Array(vec![
CheckedValue::Boolean(true),
CheckedValue::Boolean(false)
])])
);
}
#[test]
fn struc() {
let s = r#"[{"a": "42"}]"#;
assert_eq!(
parse_strict::<FieldPrime>(
s,
vec![Type::Struct(vec![("a".into(), Type::FieldElement)])]
)
.unwrap(),
CheckedValues(vec![CheckedValue::Struct(
vec![("a".to_string(), CheckedValue::Field(42.into()))]
.into_iter()
.collect()
)])
);
let s = r#"[{"b": "42"}]"#;
assert_eq!(
parse_strict::<FieldPrime>(
s,
vec![Type::Struct(vec![("a".into(), Type::FieldElement)])]
)
.unwrap_err(),
Error::Type("Member with id `a` not found".into())
);
let s = r#"[{}]"#;
assert_eq!(
parse_strict::<FieldPrime>(
s,
vec![Type::Struct(vec![("a".into(), Type::FieldElement)])]
)
.unwrap_err(),
Error::Type("Expected 1 member(s), found 0".into())
);
let s = r#"[{"a": false}]"#;
assert_eq!(
parse_strict::<FieldPrime>(
s,
vec![Type::Struct(vec![("a".into(), Type::FieldElement)])]
)
.unwrap_err(),
Error::Type("Value `false` doesn't match expected type `field`".into())
);
}
}
mod encode {
use super::*;
#[test]
fn fields() {
let v = CheckedValues(vec![CheckedValue::Field(1), CheckedValue::Field(2)]);
assert_eq!(v.encode(), vec![1, 2]);
}
#[test]
fn bools() {
let v: CheckedValues<usize> = CheckedValues(vec![
CheckedValue::Boolean(true),
CheckedValue::Boolean(false),
]);
assert_eq!(v.encode(), vec![1, 0]);
}
#[test]
fn array() {
let v: CheckedValues<usize> = CheckedValues(vec![CheckedValue::Array(vec![
CheckedValue::Boolean(true),
CheckedValue::Boolean(false),
])]);
assert_eq!(v.encode(), vec![1, 0]);
}
#[test]
fn struc() {
let v: CheckedValues<usize> = CheckedValues(vec![CheckedValue::Struct(
vec![("a".to_string(), CheckedValue::Field(42))]
.into_iter()
.collect(),
)]);
assert_eq!(v.encode(), vec![42]);
}
}
}

View file

@ -20,7 +20,7 @@ While `field` values mostly behave like unsigned integers, one should keep in mi
ZoKrates has limited support for booleans, to the extent that they can only be used as the condition in `if ... else ... endif` expressions.
You can use them for equality checks, inequality checks and inequality checks between `field` values.
You can use them for equality checks and inequality checks between `field` values.
Note that while equality checks are cheap, inequality checks should be use wisely as they are orders of magnitude more expensive.
@ -73,7 +73,7 @@ Consider the following example:
ZoKrates provides some syntactic sugar to retrieve subsets of arrays.
##### Spreads
The spread operator `...` applied to an copies the elements of an existing array.
The spread operator `...` applied to an array copies the elements of the existing array.
This can be used to conveniently compose new arrays, as shown in the following example:
```
field[3] = [1, 2, 3]
@ -124,4 +124,4 @@ The variables within a struct instance, the so called members, can be accessed t
```zokrates
{{#include ../../../zokrates_cli/examples/book/struct_assign.code}}
```
```

View file

@ -1,10 +0,0 @@
struct Point {
field x
field y
}
def main(field a) -> (Point):
Point p = Point {x: 1, y: 0}
p.x = a
p.y = p.x
return p

View file

@ -1,8 +0,0 @@
struct Point {
field x
field y
}
def main() -> (Point):
Point p = Point {x: 1, y: 0}
return p

View file

@ -1,14 +0,0 @@
struct Bar {
field[2] c
bool d
}
struct Foo {
Bar a
bool b
}
def main() -> (Foo):
Foo[2] f = [Foo { a: Bar { c: [0, 0], d: false }, b: true}, Foo { a: Bar {c: [0, 0], d: false}, b: true}]
f[0].a.c = [42, 43]
return f[0]

View file

@ -1,16 +0,0 @@
struct Point {
field x
field y
}
def main(Point p, Point q) -> (Point):
field a = 42
field d = 21
field dpxpyqxqy = d * p.x * p.y * q.x * q.y
return Point {
x: (p.x * q.y + q.x * p.y) / (1 + dpxpyqxqy),
y: (q.x * q.y - a * p.x * p.y) / (1 - dpxpyqxqy)
}

View file

@ -1,29 +0,0 @@
struct Bar {
field[2] c
bool d
}
struct Foo {
Bar a
bool b
}
def main() -> (Foo):
Foo[2] f = [
Foo {
a: Bar {
c: [0, 0],
d: false
},
b: true
},
Foo {
a: Bar {
c: [0, 0],
d: false
},
b: true
}
]
f[0].a.c = [42, 43]
return f[0]

View file

@ -1,6 +1,6 @@
[package]
name = "zokrates_core"
version = "0.3.14"
version = "0.4.0"
authors = ["Jacob Eberhardt <jacob.eberhardt@tu-berlin.de>", "Dennis Kuhnert <mail@kyroy.com>"]
repository = "https://github.com/JacobEberhardt/ZoKrates"
readme = "README.md"

View file

@ -54,7 +54,7 @@ impl<'ast, T: Field> From<pest::StructDefinition<'ast>> for absy::SymbolDeclarat
.map(|f| absy::StructFieldNode::from(f))
.collect(),
}
.span(span.clone()); // TODO check
.span(span.clone());
absy::SymbolDeclaration {
id,

View file

@ -32,7 +32,7 @@ pub type ModuleId = String;
/// A collection of `Module`s
pub type Modules<'ast, T> = HashMap<ModuleId, Module<'ast, T>>;
/// A collection of `SymbolDeclaration`. Duplicates are allowed here as they are fine syntatically.
/// A collection of `SymbolDeclaration`. Duplicates are allowed here as they are fine syntactically.
pub type Declarations<'ast, T> = Vec<SymbolDeclarationNode<'ast, T>>;
/// A `Program` is a collection of `Module`s and an id of the main `Module`

View file

@ -419,9 +419,15 @@ mod tests {
let prog = crate::ir::Prog {
main: f,
private: vec![true; 768],
signature: Signature::new()
.inputs(vec![Type::FieldElement; 768])
.outputs(vec![Type::FieldElement; 256]),
};
let input = (0..512).map(|_| 0).chain((0..256).map(|_| 1)).collect();
let input = (0..512)
.map(|_| FieldPrime::from(0))
.chain((0..256).map(|_| FieldPrime::from(1)))
.collect();
prog.execute(&input).unwrap();
}

View file

@ -470,7 +470,7 @@ impl<'ast, T: Field> Flattener<'ast, T> {
let range_check = (0..size)
.map(|i| {
FieldElementExpression::IfElse(
box BooleanExpression::Eq(
box BooleanExpression::FieldEq(
box e.clone(),
box FieldElementExpression::Number(T::from(i)),
),
@ -531,7 +531,7 @@ impl<'ast, T: Field> Flattener<'ast, T> {
.fold(None, |acc, (term, index)| match acc {
None => Some(term),
Some(acc) => Some(U::if_else(
BooleanExpression::Eq(box e.clone(), box index),
BooleanExpression::FieldEq(box e.clone(), box index),
term,
acc,
)),
@ -724,7 +724,42 @@ impl<'ast, T: Field> Flattener<'ast, T> {
FlatExpression::Identifier(sub_bits_be[bitwidth - 1])
}
BooleanExpression::Eq(box lhs, box rhs) => {
BooleanExpression::BoolEq(box lhs, box rhs) => {
// lhs and rhs are booleans, they flatten to 0 or 1
let x = self.flatten_boolean_expression(symbols, statements_flattened, lhs);
let y = self.flatten_boolean_expression(symbols, statements_flattened, rhs);
// Wanted: Not(X - Y)**2 which is an XNOR
// We know that X and Y are [0, 1]
// (X - Y) can become a negative values, which is why squaring the result is needed
// Negating this returns correct result
// Non-binary Truth table for logic of operation
// +---+---+-------+---------------+
// | X | Y | X - Y | Not(X - Y)**2 |
// +---+---+-------+---------------+
// | 1 | 1 | 0 | 1 |
// | 1 | 0 | 1 | 0 |
// | 0 | 1 | -1 | 0 |
// | 0 | 0 | 0 | 1 |
// +---+---+-------+---------------+
let x_sub_y = FlatExpression::Sub(box x, box y);
let name_x_mult_x = self.use_sym();
statements_flattened.push(FlatStatement::Definition(
name_x_mult_x,
FlatExpression::Mult(
box x_sub_y.clone(),
box x_sub_y,
),
));
FlatExpression::Sub(
box FlatExpression::Number(T::one()),
box FlatExpression::Identifier(name_x_mult_x),
)
}
BooleanExpression::FieldEq(box lhs, box rhs) => {
// We know from semantic checking that lhs and rhs have the same type
// What the expression will flatten to depends on that type
@ -775,7 +810,7 @@ impl<'ast, T: Field> Flattener<'ast, T> {
let eq = self.flatten_boolean_expression(
symbols,
statements_flattened,
BooleanExpression::Eq(box lhs.clone(), box rhs.clone()),
BooleanExpression::FieldEq(box lhs.clone(), box rhs.clone()),
);
FlatExpression::Add(box eq, box lt)
}
@ -1901,7 +1936,7 @@ mod tests {
#[test]
fn if_else() {
let expression = FieldElementExpression::IfElse(
box BooleanExpression::Eq(
box BooleanExpression::FieldEq(
box FieldElementExpression::Number(FieldPrime::from(32)),
box FieldElementExpression::Number(FieldPrime::from(4)),
),
@ -1937,7 +1972,7 @@ mod tests {
let expression = FieldElementExpression::IfElse(
box BooleanExpression::And(
box BooleanExpression::Eq(
box BooleanExpression::FieldEq(
box FieldElementExpression::Number(FieldPrime::from(4)),
box FieldElementExpression::Number(FieldPrime::from(4)),
),
@ -2337,7 +2372,7 @@ mod tests {
let mut statements_flattened = vec![];
let e = ArrayExpressionInner::IfElse(
box BooleanExpression::Eq(
box BooleanExpression::FieldEq(
box FieldElementExpression::Number(FieldPrime::from(1)),
box FieldElementExpression::Number(FieldPrime::from(1)),
),
@ -2370,7 +2405,7 @@ mod tests {
let mut flattener = Flattener::new();
// if 1 == 1 then 1 else 3 fi
let e = FieldElementExpression::IfElse(
box BooleanExpression::Eq(
box BooleanExpression::FieldEq(
box FieldElementExpression::Number(FieldPrime::from(1)),
box FieldElementExpression::Number(FieldPrime::from(1)),
),

View file

@ -41,7 +41,7 @@ pub trait Folder<T: Field>: Sized {
pub fn fold_module<T: Field, F: Folder<T>>(f: &mut F, p: Prog<T>) -> Prog<T> {
Prog {
main: f.fold_function(p.main),
private: p.private,
..p
}
}

View file

@ -66,12 +66,19 @@ impl<T: Field> From<FlatProg<T>> for Prog<T> {
// get the main function
let main = flat_prog.main;
// get the signature to keep high level information in the low level representation
let signature = main.signature.clone();
// get the interface of the program, ie which inputs are private and public
let private = main.arguments.iter().map(|p| p.private).collect();
let main = main.into();
Prog { private, main }
Prog {
private,
main,
signature,
}
}
}

View file

@ -8,7 +8,7 @@ use zokrates_field::field::Field;
pub type ExecutionResult<T> = Result<Witness<T>, Error>;
impl<T: Field> Prog<T> {
pub fn execute<U: Into<T> + Clone>(&self, inputs: &Vec<U>) -> ExecutionResult<T> {
pub fn execute(&self, inputs: &Vec<T>) -> ExecutionResult<T> {
let main = &self.main;
self.check_inputs(&inputs)?;
let mut witness = BTreeMap::new();

View file

@ -2,6 +2,7 @@ use crate::flat_absy::flat_parameter::FlatParameter;
use crate::flat_absy::FlatVariable;
use crate::helpers::Helper;
use std::fmt;
use typed_absy::types::signature::Signature;
use zokrates_field::field::Field;
mod expression;
@ -104,6 +105,7 @@ impl<T: Field> fmt::Display for Function<T> {
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
pub struct Prog<T: Field> {
pub signature: Signature,
pub main: Function<T>,
pub private: Vec<bool>,
}
@ -120,12 +122,8 @@ impl<T: Field> Prog<T> {
.count()
}
pub fn public_arguments_count(&self) -> usize {
self.private.iter().filter(|b| !**b).count()
}
pub fn private_arguments_count(&self) -> usize {
self.private.iter().filter(|b| **b).count()
pub fn arguments_count(&self) -> usize {
self.private.len()
}
pub fn parameters(&self) -> Vec<FlatParameter> {

View file

@ -34,10 +34,10 @@ mod optimizer;
mod parser;
mod semantics;
mod static_analysis;
mod typed_absy;
pub mod absy;
pub mod compile;
pub mod flat_absy;
pub mod ir;
pub mod proof_system;
pub mod typed_absy;

View file

@ -49,6 +49,7 @@ impl<T: Field> Folder<T> for DuplicateOptimizer {
mod tests {
use super::*;
use flat_absy::FlatVariable;
use typed_absy::types::Signature;
use zokrates_field::field::FieldPrime;
#[test]
@ -78,6 +79,7 @@ mod tests {
returns: vec![],
arguments: vec![],
},
signature: Signature::new(),
};
let expected = p.clone();
@ -117,6 +119,7 @@ mod tests {
returns: vec![],
arguments: vec![],
},
signature: Signature::new(),
};
let expected = Prog {
@ -136,6 +139,7 @@ mod tests {
returns: vec![],
arguments: vec![],
},
signature: Signature::new(),
};
assert_eq!(DuplicateOptimizer::optimize(p), expected);

View file

@ -382,6 +382,7 @@ mod tests {
use crate::flat_absy::FlatVariable;
use crate::ir::*;
use crate::proof_system::bn128::g16::serialize::serialize_proof;
use typed_absy::types::{Signature, Type};
#[allow(dead_code)]
#[derive(Deserialize)]
@ -411,11 +412,14 @@ mod tests {
)],
},
private: vec![false],
signature: Signature::new()
.inputs(vec![Type::FieldElement])
.outputs(vec![Type::FieldElement]),
};
let witness = program
.clone()
.execute::<FieldPrime>(&vec![FieldPrime::from(42)])
.execute(&vec![FieldPrime::from(42)])
.unwrap();
let computation = Computation::with_witness(program, witness);

View file

@ -294,6 +294,7 @@ mod parse {
mod tests {
use super::*;
use crate::ir::{Function, LinComb};
use typed_absy::types::{Signature, Type};
use zokrates_field::field::FieldPrime;
mod prove {
@ -309,9 +310,10 @@ mod tests {
statements: vec![],
},
private: vec![],
signature: Signature::new(),
};
let witness = program.clone().execute::<FieldPrime>(&vec![]).unwrap();
let witness = program.clone().execute(&vec![]).unwrap();
let computation = Computation::with_witness(program, witness);
let params = computation.clone().setup();
@ -331,12 +333,12 @@ mod tests {
)],
},
private: vec![true],
signature: Signature::new()
.inputs(vec![Type::FieldElement])
.outputs(vec![Type::FieldElement]),
};
let witness = program
.clone()
.execute::<FieldPrime>(&vec![FieldPrime::from(0)])
.unwrap();
let witness = program.clone().execute(&vec![FieldPrime::from(0)]).unwrap();
let computation = Computation::with_witness(program, witness);
let params = computation.clone().setup();
@ -356,12 +358,12 @@ mod tests {
)],
},
private: vec![false],
signature: Signature::new()
.inputs(vec![Type::FieldElement])
.outputs(vec![Type::FieldElement]),
};
let witness = program
.clone()
.execute::<FieldPrime>(&vec![FieldPrime::from(0)])
.unwrap();
let witness = program.clone().execute(&vec![FieldPrime::from(0)]).unwrap();
let computation = Computation::with_witness(program, witness);
let params = computation.clone().setup();
@ -381,9 +383,10 @@ mod tests {
)],
},
private: vec![],
signature: Signature::new().outputs(vec![Type::FieldElement]),
};
let witness = program.clone().execute::<FieldPrime>(&vec![]).unwrap();
let witness = program.clone().execute(&vec![]).unwrap();
let computation = Computation::with_witness(program, witness);
let params = computation.clone().setup();
@ -415,11 +418,14 @@ mod tests {
],
},
private: vec![true, false],
signature: Signature::new()
.inputs(vec![Type::FieldElement, Type::FieldElement])
.outputs(vec![Type::FieldElement, Type::FieldElement]),
};
let witness = program
.clone()
.execute::<FieldPrime>(&vec![FieldPrime::from(3), FieldPrime::from(4)])
.execute(&vec![FieldPrime::from(3), FieldPrime::from(4)])
.unwrap();
let computation = Computation::with_witness(program, witness);
@ -440,12 +446,12 @@ mod tests {
)],
},
private: vec![false],
signature: Signature::new()
.inputs(vec![Type::FieldElement])
.outputs(vec![Type::FieldElement]),
};
let witness = program
.clone()
.execute::<FieldPrime>(&vec![FieldPrime::from(3)])
.unwrap();
let witness = program.clone().execute(&vec![FieldPrime::from(3)]).unwrap();
let computation = Computation::with_witness(program, witness);
let params = computation.clone().setup();
@ -467,11 +473,14 @@ mod tests {
)],
},
private: vec![true, false],
signature: Signature::new()
.inputs(vec![Type::FieldElement, Type::FieldElement])
.outputs(vec![Type::FieldElement]),
};
let witness = program
.clone()
.execute::<FieldPrime>(&vec![FieldPrime::from(3), FieldPrime::from(4)])
.execute(&vec![FieldPrime::from(3), FieldPrime::from(4)])
.unwrap();
let computation = Computation::with_witness(program, witness);

View file

@ -1372,7 +1372,10 @@ impl<'ast> Checker<'ast> {
let e2_checked = self.check_expression(e2, module_id, &types)?;
match (e1_checked, e2_checked) {
(TypedExpression::FieldElement(e1), TypedExpression::FieldElement(e2)) => {
Ok(BooleanExpression::Eq(box e1, box e2).into())
Ok(BooleanExpression::FieldEq(box e1, box e2).into())
}
(TypedExpression::Boolean(e1), TypedExpression::Boolean(e2)) => {
Ok(BooleanExpression::BoolEq(box e1, box e2).into())
}
(e1, e2) => Err(Error {
pos: Some(pos),

View file

@ -1,4 +1,5 @@
//! Add runtime boolean checks on user inputs
//!
//! Example:
//! ```zokrates
//! struct Foo {
@ -9,9 +10,22 @@
//! f.bar == f.bar && f.bar
//! return
//! ```
//! @file unroll.rs
//!
//! Becomes
//!
//! ```zokrates
//! struct Foo {
//! bar: bool
//! }
//!
//! def main(Foo f) -> ():
//! f.bar == f.bar && f.bar
//! return
//! ```
//!
//! @file constrain_inputs.rs
//! @author Thibaut Schaeffer <thibaut@schaeff.fr>
//! @date 2018
//! @date 2019
use crate::typed_absy::folder::Folder;
use crate::typed_absy::types::Type;

View file

@ -460,7 +460,7 @@ impl<'ast, T: Field> Folder<'ast, T> for Propagator<'ast, T> {
},
None => BooleanExpression::Identifier(id),
},
BooleanExpression::Eq(box e1, box e2) => {
BooleanExpression::FieldEq(box e1, box e2) => {
let e1 = self.fold_field_expression(e1);
let e2 = self.fold_field_expression(e2);
@ -468,7 +468,18 @@ impl<'ast, T: Field> Folder<'ast, T> for Propagator<'ast, T> {
(FieldElementExpression::Number(n1), FieldElementExpression::Number(n2)) => {
BooleanExpression::Value(n1 == n2)
}
(e1, e2) => BooleanExpression::Eq(box e1, box e2),
(e1, e2) => BooleanExpression::FieldEq(box e1, box e2),
}
}
BooleanExpression::BoolEq(box e1, box e2) => {
let e1 = self.fold_boolean_expression(e1);
let e2 = self.fold_boolean_expression(e2);
match (e1, e2) {
(BooleanExpression::Value(n1), BooleanExpression::Value(n2)) => {
BooleanExpression::Value(n1 == n2)
}
(e1, e2) => BooleanExpression::BoolEq(box e1, box e2),
}
}
BooleanExpression::Lt(box e1, box e2) => {
@ -750,13 +761,13 @@ mod tests {
}
#[test]
fn eq() {
let e_true = BooleanExpression::Eq(
fn field_eq() {
let e_true = BooleanExpression::FieldEq(
box FieldElementExpression::Number(FieldPrime::from(2)),
box FieldElementExpression::Number(FieldPrime::from(2)),
);
let e_false = BooleanExpression::Eq(
let e_false = BooleanExpression::FieldEq(
box FieldElementExpression::Number(FieldPrime::from(4)),
box FieldElementExpression::Number(FieldPrime::from(2)),
);
@ -771,6 +782,49 @@ mod tests {
);
}
#[test]
fn bool_eq() {
assert_eq!(
Propagator::<FieldPrime>::new().fold_boolean_expression(
BooleanExpression::BoolEq(
box BooleanExpression::Value(false),
box BooleanExpression::Value(false)
)
),
BooleanExpression::Value(true)
);
assert_eq!(
Propagator::<FieldPrime>::new().fold_boolean_expression(
BooleanExpression::BoolEq(
box BooleanExpression::Value(true),
box BooleanExpression::Value(true)
)
),
BooleanExpression::Value(true)
);
assert_eq!(
Propagator::<FieldPrime>::new().fold_boolean_expression(
BooleanExpression::BoolEq(
box BooleanExpression::Value(true),
box BooleanExpression::Value(false)
)
),
BooleanExpression::Value(false)
);
assert_eq!(
Propagator::<FieldPrime>::new().fold_boolean_expression(
BooleanExpression::BoolEq(
box BooleanExpression::Value(false),
box BooleanExpression::Value(true)
)
),
BooleanExpression::Value(false)
);
}
#[test]
fn lt() {
let e_true = BooleanExpression::Lt(

View file

@ -78,7 +78,7 @@ impl<'ast> Unroller<'ast> {
(0..size)
.map(|i| match inner_ty {
Type::Array(..) => ArrayExpression::if_else(
BooleanExpression::Eq(
BooleanExpression::FieldEq(
box FieldElementExpression::Number(T::from(i)),
box head.clone(),
),
@ -105,7 +105,7 @@ impl<'ast> Unroller<'ast> {
)
.into(),
Type::Struct(..) => StructExpression::if_else(
BooleanExpression::Eq(
BooleanExpression::FieldEq(
box FieldElementExpression::Number(T::from(i)),
box head.clone(),
),
@ -132,7 +132,7 @@ impl<'ast> Unroller<'ast> {
)
.into(),
Type::FieldElement => FieldElementExpression::if_else(
BooleanExpression::Eq(
BooleanExpression::FieldEq(
box FieldElementExpression::Number(T::from(i)),
box head.clone(),
),
@ -159,7 +159,7 @@ impl<'ast> Unroller<'ast> {
)
.into(),
Type::Boolean => BooleanExpression::if_else(
BooleanExpression::Eq(
BooleanExpression::FieldEq(
box FieldElementExpression::Number(T::from(i)),
box head.clone(),
),
@ -445,7 +445,7 @@ mod tests {
a1,
ArrayExpressionInner::Value(vec![
FieldElementExpression::if_else(
BooleanExpression::Eq(
BooleanExpression::FieldEq(
box FieldElementExpression::Number(FieldPrime::from(0)),
box FieldElementExpression::Number(FieldPrime::from(1))
),
@ -457,7 +457,7 @@ mod tests {
)
.into(),
FieldElementExpression::if_else(
BooleanExpression::Eq(
BooleanExpression::FieldEq(
box FieldElementExpression::Number(FieldPrime::from(1)),
box FieldElementExpression::Number(FieldPrime::from(1))
),
@ -469,7 +469,7 @@ mod tests {
)
.into(),
FieldElementExpression::if_else(
BooleanExpression::Eq(
BooleanExpression::FieldEq(
box FieldElementExpression::Number(FieldPrime::from(2)),
box FieldElementExpression::Number(FieldPrime::from(1))
),
@ -506,7 +506,7 @@ mod tests {
a1,
ArrayExpressionInner::Value(vec![
ArrayExpression::if_else(
BooleanExpression::Eq(
BooleanExpression::FieldEq(
box FieldElementExpression::Number(FieldPrime::from(0)),
box FieldElementExpression::Number(FieldPrime::from(1))
),
@ -518,7 +518,7 @@ mod tests {
)
.into(),
ArrayExpression::if_else(
BooleanExpression::Eq(
BooleanExpression::FieldEq(
box FieldElementExpression::Number(FieldPrime::from(1)),
box FieldElementExpression::Number(FieldPrime::from(1))
),
@ -530,7 +530,7 @@ mod tests {
)
.into(),
ArrayExpression::if_else(
BooleanExpression::Eq(
BooleanExpression::FieldEq(
box FieldElementExpression::Number(FieldPrime::from(2)),
box FieldElementExpression::Number(FieldPrime::from(1))
),
@ -570,13 +570,13 @@ mod tests {
a1,
ArrayExpressionInner::Value(vec![
ArrayExpression::if_else(
BooleanExpression::Eq(
BooleanExpression::FieldEq(
box FieldElementExpression::Number(FieldPrime::from(0)),
box FieldElementExpression::Number(FieldPrime::from(0))
),
ArrayExpressionInner::Value(vec![
FieldElementExpression::if_else(
BooleanExpression::Eq(
BooleanExpression::FieldEq(
box FieldElementExpression::Number(FieldPrime::from(0)),
box FieldElementExpression::Number(FieldPrime::from(0))
),
@ -591,7 +591,7 @@ mod tests {
)
.into(),
FieldElementExpression::if_else(
BooleanExpression::Eq(
BooleanExpression::FieldEq(
box FieldElementExpression::Number(FieldPrime::from(1)),
box FieldElementExpression::Number(FieldPrime::from(0))
),
@ -614,13 +614,13 @@ mod tests {
)
.into(),
ArrayExpression::if_else(
BooleanExpression::Eq(
BooleanExpression::FieldEq(
box FieldElementExpression::Number(FieldPrime::from(1)),
box FieldElementExpression::Number(FieldPrime::from(0))
),
ArrayExpressionInner::Value(vec![
FieldElementExpression::if_else(
BooleanExpression::Eq(
BooleanExpression::FieldEq(
box FieldElementExpression::Number(FieldPrime::from(0)),
box FieldElementExpression::Number(FieldPrime::from(0))
),
@ -635,7 +635,7 @@ mod tests {
)
.into(),
FieldElementExpression::if_else(
BooleanExpression::Eq(
BooleanExpression::FieldEq(
box FieldElementExpression::Number(FieldPrime::from(1)),
box FieldElementExpression::Number(FieldPrime::from(0))
),
@ -976,7 +976,7 @@ mod tests {
)),
ArrayExpressionInner::Value(vec![
FieldElementExpression::IfElse(
box BooleanExpression::Eq(
box BooleanExpression::FieldEq(
box FieldElementExpression::Number(FieldPrime::from(0)),
box FieldElementExpression::Number(FieldPrime::from(1))
),
@ -991,7 +991,7 @@ mod tests {
)
.into(),
FieldElementExpression::IfElse(
box BooleanExpression::Eq(
box BooleanExpression::FieldEq(
box FieldElementExpression::Number(FieldPrime::from(1)),
box FieldElementExpression::Number(FieldPrime::from(1))
),
@ -1114,7 +1114,7 @@ mod tests {
)),
ArrayExpressionInner::Value(vec![
ArrayExpressionInner::IfElse(
box BooleanExpression::Eq(
box BooleanExpression::FieldEq(
box FieldElementExpression::Number(FieldPrime::from(0)),
box FieldElementExpression::Number(FieldPrime::from(1))
),
@ -1136,7 +1136,7 @@ mod tests {
.annotate(Type::FieldElement, 2)
.into(),
ArrayExpressionInner::IfElse(
box BooleanExpression::Eq(
box BooleanExpression::FieldEq(
box FieldElementExpression::Number(FieldPrime::from(1)),
box FieldElementExpression::Number(FieldPrime::from(1))
),

View file

@ -302,10 +302,15 @@ pub fn fold_boolean_expression<'ast, T: Field, F: Folder<'ast, T>>(
match e {
BooleanExpression::Value(v) => BooleanExpression::Value(v),
BooleanExpression::Identifier(id) => BooleanExpression::Identifier(f.fold_name(id)),
BooleanExpression::Eq(box e1, box e2) => {
BooleanExpression::FieldEq(box e1, box e2) => {
let e1 = f.fold_field_expression(e1);
let e2 = f.fold_field_expression(e2);
BooleanExpression::Eq(box e1, box e2)
BooleanExpression::FieldEq(box e1, box e2)
}
BooleanExpression::BoolEq(box e1, box e2) => {
let e1 = f.fold_boolean_expression(e1);
let e2 = f.fold_boolean_expression(e2);
BooleanExpression::BoolEq(box e1, box e2)
}
BooleanExpression::Lt(box e1, box e2) => {
let e1 = f.fold_field_expression(e1);

View file

@ -11,9 +11,10 @@ pub mod types;
mod variable;
pub use crate::typed_absy::parameter::Parameter;
pub use crate::typed_absy::types::Type;
pub use crate::typed_absy::variable::Variable;
use crate::typed_absy::types::{FunctionKey, MemberId, Signature, Type};
use crate::typed_absy::types::{FunctionKey, MemberId, Signature};
use embed::FlatEmbed;
use std::collections::HashMap;
use std::convert::TryFrom;
@ -74,7 +75,7 @@ impl<'ast, T: Field> fmt::Display for TypedProgram<'ast, T> {
}
}
/// A
/// A typed program as a collection of functions. Types have been resolved during semantic checking.
#[derive(PartialEq, Clone)]
pub struct TypedModule<'ast, T: Field> {
/// Functions of the program
@ -583,10 +584,14 @@ pub enum BooleanExpression<'ast, T: Field> {
Box<FieldElementExpression<'ast, T>>,
Box<FieldElementExpression<'ast, T>>,
),
Eq(
FieldEq(
Box<FieldElementExpression<'ast, T>>,
Box<FieldElementExpression<'ast, T>>,
),
BoolEq(
Box<BooleanExpression<'ast, T>>,
Box<BooleanExpression<'ast, T>>,
),
Ge(
Box<FieldElementExpression<'ast, T>>,
Box<FieldElementExpression<'ast, T>>,
@ -805,7 +810,8 @@ impl<'ast, T: Field> fmt::Display for BooleanExpression<'ast, T> {
BooleanExpression::Identifier(ref var) => write!(f, "{}", var),
BooleanExpression::Lt(ref lhs, ref rhs) => write!(f, "{} < {}", lhs, rhs),
BooleanExpression::Le(ref lhs, ref rhs) => write!(f, "{} <= {}", lhs, rhs),
BooleanExpression::Eq(ref lhs, ref rhs) => write!(f, "{} == {}", lhs, rhs),
BooleanExpression::FieldEq(ref lhs, ref rhs) => write!(f, "{} == {}", lhs, rhs),
BooleanExpression::BoolEq(ref lhs, ref rhs) => write!(f, "{} == {}", lhs, rhs),
BooleanExpression::Ge(ref lhs, ref rhs) => write!(f, "{} >= {}", lhs, rhs),
BooleanExpression::Gt(ref lhs, ref rhs) => write!(f, "{} > {}", lhs, rhs),
BooleanExpression::Or(ref lhs, ref rhs) => write!(f, "{} || {}", lhs, rhs),

View file

@ -0,0 +1,50 @@
{
"entry_point": "./tests/tests/bool_compare.zok",
"tests": [
{
"input": {
"values": [
"1",
"1"
]
},
"output": {
"Ok": {
"values": [
"1"
]
}
}
},
{
"input": {
"values": [
"1",
"0"
]
},
"output": {
"Ok": {
"values": [
"0"
]
}
}
},
{
"input": {
"values": [
"0",
"0"
]
},
"output": {
"Ok": {
"values": [
"1"
]
}
}
}
]
}

View file

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

View file

@ -6,8 +6,8 @@ edition = "2018"
[features]
default = []
wasm = ["bellman_ce/wasm"]
multicore = ["bellman_ce/multicore"]
wasm = ["bellman_ce/wasm", "sapling-crypto_ce/wasm"]
multicore = ["bellman_ce/multicore", "sapling-crypto_ce/multicore"]
[dependencies]
bellman_ce = { version = "0.3.1", default-features = false }

View file

@ -1,6 +1,6 @@
[package]
name = "zokrates_field"
version = "0.3.3"
version = "0.3.4"
authors = ["Thibaut Schaeffer <thibaut@schaeff.fr>", "Guillaume Ballet <gballet@gmail.com>"]
edition = "2018"

View file

@ -1,6 +1,6 @@
[package]
name = "zokrates_fs_resolver"
version = "0.4.1"
version = "0.4.2"
authors = ["Thibaut Schaeffer <thibaut@schaeff.fr>"]
repository = "https://github.com/JacobEberhardt/ZoKrates.git"

View file

@ -0,0 +1,18 @@
[package]
name = "zokrates_github_resolver"
version = "0.1.1"
authors = ["Evgenii P. <eupn@protonmail.com>", "schaeff <thibaut@schaeff.fr>"]
repository = "https://github.com/eupn/ZoKrates.git"
edition = "2018"
[features]
default = []
[dependencies]
reqwest = "0.9"
tempfile = "3"
[dev-dependencies]
mockito = "0.17"
[lib]

View file

@ -1,6 +1,6 @@
[package]
name = "zokrates_parser"
version = "0.1.2"
version = "0.1.3"
authors = ["JacobEberhardt <jacob.eberhardt@tu-berlin.de>"]
edition = "2018"

View file

@ -1,6 +1,6 @@
[package]
name = "zokrates_pest_ast"
version = "0.1.2"
version = "0.1.3"
authors = ["schaeff <thibaut@schaeff.fr>"]
edition = "2018"

View file

@ -1,6 +1,6 @@
[package]
name = "zokrates_stdlib"
version = "0.1.3"
version = "0.1.4"
authors = ["Stefan Deml <stefandeml@gmail.com>", "schaeff <thibaut@schaeff.fr>"]
edition = "2018"

View file

@ -6,7 +6,7 @@ edition = "2018"
[dependencies]
zokrates_field = { version = "0.3", path = "../zokrates_field" }
zokrates_core = { version = "0.3", path = "../zokrates_core" }
zokrates_core = { version = "0.4", path = "../zokrates_core" }
zokrates_fs_resolver = { version = "0.4", path = "../zokrates_fs_resolver" }
serde = "1.0"
serde_derive = "1.0"