mirror of
https://github.com/AleoHQ/leo.git
synced 2024-11-28 19:23:24 +03:00
merge in field operator updates
This commit is contained in:
commit
768a597e04
355
Cargo.lock
generated
355
Cargo.lock
generated
@ -9,7 +9,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96e669320c520d87931e752d603dd442b4709c73b1b8b1fcba838f9c5acc1791"
|
||||
dependencies = [
|
||||
"abnf-core",
|
||||
"nom 6.1.2",
|
||||
"nom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -18,7 +18,7 @@ version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b514944cb7199c4201f54406bc58676a3e4f37d40bf8e3dbe30652ca82e3ddb4"
|
||||
dependencies = [
|
||||
"nom 6.1.2",
|
||||
"nom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -83,9 +83,9 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
|
||||
|
||||
[[package]]
|
||||
name = "assert_cmd"
|
||||
version = "1.0.3"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2475b58cd94eb4f70159f4fd8844ba3b807532fe3131b3373fae060bbe30396"
|
||||
checksum = "8f57fec1ac7e4de72dcc69811795f1a7172ed06012f80a5d1ee651b62484f588"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"doc-comment",
|
||||
@ -140,9 +140,9 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
|
||||
|
||||
[[package]]
|
||||
name = "bech32"
|
||||
version = "0.6.0"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "58946044516aa9dc922182e0d6e9d124a31aafe6b421614654eb27cf90cec09c"
|
||||
checksum = "6c7f7096bc256f5e5cb960f60dfc4f4ef979ca65abe7fb9d5a4f77150d3783d4"
|
||||
|
||||
[[package]]
|
||||
name = "bincode"
|
||||
@ -153,30 +153,6 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bindgen"
|
||||
version = "0.54.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "66c0bb6167449588ff70803f4127f0684f9063097eca5016f37eb52b92c2cf36"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cexpr",
|
||||
"cfg-if 0.1.10",
|
||||
"clang-sys",
|
||||
"clap",
|
||||
"env_logger",
|
||||
"lazy_static",
|
||||
"lazycell",
|
||||
"log",
|
||||
"peeking_take_while",
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.9",
|
||||
"regex",
|
||||
"rustc-hash",
|
||||
"shlex",
|
||||
"which",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.2.1"
|
||||
@ -307,18 +283,6 @@ name = "cc"
|
||||
version = "1.0.67"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd"
|
||||
dependencies = [
|
||||
"jobserver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cexpr"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27"
|
||||
dependencies = [
|
||||
"nom 5.1.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
@ -355,17 +319,6 @@ dependencies = [
|
||||
"envmnt",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clang-sys"
|
||||
version = "0.29.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fe6837df1d5cba2397b835c8530f51723267e16abbf83892e9e5af4f0e5dd10a"
|
||||
dependencies = [
|
||||
"glob",
|
||||
"libc",
|
||||
"libloading",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.33.3"
|
||||
@ -425,9 +378,12 @@ checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b"
|
||||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5cd5a7748210e7ec1a9696610b1015e6e31fbf58f77a160801f124bd1c36592a"
|
||||
checksum = "dec1028182c380cc45a2e2c5ec841134f2dfd0f8f5f0a5bcd68004f81b5efdf4"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crc32fast"
|
||||
@ -551,36 +507,6 @@ dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "curl"
|
||||
version = "0.4.35"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a872858e9cb9e3b96c80dd78774ad9e32e44d3b05dc31e142b858d14aebc82c"
|
||||
dependencies = [
|
||||
"curl-sys",
|
||||
"libc",
|
||||
"openssl-probe",
|
||||
"openssl-sys",
|
||||
"schannel",
|
||||
"socket2",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "curl-sys"
|
||||
version = "0.4.41+curl-7.75.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ec466abd277c7cab2905948f3e94d10bc4963f1f5d47921c1cc4ffd2028fe65"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
"libz-sys",
|
||||
"openssl-sys",
|
||||
"pkg-config",
|
||||
"vcpkg",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derivative"
|
||||
version = "2.2.0"
|
||||
@ -669,19 +595,6 @@ dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"humantime",
|
||||
"log",
|
||||
"regex",
|
||||
"termcolor",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "envmnt"
|
||||
version = "0.8.4"
|
||||
@ -955,12 +868,6 @@ version = "0.23.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce"
|
||||
|
||||
[[package]]
|
||||
name = "glob"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
|
||||
|
||||
[[package]]
|
||||
name = "h2"
|
||||
version = "0.3.0"
|
||||
@ -1050,15 +957,6 @@ version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47"
|
||||
|
||||
[[package]]
|
||||
name = "humantime"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
|
||||
dependencies = [
|
||||
"quick-error",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "0.14.4"
|
||||
@ -1150,15 +1048,6 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "instant"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iovec"
|
||||
version = "0.1.4"
|
||||
@ -1207,15 +1096,6 @@ version = "0.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
|
||||
|
||||
[[package]]
|
||||
name = "jobserver"
|
||||
version = "0.1.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c71313ebb9439f74b00d9d2dcec36440beaf57a6aa0623068441dd7cd81a7f2"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.47"
|
||||
@ -1444,7 +1324,6 @@ dependencies = [
|
||||
"snarkvm-algorithms",
|
||||
"snarkvm-curves",
|
||||
"snarkvm-dpc",
|
||||
"snarkvm-storage",
|
||||
"snarkvm-utilities",
|
||||
"thiserror",
|
||||
]
|
||||
@ -1492,55 +1371,12 @@ version = "0.2.89"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "538c092e5586f4cdd7dd8078c4a79220e3e168880218124dcbce860f0ea938c6"
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "librocksdb-sys"
|
||||
version = "6.11.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eb5b56f651c204634b936be2f92dbb42c36867e00ff7fe2405591f3b9fa66f09"
|
||||
dependencies = [
|
||||
"bindgen",
|
||||
"cc",
|
||||
"glob",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libz-sys"
|
||||
version = "1.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "602113192b08db8f38796c4e85c39e960c145965140e918018bcde1952429655"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
"pkg-config",
|
||||
"vcpkg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "linked-hash-map"
|
||||
version = "0.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd96ffd135b2fd7b973ac026d28085defbe8983df057ced3eb4f2130b0831312"
|
||||
dependencies = [
|
||||
"scopeguard",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.14"
|
||||
@ -1734,16 +1570,6 @@ version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab250442c86f1850815b5d268639dff018c0627022bc1940eb2d642ca1ce12f0"
|
||||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "5.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "6.1.2"
|
||||
@ -1759,9 +1585,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "notify"
|
||||
version = "4.0.16"
|
||||
version = "4.0.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2599080e87c9bd051ddb11b10074f4da7b1223298df65d4c2ec5bcf309af1533"
|
||||
checksum = "ae03c8c853dba7bfd23e571ff0cff7bc9dceb40a4cd684cd1681824183f45257"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"filetime",
|
||||
@ -1893,37 +1719,6 @@ dependencies = [
|
||||
"vcpkg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb"
|
||||
dependencies = [
|
||||
"instant",
|
||||
"lock_api",
|
||||
"parking_lot_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot_core"
|
||||
version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"instant",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"smallvec",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "peeking_take_while"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
|
||||
|
||||
[[package]]
|
||||
name = "percent-encoding"
|
||||
version = "2.1.0"
|
||||
@ -2135,12 +1930,6 @@ dependencies = [
|
||||
"unicode-xid 0.2.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quick-error"
|
||||
version = "1.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
|
||||
|
||||
[[package]]
|
||||
name = "quick-xml"
|
||||
version = "0.20.0"
|
||||
@ -2380,28 +2169,12 @@ dependencies = [
|
||||
"winreg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rocksdb"
|
||||
version = "0.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23d83c02c429044d58474eaf5ae31e062d0de894e21125b47437ec0edc1397e6"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"librocksdb-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-demangle"
|
||||
version = "0.1.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e3bad0ee36814ca07d7968269dd4b7ec89ec2da10c4bb613928d3077083c232"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.2.3"
|
||||
@ -2539,9 +2312,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.125"
|
||||
version = "1.0.126"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171"
|
||||
checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
@ -2558,9 +2331,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.125"
|
||||
version = "1.0.126"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d"
|
||||
checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.9",
|
||||
@ -2616,9 +2389,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "sha2"
|
||||
version = "0.9.4"
|
||||
version = "0.9.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d8f6b75b17576b792bef0db1bcc4b8b8bcdf9506744cf34b974195487af6cff2"
|
||||
checksum = "b362ae5752fd2137731f9fa25fd4d9058af34666ca1966fb969119cc35719f12"
|
||||
dependencies = [
|
||||
"block-buffer 0.9.0",
|
||||
"cfg-if 1.0.0",
|
||||
@ -2636,12 +2409,6 @@ dependencies = [
|
||||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "shlex"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
|
||||
|
||||
[[package]]
|
||||
name = "single"
|
||||
version = "1.0.0"
|
||||
@ -2665,9 +2432,9 @@ checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-algorithms"
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bdf8ca73d429824090b96f751846e37e539f24c527f1f1ce0254984ade6d17b2"
|
||||
checksum = "99f8349fad4f4e9a05ab4fde6baa99aad8542fcaf10320128114fdc26798a0ad"
|
||||
dependencies = [
|
||||
"blake2",
|
||||
"derivative",
|
||||
@ -2688,9 +2455,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-curves"
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "64610b135b8b1152439d5dfa4f745515933366082f08651961344aa0bb5abfca"
|
||||
checksum = "3a8f71e6243e588507a7935512bcd79e28906ad89553671151eaf721e42b1513"
|
||||
dependencies = [
|
||||
"derivative",
|
||||
"rand 0.8.3",
|
||||
@ -2704,9 +2471,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-derives"
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "46c9829b6e2023b4c7c4d6c55e88fe755dd997171a6c9c063b75c28161d04326"
|
||||
checksum = "d1b3ad83bcd981531a29e8e70bac4cf34126b1031f42bc529975a46e49100383"
|
||||
dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro-error",
|
||||
@ -2717,9 +2484,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-dpc"
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "491ae936e24e17c358d112ff8638b260500b5a982ecefc804861e28b5279f552"
|
||||
checksum = "54268e972e18e7a1508418f29fe3f64201f86acf2131ed28b1bc9f8891fc1bbb"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base58",
|
||||
@ -2743,9 +2510,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-fields"
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c49c69d02df11be58e07f626c9d6f5804c6dd4ccf42e425f2be8d79fe6e5bb7"
|
||||
checksum = "04b885226e300d6a237905038fba681eaa2a851e5cb45a22b685c0bc87c574b6"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"derivative",
|
||||
@ -2758,9 +2525,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-gadgets"
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd6f9ac2a166d926e1755a06fdae21ce40ce6164c75c89120401b8d78f3b7ba4"
|
||||
checksum = "0322e4fd5fe0b0b7499a6b1dbd47d20cf65e0904a23094ba087662253ed60ff0"
|
||||
dependencies = [
|
||||
"derivative",
|
||||
"digest 0.9.0",
|
||||
@ -2775,9 +2542,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-objects"
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9bd9779ec6ab9211f34a6ba25566feb575a396f4c41cc0e002ec2d48d7560a2a"
|
||||
checksum = "345b2dd86a3d036d09608e7493c7a14bf17a59648e567cd08414d2520a627d07"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bincode",
|
||||
@ -2796,11 +2563,10 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-parameters"
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "98378f612206fc7dd44a26f4e345bd1f3ba51bd325acad1e5cc3785d14750ec5"
|
||||
checksum = "7932c7d7fd7b9572a1acaad3c9622f6849c414e5ac8bdb599a504ef4330bb857"
|
||||
dependencies = [
|
||||
"curl",
|
||||
"hex",
|
||||
"snarkvm-algorithms",
|
||||
"snarkvm-utilities",
|
||||
@ -2809,15 +2575,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-profiler"
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2460ac01c25f79f5ea306e4de82a1d4105e811f868206b4fd31c0c9b62a3d7b"
|
||||
checksum = "877f7ee215903aa4da2343f6d82fd5ec7426210a33f4773770ab35dbdddd3bd9"
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-r1cs"
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a3a0d54b15802976aff7522765dd29d5733f338612449629cc57c5a4a4d51f05"
|
||||
checksum = "f5695a57009b1b79f32df22d88f5d5dabf7a84f6a953280896ae4edb8b9db76d"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"fxhash",
|
||||
@ -2828,32 +2594,11 @@ dependencies = [
|
||||
"snarkvm-utilities",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-storage"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d76881939f008d7bba4c8cc4118d29567b5c71908ad66bef9880f8aa7c52881"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bincode",
|
||||
"hex",
|
||||
"parking_lot",
|
||||
"rand 0.8.3",
|
||||
"rocksdb",
|
||||
"serde",
|
||||
"snarkvm-algorithms",
|
||||
"snarkvm-dpc",
|
||||
"snarkvm-objects",
|
||||
"snarkvm-parameters",
|
||||
"snarkvm-utilities",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-utilities"
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c763843fa67a3aa4ce68173c8cd96b4f04aaa135a5792bc051c36eec0fe1cd73"
|
||||
checksum = "996ba23293c9288d983003c224450db8a6acd875f9fe7f6d839ab91897023b5b"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"rand 0.8.3",
|
||||
@ -2979,15 +2724,6 @@ dependencies = [
|
||||
"utf-8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
|
||||
dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "terminal_size"
|
||||
version = "0.1.16"
|
||||
@ -3462,15 +3198,6 @@ dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "which"
|
||||
version = "3.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.2.8"
|
||||
|
14
Cargo.toml
14
Cargo.toml
@ -70,22 +70,22 @@ path = "./synthesizer"
|
||||
version = "1.4.0"
|
||||
|
||||
[dependencies.snarkvm-algorithms]
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
|
||||
[dependencies.snarkvm-curves]
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-gadgets]
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-r1cs]
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-utilities]
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
|
||||
[dependencies.anyhow]
|
||||
version = "1.0"
|
||||
@ -112,7 +112,7 @@ version = "0.3.1"
|
||||
version = "1.4.0"
|
||||
|
||||
[dependencies.notify]
|
||||
version = "4.0.16"
|
||||
version = "4.0.17"
|
||||
|
||||
[dependencies.rand]
|
||||
version = "0.8"
|
||||
@ -158,7 +158,7 @@ version = "0.12.1"
|
||||
version = "0.11.2"
|
||||
|
||||
[dev-dependencies.assert_cmd]
|
||||
version = "1.0.3"
|
||||
version = "1.0.4"
|
||||
|
||||
[dev-dependencies.test_dir]
|
||||
version = "0.1.0"
|
||||
|
@ -57,27 +57,27 @@ version = "1.4.0"
|
||||
version = "0.4"
|
||||
|
||||
[dependencies.snarkvm-curves]
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-fields]
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-dpc]
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-gadgets]
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-r1cs]
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-utilities]
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
|
||||
[dependencies.bincode]
|
||||
version = "1.3"
|
||||
@ -118,7 +118,7 @@ version = "0.3"
|
||||
default-features = false
|
||||
|
||||
[dev-dependencies.snarkvm-algorithms]
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
default-features = false
|
||||
|
||||
[dev-dependencies.tempfile]
|
||||
|
@ -44,9 +44,9 @@ impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
ConstValue::Address(value) => ConstrainedValue::Address(Address::constant(value.to_string(), span)?),
|
||||
ConstValue::Boolean(value) => ConstrainedValue::Boolean(Boolean::Constant(*value)),
|
||||
ConstValue::Char(value) => {
|
||||
ConstrainedValue::Char(Char::constant(*value, format!("{}", *value as u32), span)?)
|
||||
ConstrainedValue::Char(Char::constant(cs, *value, format!("{}", *value as u32), span)?)
|
||||
}
|
||||
ConstValue::Field(value) => ConstrainedValue::Field(FieldType::constant(value.to_string(), span)?),
|
||||
ConstValue::Field(value) => ConstrainedValue::Field(FieldType::constant(cs, value.to_string(), span)?),
|
||||
ConstValue::Group(value) => ConstrainedValue::Group(G::constant(value, span)?),
|
||||
ConstValue::Int(value) => ConstrainedValue::Integer(Integer::new(value)),
|
||||
ConstValue::Tuple(values) => ConstrainedValue::Tuple(
|
||||
|
@ -72,7 +72,7 @@ impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
pub fn constant_main_function_input<CS: ConstraintSystem<F>>(
|
||||
&mut self,
|
||||
_cs: &mut CS,
|
||||
cs: &mut CS,
|
||||
type_: &Type,
|
||||
name: &str,
|
||||
input_option: Option<InputValue>,
|
||||
@ -84,11 +84,14 @@ impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
(Type::Address, InputValue::Address(addr)) => Ok(ConstrainedValue::Address(Address::constant(addr, span)?)),
|
||||
(Type::Boolean, InputValue::Boolean(value)) => Ok(ConstrainedValue::Boolean(Boolean::constant(value))),
|
||||
(Type::Char, InputValue::Char(character)) => Ok(ConstrainedValue::Char(Char::constant(
|
||||
cs,
|
||||
character,
|
||||
format!("{}", character as u32),
|
||||
span,
|
||||
)?)),
|
||||
(Type::Field, InputValue::Field(value)) => Ok(ConstrainedValue::Field(FieldType::constant(value, span)?)),
|
||||
(Type::Field, InputValue::Field(value)) => {
|
||||
Ok(ConstrainedValue::Field(FieldType::constant(cs, value, span)?))
|
||||
}
|
||||
(Type::Group, InputValue::Group(value)) => Ok(ConstrainedValue::Group(G::constant(&value.into(), span)?)),
|
||||
(Type::Integer(integer_type), InputValue::Integer(_, value)) => Ok(ConstrainedValue::Integer(
|
||||
Integer::new(&ConstInt::parse(integer_type, &value, span)?),
|
||||
@ -105,7 +108,7 @@ impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
Ok(ConstrainedValue::Array(
|
||||
values
|
||||
.iter()
|
||||
.map(|x| self.constant_main_function_input(_cs, type_, name, Some(x.clone()), span))
|
||||
.map(|x| self.constant_main_function_input(cs, type_, name, Some(x.clone()), span))
|
||||
.collect::<Result<Vec<_>, _>>()?,
|
||||
))
|
||||
}
|
||||
@ -117,10 +120,7 @@ impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
Ok(ConstrainedValue::Tuple(
|
||||
values
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(i, x)| {
|
||||
self.constant_main_function_input(_cs, types.get(i).unwrap(), name, Some(x.clone()), span)
|
||||
})
|
||||
.map(|x| self.constant_main_function_input(cs, type_, name, Some(x.clone()), span))
|
||||
.collect::<Result<Vec<_>, _>>()?,
|
||||
))
|
||||
}
|
||||
|
@ -42,10 +42,15 @@ pub struct Char<F: PrimeField> {
|
||||
}
|
||||
|
||||
impl<F: PrimeField> Char<F> {
|
||||
pub fn constant(character: char, field: String, span: &Span) -> Result<Self, CharError> {
|
||||
pub fn constant<CS: ConstraintSystem<F>>(
|
||||
cs: CS,
|
||||
character: char,
|
||||
field: String,
|
||||
span: &Span,
|
||||
) -> Result<Self, CharError> {
|
||||
Ok(Self {
|
||||
character,
|
||||
field: FieldType::constant(field, span)?,
|
||||
field: FieldType::constant(cs, field, span)?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ use leo_ast::Span;
|
||||
|
||||
use snarkvm_fields::PrimeField;
|
||||
use snarkvm_gadgets::{
|
||||
fields::{AllocatedFp, FpGadget},
|
||||
fields::FpGadget,
|
||||
traits::{
|
||||
fields::FieldGadget,
|
||||
utilities::{
|
||||
@ -38,130 +38,84 @@ use snarkvm_gadgets::{
|
||||
};
|
||||
use snarkvm_r1cs::{ConstraintSystem, SynthesisError};
|
||||
|
||||
use snarkvm_gadgets::utilities::eq::NEqGadget;
|
||||
use std::{borrow::Borrow, cmp::Ordering};
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum FieldType<F: PrimeField> {
|
||||
Constant(F),
|
||||
Allocated(FpGadget<F>),
|
||||
}
|
||||
pub struct FieldType<F: PrimeField>(FpGadget<F>);
|
||||
|
||||
impl<F: PrimeField> FieldType<F> {
|
||||
/// Returns the value of the field.
|
||||
pub fn get_value(&self) -> Option<F> {
|
||||
match self {
|
||||
FieldType::Constant(field) => Some(*field),
|
||||
FieldType::Allocated(gadget) => gadget.get_value(),
|
||||
}
|
||||
self.0.get_value()
|
||||
}
|
||||
|
||||
pub fn constant(string: String, span: &Span) -> Result<Self, FieldError> {
|
||||
/// Returns a new `FieldType` from the given `String` or returns a `FieldError`.
|
||||
pub fn constant<CS: ConstraintSystem<F>>(cs: CS, string: String, span: &Span) -> Result<Self, FieldError> {
|
||||
let number_info = number_string_typing(&string);
|
||||
|
||||
let value = match number_info {
|
||||
(number, neg) if neg => -F::from_str(&number).map_err(|_| FieldError::invalid_field(string, span))?,
|
||||
(number, _) => F::from_str(&number).map_err(|_| FieldError::invalid_field(string, span))?,
|
||||
(number, neg) if neg => {
|
||||
-F::from_str(&number).map_err(|_| FieldError::invalid_field(string.clone(), span))?
|
||||
}
|
||||
(number, _) => F::from_str(&number).map_err(|_| FieldError::invalid_field(string.clone(), span))?,
|
||||
};
|
||||
|
||||
Ok(FieldType::Constant(value))
|
||||
let value = FpGadget::alloc_constant(cs, || Ok(value)).map_err(|_| FieldError::invalid_field(string, span))?;
|
||||
|
||||
Ok(FieldType(value))
|
||||
}
|
||||
|
||||
/// Returns a new `FieldType` by calling the `FpGadget` `negate` function.
|
||||
pub fn negate<CS: ConstraintSystem<F>>(&self, cs: CS, span: &Span) -> Result<Self, FieldError> {
|
||||
match self {
|
||||
FieldType::Constant(field) => Ok(FieldType::Constant(field.neg())),
|
||||
FieldType::Allocated(field) => {
|
||||
let result = field.negate(cs).map_err(|e| FieldError::negate_operation(e, span))?;
|
||||
let result = self.0.negate(cs).map_err(|e| FieldError::negate_operation(e, span))?;
|
||||
|
||||
Ok(FieldType::Allocated(result))
|
||||
}
|
||||
}
|
||||
Ok(FieldType(result))
|
||||
}
|
||||
|
||||
/// Returns a new `FieldType` by calling the `FpGadget` `add` function.
|
||||
pub fn add<CS: ConstraintSystem<F>>(&self, cs: CS, other: &Self, span: &Span) -> Result<Self, FieldError> {
|
||||
match (self, other) {
|
||||
(FieldType::Constant(self_value), FieldType::Constant(other_value)) => {
|
||||
Ok(FieldType::Constant(self_value.add(other_value)))
|
||||
}
|
||||
let value = self
|
||||
.0
|
||||
.add(cs, &other.0)
|
||||
.map_err(|e| FieldError::binary_operation("+".to_string(), e, span))?;
|
||||
|
||||
(FieldType::Allocated(self_value), FieldType::Allocated(other_value)) => {
|
||||
let result = self_value
|
||||
.add(cs, other_value)
|
||||
.map_err(|e| FieldError::binary_operation("+".to_string(), e, span))?;
|
||||
|
||||
Ok(FieldType::Allocated(result))
|
||||
}
|
||||
|
||||
(FieldType::Constant(constant_value), FieldType::Allocated(allocated_value))
|
||||
| (FieldType::Allocated(allocated_value), FieldType::Constant(constant_value)) => Ok(FieldType::Allocated(
|
||||
allocated_value
|
||||
.add_constant(cs, constant_value)
|
||||
.map_err(|e| FieldError::binary_operation("+".to_string(), e, span))?,
|
||||
)),
|
||||
}
|
||||
Ok(FieldType(value))
|
||||
}
|
||||
|
||||
/// Returns a new `FieldType` by calling the `FpGadget` `sub` function.
|
||||
pub fn sub<CS: ConstraintSystem<F>>(&self, cs: CS, other: &Self, span: &Span) -> Result<Self, FieldError> {
|
||||
match (self, other) {
|
||||
(FieldType::Constant(self_value), FieldType::Constant(other_value)) => {
|
||||
Ok(FieldType::Constant(self_value.sub(other_value)))
|
||||
}
|
||||
let value = self
|
||||
.0
|
||||
.sub(cs, &other.0)
|
||||
.map_err(|e| FieldError::binary_operation("-".to_string(), e, span))?;
|
||||
|
||||
(FieldType::Allocated(self_value), FieldType::Allocated(other_value)) => {
|
||||
let result = self_value
|
||||
.sub(cs, other_value)
|
||||
.map_err(|e| FieldError::binary_operation("-".to_string(), e, span))?;
|
||||
|
||||
Ok(FieldType::Allocated(result))
|
||||
}
|
||||
|
||||
(FieldType::Constant(constant_value), FieldType::Allocated(allocated_value))
|
||||
| (FieldType::Allocated(allocated_value), FieldType::Constant(constant_value)) => Ok(FieldType::Allocated(
|
||||
allocated_value
|
||||
.sub_constant(cs, constant_value)
|
||||
.map_err(|e| FieldError::binary_operation("+".to_string(), e, span))?,
|
||||
)),
|
||||
}
|
||||
Ok(FieldType(value))
|
||||
}
|
||||
|
||||
/// Returns a new `FieldType` by calling the `FpGadget` `mul` function.
|
||||
pub fn mul<CS: ConstraintSystem<F>>(&self, cs: CS, other: &Self, span: &Span) -> Result<Self, FieldError> {
|
||||
match (self, other) {
|
||||
(FieldType::Constant(self_value), FieldType::Constant(other_value)) => {
|
||||
Ok(FieldType::Constant(self_value.mul(other_value)))
|
||||
}
|
||||
let value = self
|
||||
.0
|
||||
.mul(cs, &other.0)
|
||||
.map_err(|e| FieldError::binary_operation("*".to_string(), e, span))?;
|
||||
|
||||
(FieldType::Allocated(self_value), FieldType::Allocated(other_value)) => {
|
||||
let result = self_value
|
||||
.mul(cs, other_value)
|
||||
.map_err(|e| FieldError::binary_operation("*".to_string(), e, span))?;
|
||||
|
||||
Ok(FieldType::Allocated(result))
|
||||
}
|
||||
|
||||
(FieldType::Constant(constant_value), FieldType::Allocated(allocated_value))
|
||||
| (FieldType::Allocated(allocated_value), FieldType::Constant(constant_value)) => Ok(FieldType::Allocated(
|
||||
allocated_value
|
||||
.mul_by_constant(cs, constant_value)
|
||||
.map_err(|e| FieldError::binary_operation("*".to_string(), e, span))?,
|
||||
)),
|
||||
}
|
||||
Ok(FieldType(value))
|
||||
}
|
||||
|
||||
/// Returns a new `FieldType` by calling the `FpGadget` `inverse` function.
|
||||
pub fn inverse<CS: ConstraintSystem<F>>(&self, cs: CS, span: &Span) -> Result<Self, FieldError> {
|
||||
let value = self
|
||||
.0
|
||||
.inverse(cs)
|
||||
.map_err(|e| FieldError::binary_operation("inv".to_string(), e, span))?;
|
||||
|
||||
Ok(FieldType(value))
|
||||
}
|
||||
|
||||
/// Returns a new `FieldType` by calling the `FpGadget` `div` function.
|
||||
pub fn div<CS: ConstraintSystem<F>>(&self, mut cs: CS, other: &Self, span: &Span) -> Result<Self, FieldError> {
|
||||
let inverse = match other {
|
||||
FieldType::Constant(constant) => {
|
||||
let constant_inverse = constant
|
||||
.inverse()
|
||||
.ok_or_else(|| FieldError::no_inverse(constant.to_string(), span))?;
|
||||
|
||||
FieldType::Constant(constant_inverse)
|
||||
}
|
||||
FieldType::Allocated(allocated) => {
|
||||
let allocated_inverse = allocated
|
||||
.inverse(&mut cs)
|
||||
.map_err(|e| FieldError::binary_operation("+".to_string(), e, span))?;
|
||||
|
||||
FieldType::Allocated(allocated_inverse)
|
||||
}
|
||||
};
|
||||
let inverse = other.inverse(cs.ns(|| "division inverse"), span)?;
|
||||
|
||||
self.mul(cs, &inverse, span)
|
||||
}
|
||||
@ -179,15 +133,6 @@ impl<F: PrimeField> FieldType<F> {
|
||||
|
||||
F::from_str(&field_string).map_err(|_| SynthesisError::AssignmentMissing)
|
||||
}
|
||||
|
||||
pub fn allocated<CS: ConstraintSystem<F>>(&self, mut cs: CS) -> Result<FpGadget<F>, SynthesisError> {
|
||||
match self {
|
||||
FieldType::Constant(constant) => FpGadget::alloc(&mut cs.ns(|| format!("{:?}", constant)), || Ok(constant)),
|
||||
FieldType::Allocated(allocated) => FpGadget::alloc(&mut cs.ns(|| format!("{:?}", allocated)), || {
|
||||
allocated.get_value().ok_or(SynthesisError::AssignmentMissing)
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<F: PrimeField> AllocGadget<String, F> for FieldType<F> {
|
||||
@ -197,7 +142,7 @@ impl<F: PrimeField> AllocGadget<String, F> for FieldType<F> {
|
||||
) -> Result<Self, SynthesisError> {
|
||||
let value = FpGadget::alloc(cs, || Self::alloc_helper(value_gen))?;
|
||||
|
||||
Ok(FieldType::Allocated(value))
|
||||
Ok(FieldType(value))
|
||||
}
|
||||
|
||||
fn alloc_input<Fn: FnOnce() -> Result<T, SynthesisError>, T: Borrow<String>, CS: ConstraintSystem<F>>(
|
||||
@ -206,16 +151,13 @@ impl<F: PrimeField> AllocGadget<String, F> for FieldType<F> {
|
||||
) -> Result<Self, SynthesisError> {
|
||||
let value = FpGadget::alloc_input(cs, || Self::alloc_helper(value_gen))?;
|
||||
|
||||
Ok(FieldType::Allocated(value))
|
||||
Ok(FieldType(value))
|
||||
}
|
||||
}
|
||||
|
||||
impl<F: PrimeField> PartialEq for FieldType<F> {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
let self_value = self.get_value();
|
||||
let other_value = other.get_value();
|
||||
|
||||
self_value.is_some() && other_value.is_some() && self_value.eq(&other_value)
|
||||
self.0.eq(&other.0)
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,18 +181,8 @@ impl<F: PrimeField> EvaluateLtGadget<F> for FieldType<F> {
|
||||
impl<F: PrimeField> ComparatorGadget<F> for FieldType<F> {}
|
||||
|
||||
impl<F: PrimeField> EvaluateEqGadget<F> for FieldType<F> {
|
||||
fn evaluate_equal<CS: ConstraintSystem<F>>(&self, mut _cs: CS, other: &Self) -> Result<Boolean, SynthesisError> {
|
||||
match (self, other) {
|
||||
(FieldType::Constant(first), FieldType::Constant(second)) => Ok(Boolean::constant(first.eq(second))),
|
||||
_ => unimplemented!(),
|
||||
// (FieldType::Allocated(first), FieldType::Allocated(second)) => first.evaluate_equal(cs, second),
|
||||
// (FieldType::Constant(constant_value), FieldType::Allocated(allocated_value))
|
||||
// | (FieldType::Allocated(allocated_value), FieldType::Constant(constant_value)) => {
|
||||
// let allocated_constant_value =
|
||||
// FpGadget::alloc(&mut cs.ns(|| format!("alloc constant for eq")), || Ok(constant_value))?;
|
||||
// allocated_value.evaluate_equal(cs, &allocated_constant_value)
|
||||
// }
|
||||
}
|
||||
fn evaluate_equal<CS: ConstraintSystem<F>>(&self, cs: CS, other: &Self) -> Result<Boolean, SynthesisError> {
|
||||
self.0.is_eq(cs, &other.0)
|
||||
}
|
||||
}
|
||||
|
||||
@ -259,30 +191,11 @@ impl<F: PrimeField> EqGadget<F> for FieldType<F> {}
|
||||
impl<F: PrimeField> ConditionalEqGadget<F> for FieldType<F> {
|
||||
fn conditional_enforce_equal<CS: ConstraintSystem<F>>(
|
||||
&self,
|
||||
mut cs: CS,
|
||||
cs: CS,
|
||||
other: &Self,
|
||||
condition: &Boolean,
|
||||
) -> Result<(), SynthesisError> {
|
||||
match (self, other) {
|
||||
// c - c
|
||||
(FieldType::Constant(self_value), FieldType::Constant(other_value)) => {
|
||||
if self_value == other_value {
|
||||
return Ok(());
|
||||
}
|
||||
Err(SynthesisError::AssignmentMissing)
|
||||
}
|
||||
// a - a
|
||||
(FieldType::Allocated(self_value), FieldType::Allocated(other_value)) => {
|
||||
self_value.conditional_enforce_equal(cs, other_value, condition)
|
||||
}
|
||||
// c - a = a - c
|
||||
(FieldType::Constant(constant_value), FieldType::Allocated(allocated_value))
|
||||
| (FieldType::Allocated(allocated_value), FieldType::Constant(constant_value)) => {
|
||||
let constant_gadget = FpGadget::from(AllocatedFp::from(&mut cs, constant_value));
|
||||
|
||||
constant_gadget.conditional_enforce_equal(cs, allocated_value, condition)
|
||||
}
|
||||
}
|
||||
self.0.conditional_enforce_equal(cs, &other.0, condition)
|
||||
}
|
||||
|
||||
fn cost() -> usize {
|
||||
@ -290,22 +203,26 @@ impl<F: PrimeField> ConditionalEqGadget<F> for FieldType<F> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<F: PrimeField> NEqGadget<F> for FieldType<F> {
|
||||
fn enforce_not_equal<CS: ConstraintSystem<F>>(&self, cs: CS, other: &Self) -> Result<(), SynthesisError> {
|
||||
self.0.enforce_not_equal(cs, &other.0)
|
||||
}
|
||||
|
||||
fn cost() -> usize {
|
||||
<FpGadget<F> as NEqGadget<F>>::cost()
|
||||
}
|
||||
}
|
||||
|
||||
impl<F: PrimeField> CondSelectGadget<F> for FieldType<F> {
|
||||
fn conditionally_select<CS: ConstraintSystem<F>>(
|
||||
mut cs: CS,
|
||||
cs: CS,
|
||||
cond: &Boolean,
|
||||
first: &Self,
|
||||
second: &Self,
|
||||
) -> Result<Self, SynthesisError> {
|
||||
if let Boolean::Constant(cond) = *cond {
|
||||
if cond { Ok(first.clone()) } else { Ok(second.clone()) }
|
||||
} else {
|
||||
let first_gadget = first.allocated(&mut cs)?;
|
||||
let second_gadget = second.allocated(&mut cs)?;
|
||||
let result = FpGadget::conditionally_select(cs, cond, &first_gadget, &second_gadget)?;
|
||||
let value = FpGadget::conditionally_select(cs, cond, &first.0, &second.0)?;
|
||||
|
||||
Ok(FieldType::Allocated(result))
|
||||
}
|
||||
Ok(FieldType(value))
|
||||
}
|
||||
|
||||
fn cost() -> usize {
|
||||
@ -314,26 +231,22 @@ impl<F: PrimeField> CondSelectGadget<F> for FieldType<F> {
|
||||
}
|
||||
|
||||
impl<F: PrimeField> ToBitsBEGadget<F> for FieldType<F> {
|
||||
fn to_bits_be<CS: ConstraintSystem<F>>(&self, mut cs: CS) -> Result<Vec<Boolean>, SynthesisError> {
|
||||
let self_gadget = self.allocated(&mut cs)?;
|
||||
self_gadget.to_bits_be(cs)
|
||||
fn to_bits_be<CS: ConstraintSystem<F>>(&self, cs: CS) -> Result<Vec<Boolean>, SynthesisError> {
|
||||
self.0.to_bits_be(cs)
|
||||
}
|
||||
|
||||
fn to_bits_be_strict<CS: ConstraintSystem<F>>(&self, mut cs: CS) -> Result<Vec<Boolean>, SynthesisError> {
|
||||
let self_gadget = self.allocated(&mut cs)?;
|
||||
self_gadget.to_bits_be_strict(cs)
|
||||
fn to_bits_be_strict<CS: ConstraintSystem<F>>(&self, cs: CS) -> Result<Vec<Boolean>, SynthesisError> {
|
||||
self.0.to_bits_be(cs)
|
||||
}
|
||||
}
|
||||
|
||||
impl<F: PrimeField> ToBytesGadget<F> for FieldType<F> {
|
||||
fn to_bytes<CS: ConstraintSystem<F>>(&self, mut cs: CS) -> Result<Vec<UInt8>, SynthesisError> {
|
||||
let self_gadget = self.allocated(&mut cs)?;
|
||||
self_gadget.to_bytes(cs)
|
||||
fn to_bytes<CS: ConstraintSystem<F>>(&self, cs: CS) -> Result<Vec<UInt8>, SynthesisError> {
|
||||
self.0.to_bytes(cs)
|
||||
}
|
||||
|
||||
fn to_bytes_strict<CS: ConstraintSystem<F>>(&self, mut cs: CS) -> Result<Vec<UInt8>, SynthesisError> {
|
||||
let self_gadget = self.allocated(&mut cs)?;
|
||||
self_gadget.to_bytes_strict(cs)
|
||||
fn to_bytes_strict<CS: ConstraintSystem<F>>(&self, cs: CS) -> Result<Vec<UInt8>, SynthesisError> {
|
||||
self.0.to_bytes_strict(cs)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ description = "The {name} package"
|
||||
license = "MIT"
|
||||
|
||||
[remote]
|
||||
author = "{author}" # Add your Aleo Package Manager username, team's name, or organization's name.
|
||||
author = "{author}" # Add your Aleo Package Manager username or team name.
|
||||
"#,
|
||||
name = self.project.name,
|
||||
author = author
|
||||
|
@ -65,6 +65,9 @@ impl Token {
|
||||
/// Returns a new `StrTendril` string if an character can be eaten, otherwise returns [`None`].
|
||||
///
|
||||
fn eat_char(input_tendril: &StrTendril) -> (usize, Option<Token>) {
|
||||
// Probably better to move this logic to a parse_char.
|
||||
// Would give better errors, and isolates logic from lexer.
|
||||
// Lexer can just return content between single quotes.
|
||||
if input_tendril.is_empty() {
|
||||
return (0, None);
|
||||
}
|
||||
@ -78,10 +81,8 @@ impl Token {
|
||||
let mut characters: Vec<u8> = vec![];
|
||||
|
||||
while i < input.len() {
|
||||
println!("?? input[i] {}", input[i]);
|
||||
if !escaped {
|
||||
if input[i] == b'\'' {
|
||||
println!("last");
|
||||
last = true;
|
||||
i += 1;
|
||||
break;
|
||||
@ -144,7 +145,7 @@ impl Token {
|
||||
1 | 2 | 3 | 4 | 5 if unicode => {
|
||||
if let Ok(string) = std::str::from_utf8(&characters[..]) {
|
||||
if let Ok(hex) = u32::from_str_radix(&string, 16) {
|
||||
if hex <= 0x10FFF {
|
||||
if hex <= 0x10FFFF {
|
||||
if let Some(unicode_char) = std::char::from_u32(hex) {
|
||||
return (i, Some(Token::CharLit(unicode_char)));
|
||||
}
|
||||
|
@ -26,18 +26,18 @@ path = "../ast"
|
||||
version = "1.4.0"
|
||||
|
||||
[dependencies.snarkvm-algorithms]
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
|
||||
[dependencies.snarkvm-curves]
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-dpc]
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-utilities]
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
|
||||
[dependencies.indexmap]
|
||||
version = "1.6.2"
|
||||
@ -52,8 +52,8 @@ version = "0.3"
|
||||
[dependencies.thiserror]
|
||||
version = "1.0"
|
||||
|
||||
[dev-dependencies.snarkvm-storage]
|
||||
version = "0.2.2"
|
||||
#[dev-dependencies.snarkos-storage]
|
||||
#version = "1.3.3"
|
||||
|
||||
[dev-dependencies.rand_core]
|
||||
version = "0.6.2"
|
||||
|
@ -14,6 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
mod test_verify_local_data_commitment;
|
||||
// mod test_verify_local_data_commitment;
|
||||
|
||||
mod test_verify_record_commitment;
|
||||
// mod test_verify_record_commitment;
|
||||
|
@ -14,206 +14,206 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_ast::Input;
|
||||
use leo_input::LeoInputParser;
|
||||
use leo_state::verify_local_data_commitment;
|
||||
|
||||
use snarkvm_algorithms::traits::{CommitmentScheme, CRH};
|
||||
use snarkvm_dpc::{
|
||||
base_dpc::{instantiated::*, record_payload::RecordPayload, DPC},
|
||||
Account,
|
||||
AccountScheme,
|
||||
Record,
|
||||
};
|
||||
use snarkvm_utilities::{bytes::ToBytes, to_bytes};
|
||||
|
||||
use rand::Rng;
|
||||
use rand_core::SeedableRng;
|
||||
use rand_xorshift::XorShiftRng;
|
||||
use snarkvm_dpc::DPCScheme;
|
||||
use snarkvm_storage::Ledger;
|
||||
|
||||
// TODO (Collin): Update input to reflect new parameter ordering.
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_verify_local_data_commitment_from_file() {
|
||||
let mut rng = XorShiftRng::seed_from_u64(1231275789u64);
|
||||
|
||||
// Generate parameters for the record commitment scheme
|
||||
let system_parameters = InstantiatedDPC::generate_system_parameters(&mut rng).unwrap();
|
||||
|
||||
// Load test record state file from `inputs/test.state`
|
||||
let file_bytes = include_bytes!("inputs/test_state.state");
|
||||
let file_string = String::from_utf8_lossy(file_bytes);
|
||||
let file = LeoInputParser::parse_file(&file_string).unwrap();
|
||||
|
||||
let mut program_input = Input::new();
|
||||
program_input.parse_state(file).unwrap();
|
||||
|
||||
// check record state is correct by verifying commitment
|
||||
let result = verify_local_data_commitment(&system_parameters, &program_input).unwrap();
|
||||
|
||||
assert!(result);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_generate_values_from_dpc() {
|
||||
type L = Ledger<Tx, CommitmentMerkleParameters>;
|
||||
|
||||
let mut rng = XorShiftRng::seed_from_u64(1231275789u64);
|
||||
|
||||
// Specify network_id
|
||||
let network_id: u8 = 0;
|
||||
|
||||
// Generate parameters for the ledger, commitment schemes, CRH, and the
|
||||
// "always-accept" program.
|
||||
let system_parameters = InstantiatedDPC::generate_system_parameters(&mut rng).unwrap();
|
||||
let noop_program_snark_pp =
|
||||
InstantiatedDPC::generate_noop_program_snark_parameters(&system_parameters, &mut rng).unwrap();
|
||||
|
||||
let noop_program_id = to_bytes![
|
||||
ProgramVerificationKeyCRH::hash(
|
||||
&system_parameters.program_verification_key_crh,
|
||||
&to_bytes![noop_program_snark_pp.verification_key].unwrap()
|
||||
)
|
||||
.unwrap()
|
||||
]
|
||||
.unwrap();
|
||||
|
||||
let signature_parameters = &system_parameters.account_signature;
|
||||
let commitment_parameters = &system_parameters.account_commitment;
|
||||
let encryption_parameters = &system_parameters.account_encryption;
|
||||
|
||||
// Generate metadata and an account for a dummy initial record.
|
||||
let dummy_account = Account::new(
|
||||
signature_parameters,
|
||||
commitment_parameters,
|
||||
encryption_parameters,
|
||||
&mut rng,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let sn_nonce = SerialNumberNonce::hash(&system_parameters.serial_number_nonce, &[0u8; 1]).unwrap();
|
||||
let value = rng.gen();
|
||||
let payload: [u8; 32] = rng.gen();
|
||||
|
||||
let old_record = DPC::generate_record(
|
||||
&system_parameters,
|
||||
sn_nonce,
|
||||
dummy_account.address,
|
||||
false,
|
||||
value,
|
||||
RecordPayload::from_bytes(&payload),
|
||||
noop_program_id.clone(),
|
||||
noop_program_id.clone(),
|
||||
&mut rng,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
// Set the input records for our transaction to be the initial dummy records.
|
||||
let old_records = vec![old_record; NUM_INPUT_RECORDS];
|
||||
let old_account_private_keys = vec![dummy_account.private_key; NUM_INPUT_RECORDS];
|
||||
|
||||
// Construct new records.
|
||||
|
||||
// Create an account for an actual new record.
|
||||
|
||||
let new_account = Account::new(
|
||||
signature_parameters,
|
||||
commitment_parameters,
|
||||
encryption_parameters,
|
||||
&mut rng,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
// Set the new record's program to be the "always-accept" program.
|
||||
|
||||
let new_record_owners = vec![new_account.address; NUM_OUTPUT_RECORDS];
|
||||
let new_is_dummy_flags = vec![false; NUM_OUTPUT_RECORDS];
|
||||
let new_values = vec![10; NUM_OUTPUT_RECORDS];
|
||||
let new_payloads = vec![RecordPayload::default(); NUM_OUTPUT_RECORDS];
|
||||
let new_birth_program_ids = vec![noop_program_id.clone(); NUM_OUTPUT_RECORDS];
|
||||
let new_death_program_ids = vec![noop_program_id; NUM_OUTPUT_RECORDS];
|
||||
let memo = [0u8; 32];
|
||||
|
||||
let context = <InstantiatedDPC as DPCScheme<L>>::execute_offline(
|
||||
system_parameters.clone(),
|
||||
old_records,
|
||||
old_account_private_keys,
|
||||
new_record_owners,
|
||||
&new_is_dummy_flags,
|
||||
&new_values,
|
||||
new_payloads,
|
||||
new_birth_program_ids,
|
||||
new_death_program_ids,
|
||||
memo,
|
||||
network_id,
|
||||
&mut rng,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let local_data = context.into_local_data();
|
||||
let leaf_index = 0;
|
||||
let record = &local_data.old_records[leaf_index];
|
||||
|
||||
let root = local_data.local_data_merkle_tree.root();
|
||||
|
||||
let serial_number = local_data.old_serial_numbers[0];
|
||||
let serial_number_bytes = to_bytes![serial_number].unwrap();
|
||||
|
||||
let memorandum = local_data.memorandum;
|
||||
let network_id = local_data.network_id;
|
||||
let input_bytes = to_bytes![serial_number, record.commitment(), memorandum, network_id].unwrap();
|
||||
let leaf_randomness = local_data.local_data_commitment_randomizers[0];
|
||||
|
||||
let old_record_leaf = <LocalDataCommitment as CommitmentScheme>::commit(
|
||||
&system_parameters.local_data_commitment,
|
||||
&input_bytes,
|
||||
&leaf_randomness,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
// generate the path
|
||||
|
||||
let path = local_data
|
||||
.local_data_merkle_tree
|
||||
.generate_proof(&old_record_leaf)
|
||||
.unwrap();
|
||||
|
||||
println!("////////////////////////////////////////////////////");
|
||||
println!();
|
||||
println!("[state]");
|
||||
println!("leaf index {}", leaf_index);
|
||||
println!("root {:?}", to_bytes![root].unwrap());
|
||||
println!();
|
||||
println!("[record]");
|
||||
println!(
|
||||
"serial number {:?} len {}",
|
||||
serial_number_bytes,
|
||||
serial_number_bytes.len()
|
||||
);
|
||||
println!("commitment {:?}", to_bytes![record.commitment()].unwrap());
|
||||
println!("owner {}", record.owner());
|
||||
println!("is_dummy {:?}", record.is_dummy());
|
||||
println!("value {:?}", record.value());
|
||||
println!("payload {:?}", record.payload());
|
||||
println!("birth_program_id {:?}", record.birth_program_id());
|
||||
println!("death_program_id {:?}", record.death_program_id());
|
||||
println!(
|
||||
"serial number nonce {:?}",
|
||||
to_bytes![record.serial_number_nonce()].unwrap()
|
||||
);
|
||||
println!(
|
||||
"commitment randomness {:?}",
|
||||
to_bytes![record.commitment_randomness()].unwrap()
|
||||
);
|
||||
println!();
|
||||
println!("[state_leaf]");
|
||||
println!("path {:?}", to_bytes![path].unwrap());
|
||||
println!("memo {:?}", memorandum);
|
||||
println!("network id {:?}", network_id);
|
||||
println!("leaf randomness {:?}", to_bytes![leaf_randomness].unwrap());
|
||||
println!();
|
||||
println!("////////////////////////////////////////////////////");
|
||||
}
|
||||
// use leo_ast::Input;
|
||||
// use leo_input::LeoInputParser;
|
||||
// use leo_state::verify_local_data_commitment;
|
||||
//
|
||||
// use snarkos_storage::{mem::MemDb, Ledger};
|
||||
// use snarkvm_algorithms::traits::{CommitmentScheme, CRH};
|
||||
// use snarkvm_dpc::{
|
||||
// base_dpc::{instantiated::*, record_payload::RecordPayload, DPC},
|
||||
// traits::DPCScheme,
|
||||
// Account,
|
||||
// AccountScheme,
|
||||
// Record,
|
||||
// };
|
||||
// use snarkvm_utilities::{bytes::ToBytes, to_bytes};
|
||||
//
|
||||
// use rand::Rng;
|
||||
// use rand_core::SeedableRng;
|
||||
// use rand_xorshift::XorShiftRng;
|
||||
//
|
||||
// // TODO (Collin): Update input to reflect new parameter ordering.
|
||||
// #[test]
|
||||
// #[ignore]
|
||||
// fn test_verify_local_data_commitment_from_file() {
|
||||
// let mut rng = XorShiftRng::seed_from_u64(1231275789u64);
|
||||
//
|
||||
// // Generate parameters for the record commitment scheme
|
||||
// let system_parameters = InstantiatedDPC::generate_system_parameters(&mut rng).unwrap();
|
||||
//
|
||||
// // Load test record state file from `inputs/test.state`
|
||||
// let file_bytes = include_bytes!("inputs/test_state.state");
|
||||
// let file_string = String::from_utf8_lossy(file_bytes);
|
||||
// let file = LeoInputParser::parse_file(&file_string).unwrap();
|
||||
//
|
||||
// let mut program_input = Input::new();
|
||||
// program_input.parse_state(file).unwrap();
|
||||
//
|
||||
// // check record state is correct by verifying commitment
|
||||
// let result = verify_local_data_commitment(&system_parameters, &program_input).unwrap();
|
||||
//
|
||||
// assert!(result);
|
||||
// }
|
||||
//
|
||||
// #[test]
|
||||
// #[ignore]
|
||||
// fn test_generate_values_from_dpc() {
|
||||
// type L = Ledger<Tx, CommitmentMerkleParameters, MemDb>;
|
||||
//
|
||||
// let mut rng = XorShiftRng::seed_from_u64(1231275789u64);
|
||||
//
|
||||
// // Specify network_id
|
||||
// let network_id: u8 = 0;
|
||||
//
|
||||
// // Generate parameters for the ledger, commitment schemes, CRH, and the
|
||||
// // "always-accept" program.
|
||||
// let system_parameters = InstantiatedDPC::generate_system_parameters(&mut rng).unwrap();
|
||||
// let noop_program_snark_pp =
|
||||
// InstantiatedDPC::generate_noop_program_snark_parameters(&system_parameters, &mut rng).unwrap();
|
||||
//
|
||||
// let noop_program_id = to_bytes![
|
||||
// ProgramVerificationKeyCRH::hash(
|
||||
// &system_parameters.program_verification_key_crh,
|
||||
// &to_bytes![noop_program_snark_pp.verification_key].unwrap()
|
||||
// )
|
||||
// .unwrap()
|
||||
// ]
|
||||
// .unwrap();
|
||||
//
|
||||
// let signature_parameters = &system_parameters.account_signature;
|
||||
// let commitment_parameters = &system_parameters.account_commitment;
|
||||
// let encryption_parameters = &system_parameters.account_encryption;
|
||||
//
|
||||
// // Generate metadata and an account for a dummy initial record.
|
||||
// let dummy_account = Account::new(
|
||||
// signature_parameters,
|
||||
// commitment_parameters,
|
||||
// encryption_parameters,
|
||||
// &mut rng,
|
||||
// )
|
||||
// .unwrap();
|
||||
//
|
||||
// let sn_nonce = SerialNumberNonce::hash(&system_parameters.serial_number_nonce, &[0u8; 1]).unwrap();
|
||||
// let value = rng.gen();
|
||||
// let payload: [u8; 32] = rng.gen();
|
||||
//
|
||||
// let old_record = DPC::generate_record(
|
||||
// &system_parameters,
|
||||
// sn_nonce,
|
||||
// dummy_account.address,
|
||||
// false,
|
||||
// value,
|
||||
// RecordPayload::from_bytes(&payload),
|
||||
// noop_program_id.clone(),
|
||||
// noop_program_id.clone(),
|
||||
// &mut rng,
|
||||
// )
|
||||
// .unwrap();
|
||||
//
|
||||
// // Set the input records for our transaction to be the initial dummy records.
|
||||
// let old_records = vec![old_record; NUM_INPUT_RECORDS];
|
||||
// let old_account_private_keys = vec![dummy_account.private_key; NUM_INPUT_RECORDS];
|
||||
//
|
||||
// // Construct new records.
|
||||
//
|
||||
// // Create an account for an actual new record.
|
||||
//
|
||||
// let new_account = Account::new(
|
||||
// signature_parameters,
|
||||
// commitment_parameters,
|
||||
// encryption_parameters,
|
||||
// &mut rng,
|
||||
// )
|
||||
// .unwrap();
|
||||
//
|
||||
// // Set the new record's program to be the "always-accept" program.
|
||||
//
|
||||
// let new_record_owners = vec![new_account.address; NUM_OUTPUT_RECORDS];
|
||||
// let new_is_dummy_flags = vec![false; NUM_OUTPUT_RECORDS];
|
||||
// let new_values = vec![10; NUM_OUTPUT_RECORDS];
|
||||
// let new_payloads = vec![RecordPayload::default(); NUM_OUTPUT_RECORDS];
|
||||
// let new_birth_program_ids = vec![noop_program_id.clone(); NUM_OUTPUT_RECORDS];
|
||||
// let new_death_program_ids = vec![noop_program_id; NUM_OUTPUT_RECORDS];
|
||||
// let memo = [0u8; 32];
|
||||
//
|
||||
// let context = <InstantiatedDPC as DPCScheme<L>>::execute_offline(
|
||||
// system_parameters.clone(),
|
||||
// old_records,
|
||||
// old_account_private_keys,
|
||||
// new_record_owners,
|
||||
// &new_is_dummy_flags,
|
||||
// &new_values,
|
||||
// new_payloads,
|
||||
// new_birth_program_ids,
|
||||
// new_death_program_ids,
|
||||
// memo,
|
||||
// network_id,
|
||||
// &mut rng,
|
||||
// )
|
||||
// .unwrap();
|
||||
//
|
||||
// let local_data = context.into_local_data();
|
||||
// let leaf_index = 0;
|
||||
// let record = &local_data.old_records[leaf_index];
|
||||
//
|
||||
// let root = local_data.local_data_merkle_tree.root();
|
||||
//
|
||||
// let serial_number = local_data.old_serial_numbers[0];
|
||||
// let serial_number_bytes = to_bytes![serial_number].unwrap();
|
||||
//
|
||||
// let memorandum = local_data.memorandum;
|
||||
// let network_id = local_data.network_id;
|
||||
// let input_bytes = to_bytes![serial_number, record.commitment(), memorandum, network_id].unwrap();
|
||||
// let leaf_randomness = local_data.local_data_commitment_randomizers[0];
|
||||
//
|
||||
// let old_record_leaf = <LocalDataCommitment as CommitmentScheme>::commit(
|
||||
// &system_parameters.local_data_commitment,
|
||||
// &input_bytes,
|
||||
// &leaf_randomness,
|
||||
// )
|
||||
// .unwrap();
|
||||
//
|
||||
// // generate the path
|
||||
//
|
||||
// let path = local_data
|
||||
// .local_data_merkle_tree
|
||||
// .generate_proof(&old_record_leaf)
|
||||
// .unwrap();
|
||||
//
|
||||
// println!("////////////////////////////////////////////////////");
|
||||
// println!();
|
||||
// println!("[state]");
|
||||
// println!("leaf index {}", leaf_index);
|
||||
// println!("root {:?}", to_bytes![root].unwrap());
|
||||
// println!();
|
||||
// println!("[record]");
|
||||
// println!(
|
||||
// "serial number {:?} len {}",
|
||||
// serial_number_bytes,
|
||||
// serial_number_bytes.len()
|
||||
// );
|
||||
// println!("commitment {:?}", to_bytes![record.commitment()].unwrap());
|
||||
// println!("owner {}", record.owner());
|
||||
// println!("is_dummy {:?}", record.is_dummy());
|
||||
// println!("value {:?}", record.value());
|
||||
// println!("payload {:?}", record.payload());
|
||||
// println!("birth_program_id {:?}", record.birth_program_id());
|
||||
// println!("death_program_id {:?}", record.death_program_id());
|
||||
// println!(
|
||||
// "serial number nonce {:?}",
|
||||
// to_bytes![record.serial_number_nonce()].unwrap()
|
||||
// );
|
||||
// println!(
|
||||
// "commitment randomness {:?}",
|
||||
// to_bytes![record.commitment_randomness()].unwrap()
|
||||
// );
|
||||
// println!();
|
||||
// println!("[state_leaf]");
|
||||
// println!("path {:?}", to_bytes![path].unwrap());
|
||||
// println!("memo {:?}", memorandum);
|
||||
// println!("network id {:?}", network_id);
|
||||
// println!("leaf randomness {:?}", to_bytes![leaf_randomness].unwrap());
|
||||
// println!();
|
||||
// println!("////////////////////////////////////////////////////");
|
||||
// }
|
||||
|
@ -14,34 +14,34 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_ast::Input;
|
||||
use leo_input::LeoInputParser;
|
||||
use leo_state::verify_record_commitment;
|
||||
|
||||
use snarkvm_dpc::base_dpc::instantiated::*;
|
||||
|
||||
use rand_core::SeedableRng;
|
||||
use rand_xorshift::XorShiftRng;
|
||||
|
||||
// TODO (Collin): Update input to reflect new parameter ordering.
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_verify_record_from_file() {
|
||||
let mut rng = XorShiftRng::seed_from_u64(1231275789u64);
|
||||
|
||||
// Generate parameters for the record commitment scheme
|
||||
let system_parameters = InstantiatedDPC::generate_system_parameters(&mut rng).unwrap();
|
||||
|
||||
// Load test record state file from `inputs/test.state`
|
||||
let file_bytes = include_bytes!("inputs/test_record.state");
|
||||
let file_string = String::from_utf8_lossy(file_bytes);
|
||||
let file = LeoInputParser::parse_file(&file_string).unwrap();
|
||||
|
||||
let mut program_input = Input::new();
|
||||
program_input.parse_state(file).unwrap();
|
||||
|
||||
let typed_record = program_input.get_record();
|
||||
|
||||
// check record state is correct by verifying commitment
|
||||
let _values = verify_record_commitment(&system_parameters, typed_record).unwrap();
|
||||
}
|
||||
// use leo_ast::Input;
|
||||
// use leo_input::LeoInputParser;
|
||||
// use leo_state::verify_record_commitment;
|
||||
//
|
||||
// use snarkvm_dpc::base_dpc::instantiated::*;
|
||||
//
|
||||
// use rand_core::SeedableRng;
|
||||
// use rand_xorshift::XorShiftRng;
|
||||
//
|
||||
// // TODO (Collin): Update input to reflect new parameter ordering.
|
||||
// #[test]
|
||||
// #[ignore]
|
||||
// fn test_verify_record_from_file() {
|
||||
// let mut rng = XorShiftRng::seed_from_u64(1231275789u64);
|
||||
//
|
||||
// // Generate parameters for the record commitment scheme
|
||||
// let system_parameters = InstantiatedDPC::generate_system_parameters(&mut rng).unwrap();
|
||||
//
|
||||
// // Load test record state file from `inputs/test.state`
|
||||
// let file_bytes = include_bytes!("inputs/test_record.state");
|
||||
// let file_string = String::from_utf8_lossy(file_bytes);
|
||||
// let file = LeoInputParser::parse_file(&file_string).unwrap();
|
||||
//
|
||||
// let mut program_input = Input::new();
|
||||
// program_input.parse_state(file).unwrap();
|
||||
//
|
||||
// let typed_record = program_input.get_record();
|
||||
//
|
||||
// // check record state is correct by verifying commitment
|
||||
// let _values = verify_record_commitment(&system_parameters, typed_record).unwrap();
|
||||
// }
|
||||
|
@ -18,18 +18,18 @@ license = "GPL-3.0"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies.snarkvm-curves]
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-fields]
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-gadgets]
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
|
||||
[dependencies.snarkvm-r1cs]
|
||||
version = "0.2.2"
|
||||
version = "0.3.1"
|
||||
default-features = false
|
||||
|
||||
[dependencies.num-bigint]
|
||||
|
Loading…
Reference in New Issue
Block a user