From 61d92ecc9109f2ca8f3a0ea8a772d6f83b96c648 Mon Sep 17 00:00:00 2001 From: howardwu Date: Thu, 30 Jul 2020 19:09:27 -0700 Subject: [PATCH] Remove revision peg for snarkOS dependency, change Leo to groth16, update to proper calling convention for snarks --- .cargo/config | 2 +- Cargo.lock | 220 +++++++++++------- Cargo.toml | 12 +- compiler/Cargo.toml | 15 +- compiler/src/value/address/address.rs | 6 +- .../src/value/group/targets/edwards_bls12.rs | 15 +- compiler/tests/address/mod.rs | 4 +- compiler/tests/field/mod.rs | 4 +- gadgets/Cargo.toml | 6 +- gadgets/src/signed_integer/arithmetic/add.rs | 2 +- gadgets/src/signed_integer/arithmetic/mul.rs | 2 +- leo-inputs/Cargo.toml | 10 +- leo/commands/build.rs | 2 +- leo/commands/prove.rs | 8 +- leo/commands/run.rs | 12 +- leo/commands/setup.rs | 65 +++--- leo/errors/cli.rs | 163 ++----------- types/Cargo.toml | 4 +- 18 files changed, 244 insertions(+), 308 deletions(-) diff --git a/.cargo/config b/.cargo/config index 61254264ce..d6e0c4437c 100644 --- a/.cargo/config +++ b/.cargo/config @@ -2,4 +2,4 @@ rustflags = ["-C", "target-cpu=native"] [net] -git-fetch-with-cli = true \ No newline at end of file +git-fetch-with-cli = true diff --git a/Cargo.lock b/Cargo.lock index 2594df9775..ad123383f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,24 +2,24 @@ # It is not intended for manual editing. [[package]] name = "addr2line" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a49806b9dadc843c61e7c97e72490ad7f7220ae249012fbda9ad0609457c0543" +checksum = "1b6a2d3371669ab3ca9797670853d61402b03d0b4b9ebf33d677dfa720203072" dependencies = [ "gimli", ] [[package]] -name = "adler32" -version = "1.1.0" +name = "adler" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567b077b825e468cc974f0020d4082ee6e03132512f207ef1a02fd5d00d1f32d" +checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" [[package]] name = "aho-corasick" -version = "0.7.10" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada" +checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86" dependencies = [ "memchr", ] @@ -52,9 +52,9 @@ checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" [[package]] name = "backtrace" -version = "0.3.49" +version = "0.3.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05100821de9e028f12ae3d189176b41ee198341eb8f369956407fea2f5cc666c" +checksum = "46254cf2fdcdf1badb5934448c1bcbe046a56537b3987d96c51a7afc5d03f293" dependencies = [ "addr2line", "cfg-if", @@ -122,7 +122,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "generic-array 0.14.2", + "generic-array 0.14.3", ] [[package]] @@ -169,9 +169,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.55" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1be3409f94d7bdceeb5f5fac551039d9b3f00e25da7a74fc4d33400a0d96368" +checksum = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518" [[package]] name = "cfg-if" @@ -193,9 +193,9 @@ dependencies = [ [[package]] name = "ci_info" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19c5f9baeac8a1176ca7fc58a0cc1abadd84d360365a93d1dd31e926f3f502b" +checksum = "24f638c70e8c5753795cc9a8c07c44da91554a09e4cf11a7326e8161b0a3c45e" dependencies = [ "envmnt", ] @@ -228,9 +228,9 @@ dependencies = [ [[package]] name = "cpuid-bool" -version = "0.1.0" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d375c433320f6c5057ae04a04376eef4d04ce2801448cf8863a78da99107be4" +checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" [[package]] name = "crc32fast" @@ -305,9 +305,9 @@ version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb582b60359da160a9477ee80f15c8d784c477e69c217ef2cdd4169c24ea380f" dependencies = [ - "proc-macro2 1.0.18", + "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.33", + "syn 1.0.36", ] [[package]] @@ -325,7 +325,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array 0.14.2", + "generic-array 0.14.3", ] [[package]] @@ -349,9 +349,9 @@ dependencies = [ [[package]] name = "envmnt" -version = "0.8.2" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fba7e7d8c007e12db7b3bd6f04b8e47e206c9173d9c75413a042ccc941723c8" +checksum = "a2d328fc287c61314c4a61af7cfdcbd7e678e39778488c7cb13ec133ce0f4059" dependencies = [ "fsio", "indexmap", @@ -373,9 +373,9 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" dependencies = [ - "proc-macro2 1.0.18", + "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.33", + "syn 1.0.36", "synstructure", ] @@ -387,9 +387,9 @@ checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "flate2" -version = "1.0.14" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cfff41391129e0a856d6d822600b8d71179d46879e310417eb9c762eb178b42" +checksum = "68c90b0fc46cf89d227cc78b40e494ff81287a92dd07631e5af0d06fe3cf885e" dependencies = [ "cfg-if", "crc32fast", @@ -409,9 +409,9 @@ dependencies = [ [[package]] name = "fsio" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2131cb03096f67334dfba2f0bc46afc5564b08a919d042c6e217e2665741fc54" +checksum = "c1fd087255f739f4f1aeea69f11b72f8080e9c2e7645cd06955dad4a178a49e3" [[package]] name = "futures" @@ -430,9 +430,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac746a5f3bbfdadd6106868134545e684693d54d9d44f6e9588a7d54af0bf980" +checksum = "60fb4bb6bba52f78a471264d9a3b7d026cc0af47b22cd2cffbc0b787ca003e63" dependencies = [ "typenum", "version_check", @@ -460,15 +460,24 @@ dependencies = [ [[package]] name = "gimli" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcc8e0c9bce37868955864dbecd2b1ab2bdf967e6f28066d65aaac620444b65c" +checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724" + +[[package]] +name = "hashbrown" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34f595585f103464d8d2f6e9864682d74c1601fed5e07d62b1c9058dba8246fb" +dependencies = [ + "autocfg", +] [[package]] name = "hermit-abi" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9586eedd4ce6b3c498bc3b4dd92fc9f11166aa908a914071953768066c67909" +checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9" dependencies = [ "libc", ] @@ -490,11 +499,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c398b2b113b55809ceb9ee3e753fcbac793f1956663f3c36549c1346015c2afe" +checksum = "5b88cd59ee5f71fea89a62248fc8f387d44400cefe05ef548466d61ced9029a7" dependencies = [ "autocfg", + "hashbrown", ] [[package]] @@ -507,10 +517,19 @@ dependencies = [ ] [[package]] -name = "itoa" -version = "0.4.5" +name = "itertools" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" +checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" [[package]] name = "jsonrpc-core" @@ -643,9 +662,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.71" +version = "0.2.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49" +checksum = "a2f02823cf78b754822df5f7f268fb59822e7296276d3e069d8e8cb26a14bd10" [[package]] name = "log" @@ -676,20 +695,20 @@ checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" [[package]] name = "memoffset" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4fc2c02a7e374099d4ee95a193111f72d2110197fe200272371758f6c3643d8" +checksum = "c198b026e1bbf08a937e94c6c60f9ec4a2267f5b0d2eec9c1b21b061ce2be55f" dependencies = [ "autocfg", ] [[package]] name = "miniz_oxide" -version = "0.3.7" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435" +checksum = "be0f75932c1f6cfae3c04000e40114adf955636e19040f9c0a2c380702aa1c7f" dependencies = [ - "adler32", + "adler", ] [[package]] @@ -777,7 +796,7 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fbf404899169771dd6a32c84248b83cd67a26cc7cc957aac87661490e1227e4" dependencies = [ - "itertools", + "itertools 0.7.11", "proc-macro2 0.4.30", "quote 0.6.13", "single", @@ -802,9 +821,9 @@ checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55" dependencies = [ "pest", "pest_meta", - "proc-macro2 1.0.18", + "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.33", + "syn 1.0.36", ] [[package]] @@ -820,9 +839,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.17" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" +checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33" [[package]] name = "podio" @@ -847,11 +866,11 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa" +checksum = "04f5f085b5d71e2188cb8271e5da0161ad52c3f227a661a3c135fdf28e258b12" dependencies = [ - "unicode-xid 0.2.0", + "unicode-xid 0.2.1", ] [[package]] @@ -875,7 +894,7 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" dependencies = [ - "proc-macro2 1.0.18", + "proc-macro2 1.0.19", ] [[package]] @@ -977,6 +996,15 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver", +] + [[package]] name = "rusty-hook" version = "0.11.2" @@ -1010,6 +1038,21 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + [[package]] name = "serde" version = "1.0.114" @@ -1025,9 +1068,9 @@ version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e" dependencies = [ - "proc-macro2 1.0.18", + "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.33", + "syn 1.0.36", ] [[package]] @@ -1077,18 +1120,19 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4" +checksum = "3757cb9d89161a2f24e1cf78efa0c1fcff485d18e3f55e0aa3480824ddaa0f3f" [[package]] name = "snarkos-algorithms" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git?rev=c7a56d9#c7a56d97a76dd6e7841aa6bb86e086f7128e5620" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#d80ce42f37c8dbdd8dcb0ab9574361aea3276dc3" dependencies = [ "blake2", "derivative", "digest 0.8.1", + "itertools 0.9.0", "rand", "rand_chacha", "rayon", @@ -1103,11 +1147,12 @@ dependencies = [ [[package]] name = "snarkos-curves" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git?rev=c7a56d9#c7a56d97a76dd6e7841aa6bb86e086f7128e5620" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#d80ce42f37c8dbdd8dcb0ab9574361aea3276dc3" dependencies = [ "derivative", "rand", "rand_xorshift", + "rustc_version", "serde", "snarkos-errors", "snarkos-models", @@ -1117,21 +1162,22 @@ dependencies = [ [[package]] name = "snarkos-derives" version = "0.1.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git?rev=c7a56d9#c7a56d97a76dd6e7841aa6bb86e086f7128e5620" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#d80ce42f37c8dbdd8dcb0ab9574361aea3276dc3" dependencies = [ - "proc-macro2 1.0.18", + "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.33", + "syn 1.0.36", ] [[package]] name = "snarkos-dpc" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git?rev=c7a56d9#c7a56d97a76dd6e7841aa6bb86e086f7128e5620" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#d80ce42f37c8dbdd8dcb0ab9574361aea3276dc3" dependencies = [ "blake2", "derivative", "hex", + "itertools 0.9.0", "rand", "snarkos-algorithms", "snarkos-curves", @@ -1147,7 +1193,7 @@ dependencies = [ [[package]] name = "snarkos-errors" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git?rev=c7a56d9#c7a56d97a76dd6e7841aa6bb86e086f7128e5620" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#d80ce42f37c8dbdd8dcb0ab9574361aea3276dc3" dependencies = [ "base58", "bech32", @@ -1160,10 +1206,11 @@ dependencies = [ [[package]] name = "snarkos-gadgets" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git?rev=c7a56d9#c7a56d97a76dd6e7841aa6bb86e086f7128e5620" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#d80ce42f37c8dbdd8dcb0ab9574361aea3276dc3" dependencies = [ "derivative", "digest 0.8.1", + "itertools 0.9.0", "snarkos-algorithms", "snarkos-curves", "snarkos-errors", @@ -1174,10 +1221,11 @@ dependencies = [ [[package]] name = "snarkos-models" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git?rev=c7a56d9#c7a56d97a76dd6e7841aa6bb86e086f7128e5620" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#d80ce42f37c8dbdd8dcb0ab9574361aea3276dc3" dependencies = [ "bincode", "derivative", + "itertools 0.9.0", "rand", "rand_xorshift", "serde", @@ -1189,7 +1237,7 @@ dependencies = [ [[package]] name = "snarkos-objects" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git?rev=c7a56d9#c7a56d97a76dd6e7841aa6bb86e086f7128e5620" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#d80ce42f37c8dbdd8dcb0ab9574361aea3276dc3" dependencies = [ "base58", "bech32", @@ -1210,7 +1258,7 @@ dependencies = [ [[package]] name = "snarkos-parameters" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git?rev=c7a56d9#c7a56d97a76dd6e7841aa6bb86e086f7128e5620" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#d80ce42f37c8dbdd8dcb0ab9574361aea3276dc3" dependencies = [ "hex", "snarkos-algorithms", @@ -1222,12 +1270,12 @@ dependencies = [ [[package]] name = "snarkos-profiler" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git?rev=c7a56d9#c7a56d97a76dd6e7841aa6bb86e086f7128e5620" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#d80ce42f37c8dbdd8dcb0ab9574361aea3276dc3" [[package]] name = "snarkos-utilities" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git?rev=c7a56d9#c7a56d97a76dd6e7841aa6bb86e086f7128e5620" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#d80ce42f37c8dbdd8dcb0ab9574361aea3276dc3" dependencies = [ "bincode", "rand", @@ -1260,13 +1308,13 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.33" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8d5d96e8cbb005d6959f119f773bfaebb5684296108fb32600c00cde305b2cd" +checksum = "4cdb98bcb1f9d81d07b536179c269ea15999b5d14ea958196413869445bb5250" dependencies = [ - "proc-macro2 1.0.18", + "proc-macro2 1.0.19", "quote 1.0.7", - "unicode-xid 0.2.0", + "unicode-xid 0.2.1", ] [[package]] @@ -1275,10 +1323,10 @@ version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" dependencies = [ - "proc-macro2 1.0.18", + "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.33", - "unicode-xid 0.2.0", + "syn 1.0.36", + "unicode-xid 0.2.1", ] [[package]] @@ -1314,9 +1362,9 @@ version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793" dependencies = [ - "proc-macro2 1.0.18", + "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.33", + "syn 1.0.36", ] [[package]] @@ -1361,9 +1409,9 @@ checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" [[package]] name = "unicode-width" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479" +checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" [[package]] name = "unicode-xid" @@ -1373,9 +1421,9 @@ checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" [[package]] name = "unicode-xid" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "vec_map" @@ -1414,9 +1462,9 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "winapi" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ "winapi-i686-pc-windows-gnu", "winapi-x86_64-pc-windows-gnu", diff --git a/Cargo.toml b/Cargo.toml index 1fe7d4bb1d..c67ac68874 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,12 +20,12 @@ leo-compiler = { path = "compiler", version = "0.1.0" } leo-gadgets = { path = "gadgets", version = "0.1.0" } leo-inputs = { path = "leo-inputs", version = "0.1.0" } -snarkos-algorithms = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } -snarkos-curves = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } -snarkos-errors = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } -snarkos-gadgets = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } -snarkos-models = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } -snarkos-utilities = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9" } +snarkos-algorithms = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package = "snarkos-algorithms", default-features = false } +snarkos-curves = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package = "snarkos-curves", default-features = false } +snarkos-errors = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package = "snarkos-errors", default-features = false } +snarkos-gadgets = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package = "snarkos-gadgets", default-features = false } +snarkos-models = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package = "snarkos-models", default-features = false } +snarkos-utilities = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package = "snarkos-utilities" } clap = { version = "2.33.0" } colored = { version = "2.0" } diff --git a/compiler/Cargo.toml b/compiler/Cargo.toml index d40dc7f889..0f09d3189d 100644 --- a/compiler/Cargo.toml +++ b/compiler/Cargo.toml @@ -10,14 +10,13 @@ leo-gadgets = { path = "../gadgets", version = "0.1.0" } leo-inputs = { path = "../leo-inputs", version = "0.1.0" } leo-types = { path = "../types", version = "0.1.0" } -snarkos-curves = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } -snarkos-dpc = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } -snarkos-errors = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } -snarkos-gadgets = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } -snarkos-models = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } -snarkos-objects = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } -snarkos-utilities = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9" } - +snarkos-curves = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package = "snarkos-curves", default-features = false } +snarkos-dpc = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package = "snarkos-dpc", default-features = false } +snarkos-errors = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package = "snarkos-errors", default-features = false } +snarkos-gadgets = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package = "snarkos-gadgets", default-features = false } +snarkos-models = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package = "snarkos-models", default-features = false } +snarkos-objects = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package = "snarkos-objects", default-features = false } +snarkos-utilities = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package = "snarkos-utilities" } bincode = { version = "1.0" } hex = { version = "0.4.2" } diff --git a/compiler/src/value/address/address.rs b/compiler/src/value/address/address.rs index d4a53017b6..083c2c7c9a 100644 --- a/compiler/src/value/address/address.rs +++ b/compiler/src/value/address/address.rs @@ -14,17 +14,17 @@ use snarkos_models::{ }, }, }; -use snarkos_objects::account::AccountPublicKey; +use snarkos_objects::account::AccountAddress; use std::str::FromStr; /// A public address /// Addresses are currently constant values in the constraint system only #[derive(Clone, Debug, PartialEq, Eq)] -pub struct Address(pub Option>); +pub struct Address(pub Option>); impl Address { pub(crate) fn new(address: String, span: Span) -> Result { - let address = AccountPublicKey::from_str(&address).map_err(|error| AddressError::account_error(error, span))?; + let address = AccountAddress::from_str(&address).map_err(|error| AddressError::account_error(error, span))?; Ok(Address(Some(address))) } diff --git a/compiler/src/value/group/targets/edwards_bls12.rs b/compiler/src/value/group/targets/edwards_bls12.rs index f45a590291..a575c2a926 100644 --- a/compiler/src/value/group/targets/edwards_bls12.rs +++ b/compiler/src/value/group/targets/edwards_bls12.rs @@ -111,7 +111,20 @@ impl EdwardsGroupType { pub fn edwards_affine_from_str(string: String) -> Result { // x or (x, y) match Fq::from_str(&string).ok() { - Some(x) => EdwardsAffine::get_point_from_x(x, false).ok_or(SynthesisError::AssignmentMissing), + Some(x) => { + // Attempt to recover with a sign_low bit. + if let Some(element) = EdwardsAffine::from_x_coordinate(x.clone(), false) { + return Ok(element); + } + + // Attempt to recover with a sign_high bit. + if let Some(element) = EdwardsAffine::from_x_coordinate(x, true) { + return Ok(element); + } + + // Otherwise return error. + Err(SynthesisError::AssignmentMissing) + } None => EdwardsAffine::from_str(&string).map_err(|_| SynthesisError::AssignmentMissing), } } diff --git a/compiler/tests/address/mod.rs b/compiler/tests/address/mod.rs index de951e220c..34b9a67e64 100644 --- a/compiler/tests/address/mod.rs +++ b/compiler/tests/address/mod.rs @@ -10,7 +10,7 @@ use leo_compiler::{Address, ConstrainedValue}; use leo_types::InputValue; use snarkos_dpc::base_dpc::instantiated::Components; -use snarkos_objects::AccountPublicKey; +use snarkos_objects::AccountAddress; use std::str::FromStr; static TEST_ADDRESS_1: &'static str = "aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8"; @@ -19,7 +19,7 @@ static TEST_ADDRESS_2: &'static str = "aleo18qgam03qe483tdrcc3fkqwpp38ehff4a2xma fn output_test_address(program: EdwardsTestCompiler, address: &str) { let output = get_output(program); - let address_1 = AccountPublicKey::::from_str(address).unwrap(); + let address_1 = AccountAddress::::from_str(address).unwrap(); assert_eq!( EdwardsConstrainedValue::Return(vec![ConstrainedValue::Address(Address(Some(address_1)))]).to_string(), diff --git a/compiler/tests/field/mod.rs b/compiler/tests/field/mod.rs index 48aa04b1d6..456badc56b 100644 --- a/compiler/tests/field/mod.rs +++ b/compiler/tests/field/mod.rs @@ -360,8 +360,8 @@ fn test_ternary() { let b1 = BigInteger256::from(r1); let b2 = BigInteger256::from(r2); - let f1: Fq = Fq::from_repr(b1); - let f2: Fq = Fq::from_repr(b2); + let f1: Fq = Fq::from_repr(b1).unwrap(); + let f2: Fq = Fq::from_repr(b2).unwrap(); let mut cs = TestConstraintSystem::::new(); let g1 = FqGadget::from(cs.ns(|| "g1"), &f1); diff --git a/gadgets/Cargo.toml b/gadgets/Cargo.toml index ceb3eb2a2e..7fbba1cddf 100644 --- a/gadgets/Cargo.toml +++ b/gadgets/Cargo.toml @@ -5,12 +5,12 @@ authors = ["The Aleo Team "] edition = "2018" [dependencies] -snarkos-errors = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } -snarkos-models = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } +snarkos-errors = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package = "snarkos-errors", default-features = false } +snarkos-models = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package = "snarkos-models", default-features = false } rand = { version = "0.7", default-features = false } rand_xorshift = { version = "0.2", default-features = false } thiserror = { version = "1.0" } [dev-dependencies] -snarkos-utilities = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9" } \ No newline at end of file +snarkos-utilities = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package = "snarkos-utilities" } \ No newline at end of file diff --git a/gadgets/src/signed_integer/arithmetic/add.rs b/gadgets/src/signed_integer/arithmetic/add.rs index e2f2ae966b..2d3c83a6f7 100644 --- a/gadgets/src/signed_integer/arithmetic/add.rs +++ b/gadgets/src/signed_integer/arithmetic/add.rs @@ -32,7 +32,7 @@ macro_rules! add_int_impl { // Make some arbitrary bounds for ourselves to avoid overflows // in the scalar field - assert!(F::Params::MODULUS_BITS >= max_bits as u32); + assert!(F::Parameters::MODULUS_BITS >= max_bits as u32); // Accumulate the value let result_value = match (self.value, other.value) { diff --git a/gadgets/src/signed_integer/arithmetic/mul.rs b/gadgets/src/signed_integer/arithmetic/mul.rs index 7c8eeb6831..1a18bab4af 100644 --- a/gadgets/src/signed_integer/arithmetic/mul.rs +++ b/gadgets/src/signed_integer/arithmetic/mul.rs @@ -95,7 +95,7 @@ macro_rules! mul_int_impl { // Make some arbitrary bounds for ourselves to avoid overflows // in the scalar field - assert!(F::Params::MODULUS_BITS >= max_bits as u32); + assert!(F::Parameters::MODULUS_BITS >= max_bits as u32); // Accumulate the value let result_value = match (self.value, other.value) { diff --git a/leo-inputs/Cargo.toml b/leo-inputs/Cargo.toml index 8d4f212f42..886e87c321 100644 --- a/leo-inputs/Cargo.toml +++ b/leo-inputs/Cargo.toml @@ -5,11 +5,11 @@ authors = ["The Aleo Team "] edition = "2018" [dependencies] -snarkos-algorithms = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } -snarkos-curves = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } -snarkos-errors = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } -snarkos-gadgets = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } -snarkos-models = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } +snarkos-algorithms = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package = "snarkos-algorithms", default-features = false } +snarkos-curves = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package = "snarkos-curves", default-features = false } +snarkos-errors = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package = "snarkos-errors", default-features = false } +snarkos-gadgets = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package = "snarkos-gadgets", default-features = false } +snarkos-models = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package = "snarkos-models", default-features = false } from-pest = { version = "0.3.1" } pest = { version = "2.0" } diff --git a/leo/commands/build.rs b/leo/commands/build.rs index 79f3424a00..a3086931c3 100644 --- a/leo/commands/build.rs +++ b/leo/commands/build.rs @@ -7,7 +7,7 @@ use crate::{ }; use leo_compiler::{compiler::Compiler, group::targets::edwards_bls12::EdwardsGroupType}; -use snarkos_algorithms::snark::KeypairAssembly; +use snarkos_algorithms::snark::groth16::KeypairAssembly; use snarkos_curves::{bls12_377::Bls12_377, edwards_bls12::Fq}; use snarkos_models::gadgets::r1cs::ConstraintSystem; diff --git a/leo/commands/prove.rs b/leo/commands/prove.rs index 9fd9993e22..fa1a584ba1 100644 --- a/leo/commands/prove.rs +++ b/leo/commands/prove.rs @@ -6,8 +6,9 @@ use crate::{ files::{InputsFile, Manifest, ProofFile}, }; -use snarkos_algorithms::snark::{create_random_proof, PreparedVerifyingKey, Proof}; -use snarkos_curves::bls12_377::Bls12_377; +use snarkos_algorithms::snark::groth16::{Groth16, PreparedVerifyingKey, Proof}; +use snarkos_curves::bls12_377::{Bls12_377, Fr}; +use snarkos_models::algorithms::SNARK; use clap::ArgMatches; use rand::thread_rng; @@ -50,8 +51,9 @@ impl CLI for ProveCommand { let start = Instant::now(); let rng = &mut thread_rng(); - let program_proof = create_random_proof(program.clone(), ¶meters, rng)?; + let program_proof = Groth16::>::prove(¶meters, program, rng)?; + // Output the proving time log::info!("Prover completed in {:?} milliseconds", start.elapsed().as_millis()); // Write the proof file to the outputs directory diff --git a/leo/commands/run.rs b/leo/commands/run.rs index 8da207ac0a..5c0cf9eeae 100644 --- a/leo/commands/run.rs +++ b/leo/commands/run.rs @@ -1,6 +1,9 @@ use crate::{cli::*, cli_types::*, commands::ProveCommand, errors::CLIError}; +use leo_compiler::{compiler::Compiler, group::targets::edwards_bls12::EdwardsGroupType}; -use snarkos_algorithms::snark::verify_proof; +use snarkos_algorithms::snark::groth16::Groth16; +use snarkos_curves::bls12_377::{Bls12_377, Fr}; +use snarkos_models::algorithms::SNARK; use clap::ArgMatches; use std::time::{Duration, Instant}; @@ -32,7 +35,12 @@ impl CLI for RunCommand { let start = Instant::now(); - let is_success = verify_proof(&prepared_verifying_key, &proof, &vec![]).unwrap(); + let is_success = Groth16::, Vec>::verify( + &prepared_verifying_key, + &vec![], + &proof, + ) + .unwrap(); verifying += start.elapsed(); diff --git a/leo/commands/setup.rs b/leo/commands/setup.rs index 07bec850d7..09bbe16beb 100644 --- a/leo/commands/setup.rs +++ b/leo/commands/setup.rs @@ -3,14 +3,14 @@ use crate::{ cli_types::*, commands::BuildCommand, directories::SOURCE_DIRECTORY_NAME, - errors::{CLIError, RunError, VerificationKeyFileError}, + errors::{CLIError, RunError}, files::{Manifest, ProvingKeyFile, VerificationKeyFile, MAIN_FILE_NAME}, }; use leo_compiler::{compiler::Compiler, group::targets::edwards_bls12::EdwardsGroupType}; -use snarkos_algorithms::snark::{generate_random_parameters, prepare_verifying_key, Parameters, PreparedVerifyingKey}; -use snarkos_curves::{bls12_377::Bls12_377, edwards_bls12::Fq}; -use snarkos_utilities::bytes::ToBytes; +use snarkos_algorithms::snark::groth16::{Groth16, Parameters, PreparedVerifyingKey, VerifyingKey}; +use snarkos_curves::bls12_377::{Bls12_377, Fr}; +use snarkos_models::algorithms::snark::SNARK; use clap::ArgMatches; use rand::thread_rng; @@ -22,7 +22,7 @@ pub struct SetupCommand; impl CLI for SetupCommand { type Options = (); type Output = ( - Compiler, + Compiler, Parameters, PreparedVerifyingKey, ); @@ -53,7 +53,7 @@ impl CLI for SetupCommand { // If keys do not exist or the checksum differs, run the program setup // If keys do not exist or the checksum differs, run the program setup - if !keys_exist || checksum_differs { + let (proving_key, prepared_verifying_key) = if !keys_exist || checksum_differs { log::info!("Setup starting..."); // Start the timer @@ -61,57 +61,46 @@ impl CLI for SetupCommand { // Run the program setup operation let rng = &mut thread_rng(); - let parameters = generate_random_parameters::(program.clone(), rng).unwrap(); - let prepared_verifying_key = prepare_verifying_key::(¶meters.vk); + let (proving_key, prepared_verifying_key) = + Groth16::, Vec>::setup(program.clone(), rng).unwrap(); - // End the timer - let end = start.elapsed().as_millis(); + // Output the setup time + log::info!("Setup completed in {:?} milliseconds", start.elapsed().as_millis()); // TODO (howardwu): Convert parameters to a 'proving key' struct for serialization. // Write the proving key file to the outputs directory - let mut proving_key = vec![]; - parameters.write(&mut proving_key)?; - ProvingKeyFile::new(&package_name).write_to(&path, &proving_key)?; + let mut proving_key_bytes = vec![]; + proving_key.write(&mut proving_key_bytes)?; + ProvingKeyFile::new(&package_name).write_to(&path, &proving_key_bytes)?; log::info!("Saving proving key ({:?})", path); // Write the verification key file to the outputs directory let mut verification_key = vec![]; - prepared_verifying_key.write(&mut verification_key)?; + proving_key.vk.write(&mut verification_key)?; VerificationKeyFile::new(&package_name).write_to(&path, &verification_key)?; log::info!("Saving verification key ({:?})", path); - // Output the setup time - log::info!("Setup completed in {:?} milliseconds", end); + (proving_key, prepared_verifying_key) } else { - log::info!("Setup complete"); - } + log::info!("Loading saved setup..."); - // Read the proving key file from the outputs directory - let proving_key = ProvingKeyFile::new(&package_name).read_from(&path)?; - let parameters = Parameters::::read(proving_key.as_slice(), true)?; + // Read the proving key file from the outputs directory + let proving_key_bytes = ProvingKeyFile::new(&package_name).read_from(&path)?; + let proving_key = Parameters::::read(proving_key_bytes.as_slice(), true)?; - // Read the proving key file from the outputs directory - let prepared_verifying_key = prepare_verifying_key::(¶meters.vk); - { - // Load the stored verification key from the outputs directory - let stored_vk = VerificationKeyFile::new(&package_name).read_from(&path)?; + // Read the verification key file from the outputs directory + let verifying_key_bytes = VerificationKeyFile::new(&package_name).read_from(&path)?; + let verifying_key = VerifyingKey::::read(verifying_key_bytes.as_slice())?; - // Convert the prepared_verifying_key to a buffer - let mut verification_key = vec![]; - prepared_verifying_key.write(&mut verification_key)?; + // Derive the prepared verifying key file from the verifying key + let prepared_verifying_key = PreparedVerifyingKey::::from(verifying_key); - // Check that the constructed prepared verification key matches the stored verification key - let compare: Vec<(u8, u8)> = verification_key.into_iter().zip(stored_vk.into_iter()).collect(); - for (a, b) in compare { - if a != b { - return Err(VerificationKeyFileError::IncorrectVerificationKey.into()); - } - } - } + (proving_key, prepared_verifying_key) + }; log::info!("Program setup complete"); - Ok((program, parameters, prepared_verifying_key)) + Ok((program, proving_key, prepared_verifying_key)) } None => { let mut main_file_path = path.clone(); diff --git a/leo/errors/cli.rs b/leo/errors/cli.rs index 1beb8fc84c..f8ef8f4d46 100644 --- a/leo/errors/cli.rs +++ b/leo/errors/cli.rs @@ -3,187 +3,64 @@ use crate::errors::*; #[derive(Debug, Error)] pub enum CLIError { #[error("{}", _0)] - BuildError(BuildError), + BuildError(#[from] BuildError), #[error("{}", _0)] - BytesFileError(ZipFileError), + BytesFileError(#[from] ZipFileError), #[error("{}: {}", _0, _1)] Crate(&'static str, String), #[error("{}", _0)] - ChecksumFileError(ChecksumFileError), + ChecksumFileError(#[from] ChecksumFileError), #[error("{}", _0)] - GitignoreError(GitignoreError), + GitignoreError(#[from] GitignoreError), #[error("{}", _0)] - InitError(InitError), + InitError(#[from] InitError), #[error("{}", _0)] - InputsDirectoryError(InputsDirectoryError), + InputsDirectoryError(#[from] InputsDirectoryError), #[error("{}", _0)] - InputsFileError(InputsFileError), + InputsFileError(#[from] InputsFileError), #[error("{}", _0)] - LibFileError(LibFileError), + LibFileError(#[from] LibFileError), #[error("{}", _0)] - MainFileError(MainFileError), + MainFileError(#[from] MainFileError), #[error("{}", _0)] - ManifestError(ManifestError), + ManifestError(#[from] ManifestError), #[error("{}", _0)] - NewError(NewError), + NewError(#[from] NewError), #[error("{}", _0)] - OutputsDirectoryError(OutputsDirectoryError), + OutputsDirectoryError(#[from] OutputsDirectoryError), #[error("{}", _0)] - ProofFileError(ProofFileError), + ProofFileError(#[from] ProofFileError), #[error("{}", _0)] - ProvingKeyFileError(ProvingKeyFileError), + ProvingKeyFileError(#[from] ProvingKeyFileError), #[error("{}", _0)] - RunError(RunError), + RunError(#[from] RunError), #[error("{}", _0)] - SourceDirectoryError(SourceDirectoryError), + SNARKError(#[from] snarkos_errors::algorithms::snark::SNARKError), #[error("{}", _0)] - TestError(TestError), + SourceDirectoryError(#[from] SourceDirectoryError), #[error("{}", _0)] - VerificationKeyFileError(VerificationKeyFileError), -} + TestError(#[from] TestError), -impl From for CLIError { - fn from(error: ZipFileError) -> Self { - log::error!("{}\n", error); - CLIError::BytesFileError(error) - } -} - -impl From for CLIError { - fn from(error: BuildError) -> Self { - log::error!("{}\n", error); - CLIError::BuildError(error) - } -} - -impl From for CLIError { - fn from(error: ChecksumFileError) -> Self { - log::error!("{}\n", error); - CLIError::ChecksumFileError(error) - } -} - -impl From for CLIError { - fn from(error: GitignoreError) -> Self { - log::error!("{}\n", error); - CLIError::GitignoreError(error) - } -} - -impl From for CLIError { - fn from(error: InitError) -> Self { - log::error!("{}\n", error); - CLIError::InitError(error) - } -} - -impl From for CLIError { - fn from(error: InputsDirectoryError) -> Self { - log::error!("{}\n", error); - CLIError::InputsDirectoryError(error) - } -} - -impl From for CLIError { - fn from(error: InputsFileError) -> Self { - log::error!("{}\n", error); - CLIError::InputsFileError(error) - } -} - -impl From for CLIError { - fn from(error: LibFileError) -> Self { - log::error!("{}\n", error); - CLIError::LibFileError(error) - } -} - -impl From for CLIError { - fn from(error: MainFileError) -> Self { - log::error!("{}\n", error); - CLIError::MainFileError(error) - } -} - -impl From for CLIError { - fn from(error: ManifestError) -> Self { - log::error!("{}\n", error); - CLIError::ManifestError(error) - } -} - -impl From for CLIError { - fn from(error: NewError) -> Self { - log::error!("{}\n", error); - CLIError::NewError(error) - } -} - -impl From for CLIError { - fn from(error: OutputsDirectoryError) -> Self { - log::error!("{}\n", error); - CLIError::OutputsDirectoryError(error) - } -} - -impl From for CLIError { - fn from(error: ProofFileError) -> Self { - log::error!("{}\n", error); - CLIError::ProofFileError(error) - } -} - -impl From for CLIError { - fn from(error: ProvingKeyFileError) -> Self { - log::error!("{}\n", error); - CLIError::ProvingKeyFileError(error) - } -} - -impl From for CLIError { - fn from(error: RunError) -> Self { - log::error!("{}\n", error); - CLIError::RunError(error) - } -} - -impl From for CLIError { - fn from(error: SourceDirectoryError) -> Self { - log::error!("{}\n", error); - CLIError::SourceDirectoryError(error) - } -} - -impl From for CLIError { - fn from(error: TestError) -> Self { - log::error!("{}\n", error); - CLIError::TestError(error) - } -} - -impl From for CLIError { - fn from(error: VerificationKeyFileError) -> Self { - log::error!("{}\n", error); - CLIError::VerificationKeyFileError(error) - } + #[error("{}", _0)] + VerificationKeyFileError(#[from] VerificationKeyFileError), } impl From for CLIError { diff --git a/types/Cargo.toml b/types/Cargo.toml index 354a3b92e0..19f0afcad2 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -8,8 +8,8 @@ edition = "2018" leo-ast = { path = "../ast", version = "0.1.0" } leo-inputs = { path = "../leo-inputs", version = "0.1.0" } -snarkos-errors = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } -snarkos-models = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", rev = "c7a56d9", default-features = false } +snarkos-errors = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package = "snarkos-errors", default-features = false } +snarkos-models = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package = "snarkos-models", default-features = false } pest = { version = "2.0" } serde = { version = "1.0" }