diff --git a/Cargo.lock b/Cargo.lock index 81b84faa32..daabbf1b46 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -30,9 +30,15 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi", + "winapi 0.3.9", ] +[[package]] +name = "arc-swap" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034" + [[package]] name = "atty" version = "0.2.14" @@ -41,7 +47,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi", "libc", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -70,6 +76,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5024ee8015f02155eee35c711107ddd9a9bf3cb689cf2a9089c97e79b6e1ae83" +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + [[package]] name = "bech32" version = "0.6.0" @@ -86,6 +98,30 @@ dependencies = [ "serde", ] +[[package]] +name = "bindgen" +version = "0.53.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c72a978d268b1d70b0e963217e60fdabd9523a941457a6c42a7315d15c7e89e5" +dependencies = [ + "bitflags", + "cexpr", + "cfg-if", + "clang-sys", + "clap", + "env_logger", + "lazy_static", + "lazycell", + "log", + "peeking_take_while", + "proc-macro2 1.0.19", + "quote 1.0.7", + "regex", + "rustc-hash", + "shlex", + "which", +] + [[package]] name = "bitflags" version = "1.2.1" @@ -164,6 +200,12 @@ version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" +[[package]] +name = "bytes" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" + [[package]] name = "bzip2" version = "0.3.3" @@ -199,6 +241,18 @@ name = "cc" version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518" +dependencies = [ + "jobserver", +] + +[[package]] +name = "cexpr" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27" +dependencies = [ + "nom", +] [[package]] name = "cfg-if" @@ -227,6 +281,17 @@ 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.1" @@ -242,6 +307,15 @@ dependencies = [ "vec_map", ] +[[package]] +name = "cloudabi" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467" +dependencies = [ + "bitflags", +] + [[package]] name = "colored" version = "2.0.0" @@ -250,9 +324,25 @@ checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd" dependencies = [ "atty", "lazy_static", - "winapi", + "winapi 0.3.9", ] +[[package]] +name = "core-foundation" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" + [[package]] name = "cpuid-bool" version = "0.1.2" @@ -384,6 +474,36 @@ dependencies = [ "memchr", ] +[[package]] +name = "curl" +version = "0.4.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9447ad28eee2a5cfb031c329d46bef77487244fff6a724b378885b8691a35f78" +dependencies = [ + "curl-sys", + "libc", + "openssl-probe", + "openssl-sys", + "schannel", + "socket2", + "winapi 0.3.9", +] + +[[package]] +name = "curl-sys" +version = "0.4.34+curl-7.71.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad4eff0be6985b7e709f64b5a541f700e9ad1407190a29f4884319eb663ed1d6" +dependencies = [ + "cc", + "libc", + "libz-sys", + "openssl-sys", + "pkg-config", + "vcpkg", + "winapi 0.3.9", +] + [[package]] name = "derivative" version = "2.1.1" @@ -413,12 +533,27 @@ dependencies = [ "generic-array 0.14.3", ] +[[package]] +name = "dtoa" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "134951f4028bdadb9b84baf4232681efbf277da25144b9b0ad65df75946c422b" + [[package]] name = "either" version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" +[[package]] +name = "encoding_rs" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8ac63f94732332f44fe654443c46f6375d1939684c17b0afb6cb56b0456e171" +dependencies = [ + "cfg-if", +] + [[package]] name = "env_logger" version = "0.7.1" @@ -482,6 +617,27 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "from-pest" version = "0.3.1" @@ -498,12 +654,79 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1fd087255f739f4f1aeea69f11b72f8080e9c2e7645cd06955dad4a178a49e3" +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +dependencies = [ + "bitflags", + "fuchsia-zircon-sys", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" + [[package]] name = "futures" version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef" +[[package]] +name = "futures-channel" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399" + +[[package]] +name = "futures-io" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789" + +[[package]] +name = "futures-sink" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f2032893cb734c7a05d85ce0cc8b8c4075278e93b24b66f9de99d6eb0fa8acc" + +[[package]] +name = "futures-task" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626" +dependencies = [ + "once_cell", +] + +[[package]] +name = "futures-util" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6" +dependencies = [ + "futures-core", + "futures-io", + "futures-task", + "memchr", + "pin-project", + "pin-utils", + "slab", +] + [[package]] name = "generic-array" version = "0.12.3" @@ -549,6 +772,31 @@ version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724" +[[package]] +name = "glob" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" + +[[package]] +name = "h2" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "993f9e0baeed60001cf565546b0d3dbe6a6ad23f2bd31644a133c641eccf6d53" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "half" version = "1.6.0" @@ -579,6 +827,33 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35" +[[package]] +name = "http" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "httparse" +version = "1.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" + [[package]] name = "humantime" version = "1.3.0" @@ -588,6 +863,54 @@ dependencies = [ "quick-error", ] +[[package]] +name = "hyper" +version = "0.13.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e68a8dd9716185d9e64ea473ea6ef63529252e3e27623295a0378a19665d5eb" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "itoa", + "pin-project", + "socket2", + "time", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d979acc56dcb5b8dddba3917601745e877576475aa046df3226eabdecef78eed" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-tls", +] + +[[package]] +name = "idna" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "indexmap" version = "1.5.0" @@ -598,6 +921,27 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "instant" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b141fdc7836c525d4d594027d318c84161ca17aaf8113ab1f81ab93ae897485" + +[[package]] +name = "iovec" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +dependencies = [ + "libc", +] + +[[package]] +name = "ipnet" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47be2f14c678be2fdcab04ab1171db51b2762ce6f0a8ee87c8dd4a04ed216135" + [[package]] name = "itertools" version = "0.7.11" @@ -622,6 +966,15 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" +[[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.44" @@ -644,12 +997,28 @@ dependencies = [ "serde_json", ] +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +[[package]] +name = "lazycell" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" + [[package]] name = "leo" version = "0.1.0" @@ -658,22 +1027,25 @@ dependencies = [ "colored", "env_logger", "from-pest", + "lazy_static", "leo-compiler", "leo-gadgets", "leo-input", "leo-package", + "leo-state", "log", "rand", "rand_core", + "reqwest", "rusty-hook", "serde", "serde_json", - "snarkos-algorithms", - "snarkos-curves", - "snarkos-errors", - "snarkos-gadgets", - "snarkos-models", - "snarkos-utilities", + "snarkos-algorithms 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-curves 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-errors 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-gadgets 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-models 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-utilities 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", "thiserror", "toml", ] @@ -711,13 +1083,13 @@ dependencies = [ "rand_xorshift", "serde", "sha2", - "snarkos-curves", - "snarkos-dpc", - "snarkos-errors", - "snarkos-gadgets", - "snarkos-models", - "snarkos-objects", - "snarkos-utilities", + "snarkos-curves 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-dpc 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-errors 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-gadgets 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-models 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-objects 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-utilities 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", "thiserror", ] @@ -727,9 +1099,9 @@ version = "0.1.0" dependencies = [ "rand", "rand_xorshift", - "snarkos-errors", - "snarkos-models", - "snarkos-utilities", + "snarkos-errors 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-models 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-utilities 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", "thiserror", ] @@ -741,11 +1113,11 @@ dependencies = [ "pest", "pest-ast", "pest_derive", - "snarkos-algorithms", - "snarkos-curves", - "snarkos-errors", - "snarkos-gadgets", - "snarkos-models", + "snarkos-algorithms 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-curves 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-errors 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-gadgets 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-models 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", "thiserror", ] @@ -766,6 +1138,25 @@ dependencies = [ "zip", ] +[[package]] +name = "leo-state" +version = "0.1.0" +dependencies = [ + "leo-input", + "leo-typed", + "rand", + "rand_xorshift", + "snarkos-algorithms 0.8.0", + "snarkos-curves 0.8.0", + "snarkos-dpc 0.8.0", + "snarkos-errors 0.8.0", + "snarkos-models 0.8.0", + "snarkos-objects 0.8.0", + "snarkos-testing", + "snarkos-utilities 0.8.0", + "thiserror", +] + [[package]] name = "leo-typed" version = "0.1.0" @@ -776,8 +1167,8 @@ dependencies = [ "pest", "serde", "serde_json", - "snarkos-errors", - "snarkos-models", + "snarkos-errors 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-models 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", ] [[package]] @@ -786,6 +1177,49 @@ version = "0.2.74" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2f02823cf78b754822df5f7f268fb59822e7296276d3e069d8e8cb26a14bd10" +[[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.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "883213ae3d09bfc3d104aefe94b25ebb183b6f4d3a515b23b14817e1f4854005" +dependencies = [ + "bindgen", + "cc", + "glob", + "libc", +] + +[[package]] +name = "libz-sys" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "lock_api" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28247cc5a5be2f05fbcd76dd0cf2c7d3b5400cb978a28042abcd4fa0b3f8261c" +dependencies = [ + "scopeguard", +] + [[package]] name = "log" version = "0.4.11" @@ -801,6 +1235,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" +[[package]] +name = "matches" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" + [[package]] name = "maybe-uninit" version = "2.0.0" @@ -822,6 +1262,22 @@ dependencies = [ "autocfg", ] +[[package]] +name = "mime" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" + +[[package]] +name = "mime_guess" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212" +dependencies = [ + "mime", + "unicase", +] + [[package]] name = "miniz_oxide" version = "0.4.0" @@ -831,12 +1287,115 @@ dependencies = [ "adler", ] +[[package]] +name = "mio" +version = "0.6.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" +dependencies = [ + "cfg-if", + "fuchsia-zircon", + "fuchsia-zircon-sys", + "iovec", + "kernel32-sys", + "libc", + "log", + "miow 0.2.1", + "net2", + "slab", + "winapi 0.2.8", +] + +[[package]] +name = "mio-named-pipes" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656" +dependencies = [ + "log", + "mio", + "miow 0.3.5", + "winapi 0.3.9", +] + +[[package]] +name = "mio-uds" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" +dependencies = [ + "iovec", + "libc", + "mio", +] + +[[package]] +name = "miow" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" +dependencies = [ + "kernel32-sys", + "net2", + "winapi 0.2.8", + "ws2_32-sys", +] + +[[package]] +name = "miow" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07b88fb9795d4d36d62a012dfbf49a8f5cf12751f36d31a9dbe66d528e58979e" +dependencies = [ + "socket2", + "winapi 0.3.9", +] + +[[package]] +name = "native-tls" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b0d88c06fe90d5ee94048ba40409ef1d9315d86f6f38c2efdaad4fb50c58b2d" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "net2" +version = "0.2.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7" +dependencies = [ + "cfg-if", + "libc", + "winapi 0.3.9", +] + [[package]] name = "nias" 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 = "num-bigint" version = "0.3.0" @@ -907,6 +1466,77 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +[[package]] +name = "openssl" +version = "0.10.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d575eff3665419f9b83678ff2815858ad9d11567e082f5ac1814baba4e2bcb4" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "lazy_static", + "libc", + "openssl-sys", +] + +[[package]] +name = "openssl-probe" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" + +[[package]] +name = "openssl-sys" +version = "0.9.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a842db4709b604f0fe5d1170ae3565899be2ad3d9cbc72dedc789ac0511f78de" +dependencies = [ + "autocfg", + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "parking_lot" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4893845fa2ca272e647da5d0e46660a314ead9c2fdd9a883aabc32e481a8733" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" +dependencies = [ + "cfg-if", + "cloudabi", + "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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" + [[package]] name = "pest" version = "2.1.3" @@ -963,6 +1593,38 @@ dependencies = [ "sha-1", ] +[[package]] +name = "pin-project" +version = "0.4.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca4433fff2ae79342e497d9f8ee990d174071408f28f726d6d83af93e58e48aa" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "0.4.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c0e815c3ee9a031fdf5af21c10aa17c573c9c6a566328d99e3936c34e36461f" +dependencies = [ + "proc-macro2 1.0.19", + "quote 1.0.7", + "syn 1.0.36", +] + +[[package]] +name = "pin-project-lite" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282adbf10f2698a7a77f8e983a74b2d18176c19a7fd32a45446139ae7b02b715" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "pkg-config" version = "0.3.18" @@ -1110,6 +1772,12 @@ dependencies = [ "num_cpus", ] +[[package]] +name = "redox_syscall" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" + [[package]] name = "regex" version = "1.3.9" @@ -1137,12 +1805,73 @@ version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi 0.3.9", +] + +[[package]] +name = "reqwest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12427a5577082c24419c9c417db35cfeb65962efc7675bb6b0d5f1f9d315bfe6" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "http", + "http-body", + "hyper", + "hyper-tls", + "ipnet", + "js-sys", + "lazy_static", + "log", + "mime", + "mime_guess", + "native-tls", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-tls", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", +] + +[[package]] +name = "rocksdb" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12069b106981c6103d3eab7dd1c86751482d0779a520b7c14954c8b586c1e643" +dependencies = [ + "libc", + "librocksdb-sys", +] + [[package]] name = "rustc-demangle" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" +[[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" @@ -1179,12 +1908,45 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "schannel" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" +dependencies = [ + "lazy_static", + "winapi 0.3.9", +] + [[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "security-framework" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64808902d7d99f78eaddd2b4e2509713babc3dc3c85ad6f4c447680f3c01e535" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17bf11d99252f512695eb468de5516e5cf75455521e69dfe343f3b74e4748405" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "semver" version = "0.9.0" @@ -1241,6 +2003,18 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_urlencoded" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" +dependencies = [ + "dtoa", + "itoa", + "serde", + "url", +] + [[package]] name = "sha-1" version = "0.8.2" @@ -1266,6 +2040,22 @@ dependencies = [ "opaque-debug 0.3.0", ] +[[package]] +name = "shlex" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" + +[[package]] +name = "signal-hook-registry" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e12110bc539e657a646068aaf5eb5b63af9d0c1f7b29c97113fad80e15f035" +dependencies = [ + "arc-swap", + "libc", +] + [[package]] name = "single" version = "1.0.0" @@ -1275,6 +2065,12 @@ dependencies = [ "failure", ] +[[package]] +name = "slab" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" + [[package]] name = "smallvec" version = "1.4.1" @@ -1295,10 +2091,52 @@ dependencies = [ "rayon", "sha2", "smallvec", - "snarkos-errors", - "snarkos-models", - "snarkos-profiler", - "snarkos-utilities", + "snarkos-errors 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-models 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-profiler 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-utilities 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", +] + +[[package]] +name = "snarkos-algorithms" +version = "0.8.0" +dependencies = [ + "blake2", + "derivative", + "digest 0.8.1", + "itertools 0.9.0", + "rand", + "rand_chacha", + "rayon", + "sha2", + "smallvec", + "snarkos-errors 0.8.0", + "snarkos-models 0.8.0", + "snarkos-profiler 0.8.0", + "snarkos-utilities 0.8.0", +] + +[[package]] +name = "snarkos-consensus" +version = "0.8.0" +dependencies = [ + "bincode", + "chrono", + "hex", + "log", + "rand", + "serde", + "snarkos-algorithms 0.8.0", + "snarkos-curves 0.8.0", + "snarkos-dpc 0.8.0", + "snarkos-errors 0.8.0", + "snarkos-models 0.8.0", + "snarkos-objects 0.8.0", + "snarkos-posw", + "snarkos-profiler 0.8.0", + "snarkos-storage", + "snarkos-utilities 0.8.0", + "tokio", ] [[package]] @@ -1311,9 +2149,23 @@ dependencies = [ "rand_xorshift", "rustc_version", "serde", - "snarkos-errors", - "snarkos-models", - "snarkos-utilities", + "snarkos-errors 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-models 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-utilities 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", +] + +[[package]] +name = "snarkos-curves" +version = "0.8.0" +dependencies = [ + "derivative", + "rand", + "rand_xorshift", + "rustc_version", + "serde", + "snarkos-errors 0.8.0", + "snarkos-models 0.8.0", + "snarkos-utilities 0.8.0", ] [[package]] @@ -1326,6 +2178,15 @@ dependencies = [ "syn 1.0.36", ] +[[package]] +name = "snarkos-derives" +version = "0.1.0" +dependencies = [ + "proc-macro2 1.0.19", + "quote 1.0.7", + "syn 1.0.36", +] + [[package]] name = "snarkos-dpc" version = "0.8.0" @@ -1336,15 +2197,35 @@ dependencies = [ "hex", "itertools 0.9.0", "rand", - "snarkos-algorithms", - "snarkos-curves", - "snarkos-errors", - "snarkos-gadgets", - "snarkos-models", - "snarkos-objects", - "snarkos-parameters", - "snarkos-profiler", - "snarkos-utilities", + "snarkos-algorithms 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-curves 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-errors 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-gadgets 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-models 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-objects 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-parameters 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-profiler 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-utilities 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", +] + +[[package]] +name = "snarkos-dpc" +version = "0.8.0" +dependencies = [ + "blake2", + "derivative", + "hex", + "itertools 0.9.0", + "rand", + "snarkos-algorithms 0.8.0", + "snarkos-curves 0.8.0", + "snarkos-errors 0.8.0", + "snarkos-gadgets 0.8.0", + "snarkos-models 0.8.0", + "snarkos-objects 0.8.0", + "snarkos-parameters 0.8.0", + "snarkos-profiler 0.8.0", + "snarkos-utilities 0.8.0", ] [[package]] @@ -1360,6 +2241,20 @@ dependencies = [ "thiserror", ] +[[package]] +name = "snarkos-errors" +version = "0.8.0" +dependencies = [ + "base58", + "bech32", + "bincode", + "curl", + "hex", + "jsonrpc-core", + "rocksdb", + "thiserror", +] + [[package]] name = "snarkos-gadgets" version = "0.8.0" @@ -1368,11 +2263,44 @@ dependencies = [ "derivative", "digest 0.8.1", "itertools 0.9.0", - "snarkos-algorithms", - "snarkos-curves", - "snarkos-errors", - "snarkos-models", - "snarkos-utilities", + "snarkos-algorithms 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-curves 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-errors 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-models 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-utilities 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", +] + +[[package]] +name = "snarkos-gadgets" +version = "0.8.0" +dependencies = [ + "derivative", + "digest 0.8.1", + "itertools 0.9.0", + "snarkos-algorithms 0.8.0", + "snarkos-curves 0.8.0", + "snarkos-errors 0.8.0", + "snarkos-models 0.8.0", + "snarkos-utilities 0.8.0", +] + +[[package]] +name = "snarkos-marlin" +version = "0.1.0" +dependencies = [ + "blake2", + "derivative", + "digest 0.8.1", + "rand_chacha", + "rand_core", + "rayon", + "snarkos-algorithms 0.8.0", + "snarkos-errors 0.8.0", + "snarkos-gadgets 0.8.0", + "snarkos-models 0.8.0", + "snarkos-polycommit", + "snarkos-profiler 0.8.0", + "snarkos-utilities 0.8.0", ] [[package]] @@ -1387,8 +2315,45 @@ dependencies = [ "rand_xorshift", "serde", "smallvec", - "snarkos-errors", - "snarkos-utilities", + "snarkos-errors 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-utilities 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", +] + +[[package]] +name = "snarkos-models" +version = "0.8.0" +dependencies = [ + "bincode", + "derivative", + "itertools 0.9.0", + "rand", + "rand_xorshift", + "serde", + "smallvec", + "snarkos-errors 0.8.0", + "snarkos-utilities 0.8.0", +] + +[[package]] +name = "snarkos-network" +version = "0.8.0" +dependencies = [ + "bincode", + "byteorder", + "chrono", + "hex", + "log", + "rand", + "serde", + "snarkos-algorithms 0.8.0", + "snarkos-consensus", + "snarkos-dpc 0.8.0", + "snarkos-errors 0.8.0", + "snarkos-models 0.8.0", + "snarkos-objects 0.8.0", + "snarkos-storage", + "snarkos-utilities 0.8.0", + "tokio", ] [[package]] @@ -1405,11 +2370,31 @@ dependencies = [ "rand", "serde", "sha2", - "snarkos-algorithms", - "snarkos-curves", - "snarkos-errors", - "snarkos-models", - "snarkos-utilities", + "snarkos-algorithms 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-curves 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-errors 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-models 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-utilities 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", +] + +[[package]] +name = "snarkos-objects" +version = "0.8.0" +dependencies = [ + "base58", + "bech32", + "chrono", + "derivative", + "hex", + "once_cell", + "rand", + "serde", + "sha2", + "snarkos-algorithms 0.8.0", + "snarkos-curves 0.8.0", + "snarkos-errors 0.8.0", + "snarkos-models 0.8.0", + "snarkos-utilities 0.8.0", ] [[package]] @@ -1418,10 +2403,56 @@ version = "0.8.0" source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#8d84d89f6b6c3b4693d3c08758cce28139910807" dependencies = [ "hex", - "snarkos-algorithms", - "snarkos-errors", - "snarkos-models", - "snarkos-utilities", + "snarkos-algorithms 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-errors 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-models 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-utilities 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", +] + +[[package]] +name = "snarkos-parameters" +version = "0.8.0" +dependencies = [ + "curl", + "hex", + "snarkos-algorithms 0.8.0", + "snarkos-errors 0.8.0", + "snarkos-models 0.8.0", + "snarkos-utilities 0.8.0", +] + +[[package]] +name = "snarkos-polycommit" +version = "0.1.0" +dependencies = [ + "derivative", + "digest 0.8.1", + "rand_core", + "snarkos-algorithms 0.8.0", + "snarkos-errors 0.8.0", + "snarkos-models 0.8.0", + "snarkos-profiler 0.8.0", + "snarkos-utilities 0.8.0", +] + +[[package]] +name = "snarkos-posw" +version = "0.8.0" +dependencies = [ + "blake2", + "rand", + "snarkos-algorithms 0.8.0", + "snarkos-curves 0.8.0", + "snarkos-errors 0.8.0", + "snarkos-gadgets 0.8.0", + "snarkos-marlin", + "snarkos-models 0.8.0", + "snarkos-objects 0.8.0", + "snarkos-parameters 0.8.0", + "snarkos-polycommit", + "snarkos-profiler 0.8.0", + "snarkos-utilities 0.8.0", + "thiserror", ] [[package]] @@ -1429,6 +2460,50 @@ name = "snarkos-profiler" version = "0.8.0" source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#8d84d89f6b6c3b4693d3c08758cce28139910807" +[[package]] +name = "snarkos-profiler" +version = "0.8.0" + +[[package]] +name = "snarkos-storage" +version = "0.8.0" +dependencies = [ + "bincode", + "hex", + "parking_lot", + "rand", + "rocksdb", + "serde", + "snarkos-algorithms 0.8.0", + "snarkos-errors 0.8.0", + "snarkos-models 0.8.0", + "snarkos-objects 0.8.0", + "snarkos-parameters 0.8.0", + "snarkos-utilities 0.8.0", +] + +[[package]] +name = "snarkos-testing" +version = "0.8.0" +dependencies = [ + "once_cell", + "rand", + "rand_xorshift", + "snarkos-algorithms 0.8.0", + "snarkos-consensus", + "snarkos-curves 0.8.0", + "snarkos-dpc 0.8.0", + "snarkos-errors 0.8.0", + "snarkos-models 0.8.0", + "snarkos-network", + "snarkos-objects 0.8.0", + "snarkos-parameters 0.8.0", + "snarkos-posw", + "snarkos-storage", + "snarkos-utilities 0.8.0", + "tokio", +] + [[package]] name = "snarkos-utilities" version = "0.8.0" @@ -1436,8 +2511,30 @@ source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#8d84d89f6b6c3b4693d3c08758 dependencies = [ "bincode", "rand", - "snarkos-derives", - "snarkos-errors", + "snarkos-derives 0.1.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", + "snarkos-errors 0.8.0 (git+ssh://git@github.com/AleoHQ/snarkOS.git)", +] + +[[package]] +name = "snarkos-utilities" +version = "0.8.0" +dependencies = [ + "bincode", + "rand", + "snarkos-derives 0.1.0", + "snarkos-errors 0.8.0", +] + +[[package]] +name = "socket2" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "winapi 0.3.9", ] [[package]] @@ -1486,6 +2583,20 @@ dependencies = [ "unicode-xid 0.2.1", ] +[[package]] +name = "tempfile" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" +dependencies = [ + "cfg-if", + "libc", + "rand", + "redox_syscall", + "remove_dir_all", + "winapi 0.3.9", +] + [[package]] name = "termcolor" version = "1.1.0" @@ -1540,7 +2651,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" dependencies = [ "libc", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1553,6 +2664,71 @@ dependencies = [ "serde_json", ] +[[package]] +name = "tinyvec" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53953d2d3a5ad81d9f844a32f14ebb121f50b650cd59d0ee2a07cf13c617efed" + +[[package]] +name = "tokio" +version = "0.2.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d34ca54d84bf2b5b4d7d31e901a8464f7b60ac145a284fba25ceb801f2ddccd" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "iovec", + "lazy_static", + "libc", + "memchr", + "mio", + "mio-named-pipes", + "mio-uds", + "num_cpus", + "pin-project-lite", + "signal-hook-registry", + "slab", + "tokio-macros", + "winapi 0.3.9", +] + +[[package]] +name = "tokio-macros" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" +dependencies = [ + "proc-macro2 1.0.19", + "quote 1.0.7", + "syn 1.0.36", +] + +[[package]] +name = "tokio-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a70f4fcd7b3b24fb194f837560168208f669ca8cb70d0c4b862944452396343" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "log", + "pin-project-lite", + "tokio", +] + [[package]] name = "toml" version = "0.5.6" @@ -1562,6 +2738,38 @@ dependencies = [ "serde", ] +[[package]] +name = "tower-service" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" + +[[package]] +name = "tracing" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d79ca061b032d6ce30c660fded31189ca0b9922bf483cd70759f13a2d86786c" +dependencies = [ + "cfg-if", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db63662723c316b43ca36d833707cc93dff82a02ba3d7e354f342682cc8b3545" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "try-lock" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" + [[package]] name = "typenum" version = "1.12.0" @@ -1574,6 +2782,33 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" +[[package]] +name = "unicase" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +dependencies = [ + "version_check", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" +dependencies = [ + "matches", +] + +[[package]] +name = "unicode-normalization" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb19cf769fa8c6a80a162df694621ebeb4dafb606470b2b2fce0be40a98a977" +dependencies = [ + "tinyvec", +] + [[package]] name = "unicode-width" version = "0.1.8" @@ -1592,6 +2827,23 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +[[package]] +name = "url" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb" +dependencies = [ + "idna", + "matches", + "percent-encoding", +] + +[[package]] +name = "vcpkg" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c" + [[package]] name = "vec_map" version = "0.8.2" @@ -1617,10 +2869,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" dependencies = [ "same-file", - "winapi", + "winapi 0.3.9", "winapi-util", ] +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" @@ -1634,6 +2896,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0563a9a4b071746dd5aedbc3a28c6fe9be4586fb3fbadb67c400d4f53c6b16c" dependencies = [ "cfg-if", + "serde", + "serde_json", "wasm-bindgen-macro", ] @@ -1652,6 +2916,18 @@ dependencies = [ "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95f8d235a77f880bcef268d379810ea6c0af2eacfa90b1ad5af731776e0c4699" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.67" @@ -1691,6 +2967,21 @@ 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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" + [[package]] name = "winapi" version = "0.3.9" @@ -1701,6 +2992,12 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" + [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -1713,7 +3010,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1722,6 +3019,25 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "winreg" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" +dependencies = [ + "winapi 0.3.9", +] + +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + [[package]] name = "zip" version = "0.5.6" diff --git a/Cargo.toml b/Cargo.toml index fa922b9269..b3e2efe251 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,13 +13,14 @@ name = "leo" path = "leo/main.rs" [workspace] -members = [ "ast", "compiler", "gadgets", "input", "linter", "package", "typed" ] +members = [ "ast", "compiler", "gadgets", "input", "linter", "package", "typed", "state"] [dependencies] leo-compiler = { path = "compiler", version = "0.1.0" } leo-gadgets = { path = "gadgets", version = "0.1.0" } leo-input = { path = "input", version = "0.1.0" } leo-package = { path = "package", version = "0.1.0" } +leo-state = { path = "state", version = "0.1.0" } 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 } diff --git a/state/Cargo.toml b/state/Cargo.toml new file mode 100644 index 0000000000..3099b9d9ac --- /dev/null +++ b/state/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "leo-state" +version = "0.1.0" +authors = ["The Aleo Team "] +edition = "2018" + +[dependencies] +leo-input = { path = "../input", version = "0.1.0" } +leo-typed = { path = "../typed", version = "0.1.0" } + +snarkos-algorithms = { path = "../../snarkOS/algorithms" } +snarkos-curves = { path = "../../snarkOS/curves" } +snarkos-dpc = { path = "../../snarkOS/dpc" } +snarkos-errors = { path = "../../snarkOS/errors" } +snarkos-models = { path = "../../snarkOS/models" } +snarkos-objects = { path = "../../snarkOS/objects" } +snarkos-utilities = { path = "../../snarkOS/utilities" } + +rand = { version = "0.7" } +rand_xorshift = { version = "0.2" } +thiserror = { version = "1.0" } + + +[dev-dependencies] +snarkos-testing = { path = "../../snarkOS/testing" } diff --git a/state/src/errors/error.rs b/state/src/errors/error.rs new file mode 100644 index 0000000000..064d1486d3 --- /dev/null +++ b/state/src/errors/error.rs @@ -0,0 +1,5 @@ +// +// #[derive(Debug, Error)] +// pub enum VerifyError { +// +// } diff --git a/state/src/errors/mod.rs b/state/src/errors/mod.rs new file mode 100644 index 0000000000..1521dadc27 --- /dev/null +++ b/state/src/errors/mod.rs @@ -0,0 +1,5 @@ +pub mod error; +pub use self::error::*; + +pub mod record_verification_error; +pub use self::record_verification_error::*; diff --git a/state/src/errors/record_verification_error.rs b/state/src/errors/record_verification_error.rs new file mode 100644 index 0000000000..7a64cb5442 --- /dev/null +++ b/state/src/errors/record_verification_error.rs @@ -0,0 +1,30 @@ +use snarkos_errors::{algorithms::CommitmentError, objects::account::AccountError}; + +use std::{io::Error as IOError, num::ParseIntError, str::ParseBoolError}; + +#[derive(Debug, Error)] +pub enum RecordVerificationError { + #[error("{}", _0)] + AccountError(#[from] AccountError), + + #[error("{}", _0)] + CommitmentError(#[from] CommitmentError), + + #[error("expected parameter array of u8 bytes, found `{}`", _0)] + ExpectedBytes(String), + + #[error("expected integer parameter, found `{}`", _0)] + ExpectedInteger(String), + + #[error("{}", _0)] + IOError(#[from] IOError), + + #[error("record parameter `{}` not found in state file", _0)] + MissingParameter(String), + + #[error("{}", _0)] + ParseBoolError(#[from] ParseBoolError), + + #[error("{}", _0)] + ParseIntError(#[from] ParseIntError), +} diff --git a/state/src/lib.rs b/state/src/lib.rs new file mode 100644 index 0000000000..ff055bd082 --- /dev/null +++ b/state/src/lib.rs @@ -0,0 +1,11 @@ +#[macro_use] +extern crate thiserror; + +pub mod errors; +pub use self::errors::*; + +pub mod local_data_commitment; +pub use self::local_data_commitment::*; + +pub mod record_commitment; +pub use self::record_commitment::*; diff --git a/state/src/local_data_commitment/mod.rs b/state/src/local_data_commitment/mod.rs new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/state/src/local_data_commitment/mod.rs @@ -0,0 +1 @@ + diff --git a/state/src/local_data_commitment/verify_local_data_commitment.rs b/state/src/local_data_commitment/verify_local_data_commitment.rs new file mode 100644 index 0000000000..e69de29bb2 diff --git a/state/src/record_commitment/dpc_record_values.rs b/state/src/record_commitment/dpc_record_values.rs new file mode 100644 index 0000000000..d077f1ed3b --- /dev/null +++ b/state/src/record_commitment/dpc_record_values.rs @@ -0,0 +1,123 @@ +use crate::RecordVerificationError; +use leo_typed::{InputValue, Record as TypedRecord}; + +use snarkos_dpc::base_dpc::instantiated::Components; +use snarkos_objects::AccountAddress; +use std::{convert::TryFrom, str::FromStr}; + +static OWNER_PARAMETER_STRING: &str = "owner"; +static IS_DUMMY_PARAMETER_STRING: &str = "is_dummy"; +static VALUE_PARAMETER_STRING: &str = "value"; +static PAYLOAD_PARAMETER_STRING: &str = "parameter"; +static BIRTH_PROGRAM_ID_PARAMETER_STRING: &str = "birth_program_id"; +static DEATH_PROGRAM_ID_PARAMETER_STRING: &str = "death_program_id"; +static SERIAL_NUMBER_NONCE_PARAMETER_STRING: &str = "serial_number_nonce"; +static COMMITMENT_PARAMETER_STRING: &str = "commitment"; +static COMMITMENT_RANDOMNESS_PARAMETER_STRING: &str = "commitment_randomness"; + +pub struct DPCRecordValues { + pub owner: AccountAddress, + pub is_dummy: bool, + pub value: u64, + pub payload: Vec, + pub birth_program_id: Vec, + pub death_program_id: Vec, + pub serial_number_nonce: Vec, + pub commitment: Vec, + pub commitment_randomness: Vec, +} + +impl TryFrom for DPCRecordValues { + type Error = RecordVerificationError; + + fn try_from(record: TypedRecord) -> Result { + // Lookup record owner + let owner_value = get_parameter_value(OWNER_PARAMETER_STRING.to_owned(), &record)?; + let owner = AccountAddress::::from_str(&format!("{}", owner_value))?; + + // Lookup record is_dummy + let is_dummy_value = get_parameter_value(IS_DUMMY_PARAMETER_STRING.to_owned(), &record)?; + let is_dummy = is_dummy_value.to_string().parse::()?; + + // Lookup record value + let value_value = get_parameter_value(VALUE_PARAMETER_STRING.to_owned(), &record)?; + let value = input_to_integer_string(value_value)?.parse::()?; + + // Lookup record payload + let payload_value = get_parameter_value(PAYLOAD_PARAMETER_STRING.to_owned(), &record)?; + let payload = input_to_u8_vec(payload_value)?; + + // Lookup record birth program id + let birth_program_id_value = get_parameter_value(BIRTH_PROGRAM_ID_PARAMETER_STRING.to_owned(), &record)?; + let birth_program_id = input_to_u8_vec(birth_program_id_value)?; + + // Lookup record death program id + let death_program_id_value = get_parameter_value(DEATH_PROGRAM_ID_PARAMETER_STRING.to_owned(), &record)?; + let death_program_id = input_to_u8_vec(death_program_id_value)?; + + // Lookup record serial number nonce + let serial_number_nonce_value = get_parameter_value(SERIAL_NUMBER_NONCE_PARAMETER_STRING.to_owned(), &record)?; + let serial_number_nonce = input_to_u8_vec(serial_number_nonce_value)?; + + // Lookup record commitment + let commitment_value = get_parameter_value(COMMITMENT_PARAMETER_STRING.to_owned(), &record)?; + let commitment = input_to_u8_vec(commitment_value)?; + + // Lookup record commitment randomness + let commitment_randomness_value = + get_parameter_value(COMMITMENT_RANDOMNESS_PARAMETER_STRING.to_owned(), &record)?; + let commitment_randomness = input_to_u8_vec(commitment_randomness_value)?; + + Ok(Self { + owner, + is_dummy, + value, + payload, + birth_program_id, + death_program_id, + serial_number_nonce, + commitment, + commitment_randomness, + }) + } +} + +fn get_parameter_value(name: String, record: &TypedRecord) -> Result { + let parameters = record.values(); + let matched_parameter = parameters + .iter() + .find(|(parameter, _value)| parameter.variable.name == name); + + match matched_parameter { + Some((_parameter, value_option)) => match value_option { + Some(value) => Ok(value.clone()), + None => Err(RecordVerificationError::MissingParameter(name)), + }, + None => Err(RecordVerificationError::MissingParameter(name)), + } +} + +fn input_to_integer_string(input: InputValue) -> Result { + match input { + InputValue::Integer(_type, string) => Ok(string), + value => Err(RecordVerificationError::ExpectedInteger(value.to_string())), + } +} + +fn input_to_u8_vec(input: InputValue) -> Result, RecordVerificationError> { + let input_array = match input { + InputValue::Array(values) => values, + value => return Err(RecordVerificationError::ExpectedBytes(value.to_string())), + }; + + let mut result_vec = vec![]; + + for input in input_array { + let integer_string = input_to_integer_string(input)?; + let byte = integer_string.parse::()?; + + result_vec.push(byte); + } + + Ok(result_vec) +} diff --git a/state/src/record_commitment/mod.rs b/state/src/record_commitment/mod.rs new file mode 100644 index 0000000000..9f92e4a742 --- /dev/null +++ b/state/src/record_commitment/mod.rs @@ -0,0 +1,5 @@ +pub mod dpc_record_values; +pub use self::dpc_record_values::*; + +pub mod verify_record_commitment; +pub use self::verify_record_commitment::*; diff --git a/state/src/record_commitment/verify_record_commitment.rs b/state/src/record_commitment/verify_record_commitment.rs new file mode 100644 index 0000000000..13e1cd1b13 --- /dev/null +++ b/state/src/record_commitment/verify_record_commitment.rs @@ -0,0 +1,35 @@ +use crate::{DPCRecordValues, RecordVerificationError}; +use leo_typed::Record as TypedRecord; + +use snarkos_dpc::base_dpc::instantiated::RecordCommitment; +use snarkos_models::{algorithms::CommitmentScheme, curves::Fp256}; +use snarkos_utilities::{bytes::ToBytes, to_bytes, FromBytes}; +use std::convert::TryFrom; + +pub fn verify_record_commitment( + typed_record: TypedRecord, + record_commitment: RecordCommitment, +) -> Result { + // generate a dpc record from the typed record + let record = DPCRecordValues::try_from(typed_record)?; + + let record_commitment_input = to_bytes![ + record.owner, + record.is_dummy, + record.value, + record.payload, + record.birth_program_id, + record.death_program_id, + record.serial_number_nonce + ]?; + + let commitment = Fp256::read(&record.commitment[..])?; + let commitment_randomness = Fp256::read(&record.commitment_randomness[..])?; + + let record_commitment = + RecordCommitment::commit(&record_commitment, &record_commitment_input, &commitment_randomness)?; + + let result = record_commitment == commitment; + + Ok(result) +} diff --git a/state/tests/mod.rs b/state/tests/mod.rs new file mode 100644 index 0000000000..981d4655af --- /dev/null +++ b/state/tests/mod.rs @@ -0,0 +1 @@ +// mod test; diff --git a/state/tests/test.rs b/state/tests/test.rs new file mode 100644 index 0000000000..9666a7e12f --- /dev/null +++ b/state/tests/test.rs @@ -0,0 +1,316 @@ +use snarkos_curves::edwards_bls12::{EdwardsParameters, EdwardsProjective as EdwardsBls}; +use snarkos_dpc::base_dpc::{ + instantiated::*, + record_encryption::*, + record_payload::RecordPayload, + record_serializer::*, + BaseDPCComponents, + ExecuteContext, + DPC, +}; +use snarkos_models::{ + algorithms::{CommitmentScheme, CRH}, + dpc::{Record, RecordSerializerScheme}, + objects::AccountScheme, +}; +use snarkos_objects::{ + Account, + AccountViewKey, + Block, + BlockHeader, + BlockHeaderHash, + DPCTransactions, + MerkleRootHash, + PedersenMerkleRootHash, + ProofOfSuccinctWork, +}; +use snarkos_utilities::{bytes::ToBytes, rand::UniformRand, to_bytes}; + +use rand::{Rng, SeedableRng}; +use rand_xorshift::XorShiftRng; +use snarkos_algorithms::commitment_tree::CommitmentMerklePath; +use snarkos_dpc::{DummyProgram, NoopProgram}; +use snarkos_models::{ + algorithms::MerkleParameters, + dpc::{DPCScheme, Program}, + objects::LedgerScheme, +}; + +#[test] +fn test_integrate_with_dpc() { + use snarkos_testing::storage::*; + type L = Ledger; + + 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 ledger_parameters = CommitmentMerkleParameters::setup(&mut rng); + 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 dummy_program_snark_pp = + InstantiatedDPC::generate_dummy_program_snark_parameters(&system_parameters, &mut rng).unwrap(); + + let noop_program_id = to_bytes![ + ProgramVerificationKeyHash::hash( + &system_parameters.program_verification_key_hash, + &to_bytes![noop_program_snark_pp.verification_key].unwrap() + ) + .unwrap() + ] + .unwrap(); + + let dummy_program_id = to_bytes![ + ProgramVerificationKeyHash::hash( + &system_parameters.program_verification_key_hash, + &to_bytes![dummy_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 genesis_block = Block { + header: BlockHeader { + previous_block_hash: BlockHeaderHash([0u8; 32]), + merkle_root_hash: MerkleRootHash([0u8; 32]), + time: 0, + difficulty_target: 0x07FF_FFFF_FFFF_FFFF_u64, + nonce: 0, + pedersen_merkle_root_hash: PedersenMerkleRootHash([0u8; 32]), + proof: ProofOfSuccinctWork::default(), + }, + transactions: DPCTransactions::new(), + }; + + // Use genesis record, serial number, and memo to initialize the ledger. + let ledger = initialize_test_blockchain::(ledger_parameters, genesis_block); + + let sn_nonce = SerialNumberNonce::hash(&system_parameters.serial_number_nonce, &[0u8; 1]).unwrap(); + // let old_record = DPC::generate_record( + // &system_parameters, + // &sn_nonce, + // &dummy_account.address, + // true, + // 0, + // &RecordPayload::default(), + // &dummy_program_id, + // &dummy_program_id, + // &mut rng, + // ) + // .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, + &noop_program_id, + &mut rng, + ) + .unwrap(); + + // Set the input records for our transaction to be the initial dummy records. + let old_records = vec![old_record.clone(); NUM_INPUT_RECORDS]; + let old_account_private_keys = vec![dummy_account.private_key.clone(); 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.clone(); 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.clone(); NUM_OUTPUT_RECORDS]; + let memo = [0u8; 32]; + + let context = >::execute_offline( + &system_parameters, + &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(); + + for (i, record) in local_data.old_records.iter().enumerate() { + println!("{} : {}", i, record.is_dummy()); + } + + ////////////////////////////////////////////////////////////// + // Todo: parse state from file instead of DPC::generate_record + // compare commitments + /* + let commitment = Commit( + record.owner, + record.value, + record.payload, + record.is_dummy, + record.birth_program_id, + record.death_program_id, + record.serial_number_nonce, + record.commitment_randomness, + ); + + record.commitment == commitment + */ + + let record_commitment_input = to_bytes![ + old_record.owner(), + old_record.is_dummy(), + old_record.value(), + old_record.payload(), + old_record.birth_program_id(), + old_record.death_program_id(), + old_record.serial_number_nonce() + ] + .unwrap(); + + let record_commitment = RecordCommitment::commit( + &system_parameters.record_commitment, + &record_commitment_input, + &old_record.commitment_randomness(), + ) + .unwrap(); + + assert_eq!(record_commitment, old_record.commitment()); + + ////////////////////////////////////////////////////////////// + + // Verify local data commitment + + // let leaf_index = 0; + // let root = local_data.local_data_merkle_tree.root(); + // + // let path = ledger.prove_cm(&old_record.commitment()).unwrap(); + // let memo = local_data.memorandum; + // let network_id = local_data.network_id; + // let leaf_randomness = local_data.local_data_commitment_randomizers[0].clone(); + + // Verify that the local data commitment leaf is valid for the root + + // let path = ledger.prove_cm(&record.commitment()).unwrap(); + // let digest = ledger.digest().unwrap(); + // let verified = path.verify(&digest, &record.commitment()).unwrap(); + + ///////////////////////////////////////////////// + + // Generate the program proofs + + // let noop_program = NoopProgram::<_, ::NoopProgramSNARK>::new(noop_program_id); + // let dummy_program = DummyProgram::<_, ::DummyProgramSNARK>::new(dummy_program_id); + // + // let mut old_proof_and_vk = vec![]; + // for i in 0..NUM_INPUT_RECORDS { + // let private_input = dummy_program + // .execute( + // &dummy_program_snark_pp.proving_key, + // &dummy_program_snark_pp.verification_key, + // &local_data, + // i as u8, + // &mut rng, + // ) + // .unwrap(); + // + // old_proof_and_vk.push(private_input); + // } + // + // let mut new_proof_and_vk = vec![]; + // for j in 0..NUM_OUTPUT_RECORDS { + // let private_input = noop_program + // .execute( + // &noop_program_snark_pp.proving_key, + // &noop_program_snark_pp.verification_key, + // &local_data, + // (NUM_INPUT_RECORDS + j) as u8, + // &mut rng, + // ) + // .unwrap(); + // + // new_proof_and_vk.push(private_input); + // } + // + // let ExecuteContext { + // system_parameters: _, + // + // old_records, + // old_account_private_keys, + // old_serial_numbers, + // old_randomizers: _, + // + // new_records, + // new_sn_nonce_randomness, + // new_commitments, + // + // new_records_encryption_randomness, + // new_encrypted_records: _, + // new_encrypted_record_hashes, + // + // program_commitment, + // program_randomness, + // local_data_merkle_tree, + // local_data_commitment_randomizers, + // value_balance, + // memorandum, + // network_id, + // } = context; + // + // let local_data_root = local_data_merkle_tree.root(); + + // Verify that the local data commitment leaf is valid for the root + + // let local_data_commitment = LocalDataCommitment::commit( + // &system_parameters.local_data_commitment, + // + // ) + + // let merkle = CommitmentMerklePath::verify( + // system_parameters.local_data_commitment + // state.root + // state.path + // ) + + // system_parameters.local_data_commitment +}