Merge branch 'AleoHQ:testnet3' into testnet3

This commit is contained in:
Tom-OriginStorage 2022-11-05 15:25:58 +08:00 committed by GitHub
commit 0e00ed4eaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 364 additions and 181 deletions

252
Cargo.lock generated
View File

@ -71,7 +71,7 @@ dependencies = [
[[package]] [[package]]
name = "aleo" name = "aleo"
version = "0.2.0" version = "0.2.0"
source = "git+https://github.com/AleoHQ/aleo.git?rev=28cc7f5#28cc7f5f0460cb22a532051b94b8dbfbc0c43282" source = "git+https://github.com/AleoHQ/aleo.git?rev=07e322b#07e322b1287defa9bdeb0f43ca0aa4d1c748006b"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"clap", "clap",
@ -264,6 +264,15 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "blake2"
version = "0.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9cf849ee05b2ee5fba5e36f97ff8ec2533916700fc0758d40d92136a42f3388"
dependencies = [
"digest",
]
[[package]] [[package]]
name = "blake2s_simd" name = "blake2s_simd"
version = "1.0.0" version = "1.0.0"
@ -1663,9 +1672,9 @@ dependencies = [
[[package]] [[package]]
name = "password-hash" name = "password-hash"
version = "0.3.2" version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d791538a6dcc1e7cb7fe6f6b58aca40e7f79403c45b2bc274008b5e647af1d8" checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700"
dependencies = [ dependencies = [
"base64ct", "base64ct",
"rand_core", "rand_core",
@ -1680,9 +1689,9 @@ checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1"
[[package]] [[package]]
name = "pbkdf2" name = "pbkdf2"
version = "0.10.1" version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "271779f35b581956db91a3e55737327a03aa051e90b1c47aeb189508533adfd7" checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917"
dependencies = [ dependencies = [
"digest", "digest",
"hmac", "hmac",
@ -2125,9 +2134,9 @@ dependencies = [
[[package]] [[package]]
name = "scoped-tls" name = "scoped-tls"
version = "1.0.0" version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
[[package]] [[package]]
name = "scopeguard" name = "scopeguard"
@ -2310,8 +2319,8 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm" name = "snarkvm"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"clap", "clap",
@ -2323,12 +2332,12 @@ dependencies = [
"rayon", "rayon",
"self_update", "self_update",
"serde_json", "serde_json",
"snarkvm-algorithms",
"snarkvm-circuit", "snarkvm-circuit",
"snarkvm-compiler",
"snarkvm-console", "snarkvm-console",
"snarkvm-fields", "snarkvm-fields",
"snarkvm-parameters", "snarkvm-parameters",
"snarkvm-rest", "snarkvm-synthesizer",
"snarkvm-utilities", "snarkvm-utilities",
"thiserror", "thiserror",
"ureq", "ureq",
@ -2337,8 +2346,8 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-algorithms" name = "snarkvm-algorithms"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"aleo-std", "aleo-std",
"anyhow", "anyhow",
@ -2363,8 +2372,8 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-circuit" name = "snarkvm-circuit"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"snarkvm-circuit-account", "snarkvm-circuit-account",
"snarkvm-circuit-algorithms", "snarkvm-circuit-algorithms",
@ -2377,8 +2386,8 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-circuit-account" name = "snarkvm-circuit-account"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"snarkvm-circuit-algorithms", "snarkvm-circuit-algorithms",
"snarkvm-circuit-network", "snarkvm-circuit-network",
@ -2388,8 +2397,8 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-circuit-algorithms" name = "snarkvm-circuit-algorithms"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"snarkvm-circuit-types", "snarkvm-circuit-types",
"snarkvm-console-algorithms", "snarkvm-console-algorithms",
@ -2398,8 +2407,8 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-circuit-collections" name = "snarkvm-circuit-collections"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"snarkvm-circuit-algorithms", "snarkvm-circuit-algorithms",
"snarkvm-circuit-types", "snarkvm-circuit-types",
@ -2408,8 +2417,8 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-circuit-environment" name = "snarkvm-circuit-environment"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"indexmap", "indexmap",
"itertools", "itertools",
@ -2426,13 +2435,13 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-circuit-environment-witness" name = "snarkvm-circuit-environment-witness"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
[[package]] [[package]]
name = "snarkvm-circuit-network" name = "snarkvm-circuit-network"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"snarkvm-circuit-algorithms", "snarkvm-circuit-algorithms",
"snarkvm-circuit-collections", "snarkvm-circuit-collections",
@ -2442,10 +2451,11 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-circuit-program" name = "snarkvm-circuit-program"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"snarkvm-circuit-account", "snarkvm-circuit-account",
"snarkvm-circuit-collections",
"snarkvm-circuit-network", "snarkvm-circuit-network",
"snarkvm-circuit-types", "snarkvm-circuit-types",
"snarkvm-console-program", "snarkvm-console-program",
@ -2454,8 +2464,8 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-circuit-types" name = "snarkvm-circuit-types"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"snarkvm-circuit-environment", "snarkvm-circuit-environment",
"snarkvm-circuit-types-address", "snarkvm-circuit-types-address",
@ -2469,8 +2479,8 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-circuit-types-address" name = "snarkvm-circuit-types-address"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"snarkvm-circuit-environment", "snarkvm-circuit-environment",
"snarkvm-circuit-types-boolean", "snarkvm-circuit-types-boolean",
@ -2482,8 +2492,8 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-circuit-types-boolean" name = "snarkvm-circuit-types-boolean"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"snarkvm-circuit-environment", "snarkvm-circuit-environment",
"snarkvm-console-types-boolean", "snarkvm-console-types-boolean",
@ -2491,8 +2501,8 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-circuit-types-field" name = "snarkvm-circuit-types-field"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"snarkvm-circuit-environment", "snarkvm-circuit-environment",
"snarkvm-circuit-types-boolean", "snarkvm-circuit-types-boolean",
@ -2501,8 +2511,8 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-circuit-types-group" name = "snarkvm-circuit-types-group"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"snarkvm-circuit-environment", "snarkvm-circuit-environment",
"snarkvm-circuit-types-boolean", "snarkvm-circuit-types-boolean",
@ -2513,8 +2523,8 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-circuit-types-integers" name = "snarkvm-circuit-types-integers"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"snarkvm-circuit-environment", "snarkvm-circuit-environment",
"snarkvm-circuit-types-boolean", "snarkvm-circuit-types-boolean",
@ -2524,8 +2534,8 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-circuit-types-scalar" name = "snarkvm-circuit-types-scalar"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"snarkvm-circuit-environment", "snarkvm-circuit-environment",
"snarkvm-circuit-types-boolean", "snarkvm-circuit-types-boolean",
@ -2535,8 +2545,8 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-circuit-types-string" name = "snarkvm-circuit-types-string"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"snarkvm-circuit-environment", "snarkvm-circuit-environment",
"snarkvm-circuit-types-boolean", "snarkvm-circuit-types-boolean",
@ -2545,36 +2555,10 @@ dependencies = [
"snarkvm-console-types-string", "snarkvm-console-types-string",
] ]
[[package]]
name = "snarkvm-compiler"
version = "0.9.0"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76"
dependencies = [
"anyhow",
"colored",
"indexmap",
"once_cell",
"parking_lot",
"paste",
"rand",
"rayon",
"serde",
"serde_json",
"snarkvm-algorithms",
"snarkvm-circuit",
"snarkvm-console",
"snarkvm-curves",
"snarkvm-fields",
"snarkvm-parameters",
"snarkvm-utilities",
"time",
"tracing",
]
[[package]] [[package]]
name = "snarkvm-console" name = "snarkvm-console"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"snarkvm-console-account", "snarkvm-console-account",
"snarkvm-console-algorithms", "snarkvm-console-algorithms",
@ -2586,8 +2570,8 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-console-account" name = "snarkvm-console-account"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"bs58", "bs58",
"snarkvm-console-network", "snarkvm-console-network",
@ -2596,8 +2580,8 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-console-algorithms" name = "snarkvm-console-algorithms"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"blake2s_simd", "blake2s_simd",
"smallvec", "smallvec",
@ -2608,8 +2592,8 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-console-collections" name = "snarkvm-console-collections"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"aleo-std", "aleo-std",
"rayon", "rayon",
@ -2619,12 +2603,13 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-console-network" name = "snarkvm-console-network"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"itertools", "itertools",
"lazy_static", "lazy_static",
"once_cell",
"serde", "serde",
"snarkvm-algorithms", "snarkvm-algorithms",
"snarkvm-console-algorithms", "snarkvm-console-algorithms",
@ -2633,13 +2618,14 @@ dependencies = [
"snarkvm-console-types", "snarkvm-console-types",
"snarkvm-curves", "snarkvm-curves",
"snarkvm-fields", "snarkvm-fields",
"snarkvm-parameters",
"snarkvm-utilities", "snarkvm-utilities",
] ]
[[package]] [[package]]
name = "snarkvm-console-network-environment" name = "snarkvm-console-network-environment"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bech32", "bech32",
@ -2655,8 +2641,8 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-console-program" name = "snarkvm-console-program"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"enum_index", "enum_index",
"enum_index_derive", "enum_index_derive",
@ -2666,14 +2652,15 @@ dependencies = [
"once_cell", "once_cell",
"serde_json", "serde_json",
"snarkvm-console-account", "snarkvm-console-account",
"snarkvm-console-collections",
"snarkvm-console-network", "snarkvm-console-network",
"snarkvm-console-types", "snarkvm-console-types",
] ]
[[package]] [[package]]
name = "snarkvm-console-types" name = "snarkvm-console-types"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"snarkvm-console-network-environment", "snarkvm-console-network-environment",
"snarkvm-console-types-address", "snarkvm-console-types-address",
@ -2687,8 +2674,8 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-console-types-address" name = "snarkvm-console-types-address"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"snarkvm-console-network-environment", "snarkvm-console-network-environment",
"snarkvm-console-types-boolean", "snarkvm-console-types-boolean",
@ -2698,16 +2685,16 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-console-types-boolean" name = "snarkvm-console-types-boolean"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"snarkvm-console-network-environment", "snarkvm-console-network-environment",
] ]
[[package]] [[package]]
name = "snarkvm-console-types-field" name = "snarkvm-console-types-field"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"snarkvm-console-network-environment", "snarkvm-console-network-environment",
"snarkvm-console-types-boolean", "snarkvm-console-types-boolean",
@ -2715,8 +2702,8 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-console-types-group" name = "snarkvm-console-types-group"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"snarkvm-console-network-environment", "snarkvm-console-network-environment",
"snarkvm-console-types-boolean", "snarkvm-console-types-boolean",
@ -2726,8 +2713,8 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-console-types-integers" name = "snarkvm-console-types-integers"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"snarkvm-console-network-environment", "snarkvm-console-network-environment",
"snarkvm-console-types-boolean", "snarkvm-console-types-boolean",
@ -2736,8 +2723,8 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-console-types-scalar" name = "snarkvm-console-types-scalar"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"snarkvm-console-network-environment", "snarkvm-console-network-environment",
"snarkvm-console-types-boolean", "snarkvm-console-types-boolean",
@ -2746,8 +2733,8 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-console-types-string" name = "snarkvm-console-types-string"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"snarkvm-console-network-environment", "snarkvm-console-network-environment",
"snarkvm-console-types-boolean", "snarkvm-console-types-boolean",
@ -2757,8 +2744,8 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-curves" name = "snarkvm-curves"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"rand", "rand",
"rustc_version", "rustc_version",
@ -2770,8 +2757,8 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-fields" name = "snarkvm-fields"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"aleo-std", "aleo-std",
"anyhow", "anyhow",
@ -2787,13 +2774,14 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-parameters" name = "snarkvm-parameters"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"aleo-std", "aleo-std",
"anyhow", "anyhow",
"bincode", "bincode",
"cfg-if", "cfg-if",
"colored",
"curl", "curl",
"hex", "hex",
"indexmap", "indexmap",
@ -2810,8 +2798,8 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-r1cs" name = "snarkvm-r1cs"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"cfg-if", "cfg-if",
@ -2825,26 +2813,34 @@ dependencies = [
] ]
[[package]] [[package]]
name = "snarkvm-rest" name = "snarkvm-synthesizer"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"http", "blake2",
"colored",
"indexmap", "indexmap",
"once_cell",
"parking_lot", "parking_lot",
"paste",
"rand",
"rayon",
"serde", "serde",
"snarkvm-compiler", "serde_json",
"snarkvm-algorithms",
"snarkvm-circuit",
"snarkvm-console", "snarkvm-console",
"tokio", "snarkvm-curves",
"snarkvm-fields",
"snarkvm-utilities",
"tracing", "tracing",
"warp",
] ]
[[package]] [[package]]
name = "snarkvm-utilities" name = "snarkvm-utilities"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"aleo-std", "aleo-std",
"anyhow", "anyhow",
@ -2861,8 +2857,8 @@ dependencies = [
[[package]] [[package]]
name = "snarkvm-utilities-derives" name = "snarkvm-utilities-derives"
version = "0.9.0" version = "0.9.1"
source = "git+https://github.com/AleoHQ/snarkVM.git?rev=ea14990#ea1499053d5dfbbaee57e830bae5c097726dbc76" source = "git+https://github.com/AleoHQ/snarkVM.git#cb8410896ba28430e1d2588efda0cb7b60d79f11"
dependencies = [ dependencies = [
"proc-macro2 1.0.46", "proc-macro2 1.0.46",
"quote 1.0.21", "quote 1.0.21",
@ -3617,9 +3613,9 @@ dependencies = [
[[package]] [[package]]
name = "zip" name = "zip"
version = "0.6.2" version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf225bcf73bb52cbb496e70475c7bd7a3f769df699c0020f6c7bd9a96dcf0b8d" checksum = "537ce7411d25e54e8ae21a7ce0b15840e7bfcff15b51d697ec3266cc76bdf080"
dependencies = [ dependencies = [
"aes", "aes",
"byteorder", "byteorder",
@ -3637,18 +3633,18 @@ dependencies = [
[[package]] [[package]]
name = "zstd" name = "zstd"
version = "0.10.2+zstd.1.5.2" version = "0.11.2+zstd.1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f4a6bd64f22b5e3e94b4e238669ff9f10815c27a5180108b849d24174a83847" checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4"
dependencies = [ dependencies = [
"zstd-safe", "zstd-safe",
] ]
[[package]] [[package]]
name = "zstd-safe" name = "zstd-safe"
version = "4.1.6+zstd.1.5.2" version = "5.0.2+zstd.1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94b61c51bb270702d6167b8ce67340d2754b088d0c091b06e593aa772c3ee9bb" checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db"
dependencies = [ dependencies = [
"libc", "libc",
"zstd-sys", "zstd-sys",
@ -3656,9 +3652,9 @@ dependencies = [
[[package]] [[package]]
name = "zstd-sys" name = "zstd-sys"
version = "1.6.3+zstd.1.5.2" version = "2.0.1+zstd.1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc49afa5c8d634e75761feda8c592051e7eeb4683ba827211eb0d731d3402ea8" checksum = "9fd07cbbc53846d9145dbffdf6dd09a7a0aa52be46741825f5c97bdd4f73f12b"
dependencies = [ dependencies = [
"cc", "cc",
"libc", "libc",

View File

@ -65,12 +65,11 @@ version = "1.5.3"
[dependencies.aleo] [dependencies.aleo]
git = "https://github.com/AleoHQ/aleo.git" git = "https://github.com/AleoHQ/aleo.git"
rev = "28cc7f5" rev = "07e322b"
[dependencies.snarkvm] [dependencies.snarkvm]
#version = "0.9.0"
git = "https://github.com/AleoHQ/snarkVM.git" git = "https://github.com/AleoHQ/snarkVM.git"
rev = "ea14990" version = "0.9.1"
features = ["aleo-cli", "circuit", "console", "parallel"] features = ["aleo-cli", "circuit", "console", "parallel"]
[dependencies.backtrace] [dependencies.backtrace]

View File

@ -19,9 +19,10 @@ Leo is a functional, statically-typed programming language built for writing pri
* [2.1 Install Rust](#21-install-rust) * [2.1 Install Rust](#21-install-rust)
* [2.2 Build from Source Code](#22-build-from-source-code) * [2.2 Build from Source Code](#22-build-from-source-code)
* [3. Quick Start](#3-quick-start) * [3. Quick Start](#3-quick-start)
* [4. Documentation](#4-documentation) * [4. Troubleshooting](#4-troubleshooting)
* [5. Contributing](#5-contributing) * [5. Documentation](#5-documentation)
* [6. License](#6-license) * [6. Contributing](#6-contributing)
* [7. License](#7-license)
## 1. Overview ## 1. Overview
@ -93,18 +94,23 @@ The `leo run` command will compile the program into Aleo instructions and run it
Congratulations! You've just run your first Leo program. Congratulations! You've just run your first Leo program.
## 4. Documentation ## 4. Troubleshooting
If you are are having trouble installing and using Leo, please check out our [guide](docs/troubleshooting.md).
If the issue still persists, please [open an issue](https://github.com/AleoHQ/leo/issues/new/choose).
## 5. Documentation
* [Hello World - Next Steps](https://developer.aleo.org/leo/getting_started/hello_world) * [Hello World - Next Steps](https://developer.aleo.org/leo/getting_started/hello_world)
* [Leo Language Documentation](https://developer.aleo.org/leo/getting_started/overview) * [Leo Language Documentation](https://developer.aleo.org/leo/getting_started/overview)
* [Leo ABNF Grammar](./docs/grammar/abnf-grammar.txt) * [Leo ABNF Grammar](./docs/grammar/abnf-grammar.txt)
* [Homepage](https://developer.aleo.org/overview/) * [Homepage](https://developer.aleo.org/overview/)
## 5. Contributing ## 6. Contributing
Please see our guidelines in the [developer documentation](./CONTRIBUTING.md) Please see our guidelines in the [developer documentation](./CONTRIBUTING.md)
Thank you for helping make Leo better! Thank you for helping make Leo better!
## 6. License ## 7. License
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](./LICENSE.md) [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](./LICENSE.md)

View File

@ -315,7 +315,7 @@ pub trait ProgramReconstructor: StatementReconstructor {
imports: input imports: input
.imports .imports
.into_iter() .into_iter()
.map(|(id, import)| (id, self.reconstruct_import(import))) .map(|(id, import)| (id, (self.reconstruct_import(import.0), import.1)))
.collect(), .collect(),
program_scopes: input program_scopes: input
.program_scopes .program_scopes

View File

@ -193,7 +193,7 @@ pub trait StatementVisitor<'a>: ExpressionVisitor<'a> {
/// A Visitor trait for the program represented by the AST. /// A Visitor trait for the program represented by the AST.
pub trait ProgramVisitor<'a>: StatementVisitor<'a> { pub trait ProgramVisitor<'a>: StatementVisitor<'a> {
fn visit_program(&mut self, input: &'a Program) { fn visit_program(&mut self, input: &'a Program) {
input.imports.values().for_each(|import| self.visit_import(import)); input.imports.values().for_each(|import| self.visit_import(&import.0));
input input
.program_scopes .program_scopes

View File

@ -24,6 +24,8 @@ pub use program_scope::*;
use crate::Identifier; use crate::Identifier;
use leo_span::Span;
use indexmap::IndexMap; use indexmap::IndexMap;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::fmt; use std::fmt;
@ -32,7 +34,7 @@ use std::fmt;
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct Program { pub struct Program {
/// A map from import names to import definitions. /// A map from import names to import definitions.
pub imports: IndexMap<Identifier, Program>, pub imports: IndexMap<Identifier, (Program, Span)>,
/// A map from program names to program scopes. /// A map from program names to program scopes.
pub program_scopes: IndexMap<ProgramId, ProgramScope>, pub program_scopes: IndexMap<ProgramId, ProgramScope>,
} }

View File

@ -46,9 +46,8 @@ path = "../../tests/test-framework"
version = "1.4.0" version = "1.4.0"
[dev-dependencies.snarkvm] [dev-dependencies.snarkvm]
#version = "0.9.0"
git = "https://github.com/AleoHQ/snarkVM.git" git = "https://github.com/AleoHQ/snarkVM.git"
rev = "ea14990" version = "0.9.1"
features = ["aleo-cli", "circuit", "console", "parallel"] features = ["aleo-cli", "circuit", "console", "parallel"]
[dev-dependencies.serde] [dev-dependencies.serde]

View File

@ -32,7 +32,7 @@ version = "1.5.3"
[dependencies.snarkvm-console] [dependencies.snarkvm-console]
git = "https://github.com/AleoHQ/snarkVM.git" git = "https://github.com/AleoHQ/snarkVM.git"
rev = "ea14990" version = "0.9.1"
features = ["account", "network"] features = ["account", "network"]
[dependencies.clap] [dependencies.clap]

View File

@ -389,7 +389,7 @@ impl ParserContext<'_> {
} else { } else {
// Eat a struct member access. // Eat a struct member access.
expr = Expression::Access(AccessExpression::Member(MemberAccess { expr = Expression::Access(AccessExpression::Member(MemberAccess {
span: expr.span(), span: expr.span() + name.span(),
inner: Box::new(expr), inner: Box::new(expr),
name, name,
})) }))

View File

@ -71,10 +71,11 @@ impl ParserContext<'_> {
) )
} }
// TODO: remove import resolution from parser.
/// Parses an import statement `import foo.leo;`. /// Parses an import statement `import foo.leo;`.
pub(super) fn parse_import(&mut self) -> Result<(Identifier, Program)> { pub(super) fn parse_import(&mut self) -> Result<(Identifier, (Program, Span))> {
// Parse `import`. // Parse `import`.
let _start = self.expect(&Token::Import)?; let start = self.expect(&Token::Import)?;
// Parse `foo`. // Parse `foo`.
let import_name = self.expect_identifier()?; let import_name = self.expect_identifier()?;
@ -86,7 +87,7 @@ impl ParserContext<'_> {
return Err(ParserError::leo_imports_only(self.token.span).into()); return Err(ParserError::leo_imports_only(self.token.span).into());
} }
let _end = self.expect(&Token::Semicolon)?; let end = self.expect(&Token::Semicolon)?;
// Tokenize and parse import file. // Tokenize and parse import file.
// Todo: move this to a different module. // Todo: move this to a different module.
@ -114,7 +115,7 @@ impl ParserContext<'_> {
// Use the parser to construct the imported abstract syntax tree (ast). // Use the parser to construct the imported abstract syntax tree (ast).
let program_ast = parse_ast(self.handler, &prg_sf.src, prg_sf.start_pos)?; let program_ast = parse_ast(self.handler, &prg_sf.src, prg_sf.start_pos)?;
Ok((import_name, program_ast.into_repr())) Ok((import_name, (program_ast.into_repr(), start + end)))
} }
/// Parsers a program scope `program foo.aleo { ... }`. /// Parsers a program scope `program foo.aleo { ... }`.

View File

@ -34,7 +34,7 @@ impl<'a> CodeGenerator<'a> {
&input &input
.imports .imports
.iter() .iter()
.map(|(identifier, imported_program)| self.visit_import(identifier, imported_program)) .map(|(identifier, (imported_program, _))| self.visit_import(identifier, imported_program))
.join("\n"), .join("\n"),
); );

View File

@ -152,7 +152,7 @@ impl ProgramConsumer for StaticSingleAssigner<'_> {
imports: input imports: input
.imports .imports
.into_iter() .into_iter()
.map(|(name, import)| (name, self.consume_program(import))) .map(|(name, (import, span))| (name, (self.consume_program(import), span)))
.collect(), .collect(),
program_scopes: input program_scopes: input
.program_scopes .program_scopes

View File

@ -38,7 +38,7 @@ pub struct FunctionSymbol {
/// Is this function a transition, inlined, or a regular function?. /// Is this function a transition, inlined, or a regular function?.
pub call_type: CallType, pub call_type: CallType,
/// The `Span` associated with the function. /// The `Span` associated with the function.
pub(crate) span: Span, pub(crate) _span: Span,
/// The inputs to the function. /// The inputs to the function.
pub(crate) input: Vec<Input>, pub(crate) input: Vec<Input>,
/// Metadata associated with the finalize block. /// Metadata associated with the finalize block.
@ -51,7 +51,7 @@ impl SymbolTable {
id, id,
output_type: func.output_type.clone(), output_type: func.output_type.clone(),
call_type: func.call_type, call_type: func.call_type,
span: func.span, _span: func.span,
input: func.input.clone(), input: func.input.clone(),
finalize: func.finalize.as_ref().map(|finalize| FinalizeData { finalize: func.finalize.as_ref().map(|finalize| FinalizeData {
input: finalize.input.clone(), input: finalize.input.clone(),

View File

@ -14,13 +14,14 @@
// You should have received a copy of the GNU General Public License // 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/>. // along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use crate::TypeChecker;
use leo_ast::*; use leo_ast::*;
use leo_errors::emitter::Handler; use leo_errors::emitter::Handler;
use leo_errors::TypeCheckerError; use leo_errors::TypeCheckerError;
use leo_span::{sym, Span}; use leo_span::{sym, Span};
use std::str::FromStr;
use crate::TypeChecker; use std::str::FromStr;
fn return_incorrect_type(t1: Option<Type>, t2: Option<Type>, expected: &Option<Type>) -> Option<Type> { fn return_incorrect_type(t1: Option<Type>, t2: Option<Type>, expected: &Option<Type>) -> Option<Type> {
match (t1, t2) { match (t1, t2) {
@ -143,7 +144,14 @@ impl<'a> ExpressionVisitor<'a> for TypeChecker<'a> {
// Check that `access.name` is a member of the struct. // Check that `access.name` is a member of the struct.
match struct_.members.iter().find(|member| member.name() == access.name.name) { match struct_.members.iter().find(|member| member.name() == access.name.name) {
// Case where `access.name` is a member of the struct. // Case where `access.name` is a member of the struct.
Some(Member { type_, .. }) => return Some(type_.clone()), Some(Member { type_, .. }) => {
// Check that the type of `access.name` is the same as `expected`.
return Some(self.assert_and_return_type(
type_.clone(),
expected,
access.span(),
));
}
// Case where `access.name` is not a member of the struct. // Case where `access.name` is not a member of the struct.
None => { None => {
self.emit_err(TypeCheckerError::invalid_struct_variable( self.emit_err(TypeCheckerError::invalid_struct_variable(
@ -454,7 +462,7 @@ impl<'a> ExpressionVisitor<'a> for TypeChecker<'a> {
} }
} }
let ret = self.assert_and_return_type(func.output_type, expected, func.span); let ret = self.assert_and_return_type(func.output_type, expected, input.span());
// Check number of function arguments. // Check number of function arguments.
if func.input.len() != input.arguments.len() { if func.input.len() != input.arguments.len() {
@ -537,11 +545,11 @@ impl<'a> ExpressionVisitor<'a> for TypeChecker<'a> {
Default::default() Default::default()
} }
fn visit_identifier(&mut self, var: &'a Identifier, expected: &Self::AdditionalInput) -> Self::Output { fn visit_identifier(&mut self, input: &'a Identifier, expected: &Self::AdditionalInput) -> Self::Output {
if let Some(var) = self.symbol_table.borrow().lookup_variable(var.name) { if let Some(var) = self.symbol_table.borrow().lookup_variable(input.name) {
Some(self.assert_and_return_type(var.type_.clone(), expected, var.span)) Some(self.assert_and_return_type(var.type_.clone(), expected, input.span()))
} else { } else {
self.emit_err(TypeCheckerError::unknown_sym("variable", var.name, var.span())); self.emit_err(TypeCheckerError::unknown_sym("variable", input.name, input.span()));
None None
} }
} }
@ -601,7 +609,10 @@ impl<'a> ExpressionVisitor<'a> for TypeChecker<'a> {
}, },
Literal::Group(_) => self.assert_and_return_type(Type::Group, expected, input.span()), Literal::Group(_) => self.assert_and_return_type(Type::Group, expected, input.span()),
Literal::Scalar(_, _) => self.assert_and_return_type(Type::Scalar, expected, input.span()), Literal::Scalar(_, _) => self.assert_and_return_type(Type::Scalar, expected, input.span()),
Literal::String(_, _) => self.assert_and_return_type(Type::String, expected, input.span()), Literal::String(_, _) => {
self.emit_err(TypeCheckerError::strings_are_not_supported(input.span()));
self.assert_and_return_type(Type::String, expected, input.span())
}
}) })
} }

View File

@ -287,4 +287,32 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> {
// Unset `is_transition_function` flag. // Unset `is_transition_function` flag.
self.is_transition_function = false; self.is_transition_function = false;
} }
fn visit_program(&mut self, input: &'a Program) {
match self.is_imported {
// If the program is imported, then it is not allowed to import any other programs.
true => {
input.imports.values().for_each(|(_, span)| {
self.emit_err(TypeCheckerError::imported_program_cannot_import_program(*span))
});
}
// Otherwise, typecheck the imported programs.
false => {
// Set `self.is_imported`.
let previous_is_imported = core::mem::replace(&mut self.is_imported, true);
// Typecheck the imported programs.
input.imports.values().for_each(|import| self.visit_import(&import.0));
// Set `self.is_imported` to its previous state.
self.is_imported = previous_is_imported;
}
}
// Typecheck the program scopes.
input
.program_scopes
.values()
.for_each(|scope| self.visit_program_scope(scope));
}
} }

View File

@ -39,6 +39,8 @@ pub struct TypeChecker<'a> {
pub(crate) is_transition_function: bool, pub(crate) is_transition_function: bool,
/// Whether or not we are currently traversing a finalize block. /// Whether or not we are currently traversing a finalize block.
pub(crate) is_finalize: bool, pub(crate) is_finalize: bool,
/// Whether or not we are currently traversing an imported program.
pub(crate) is_imported: bool,
} }
const BOOLEAN_TYPE: Type = Type::Boolean; const BOOLEAN_TYPE: Type = Type::Boolean;
@ -95,6 +97,7 @@ impl<'a> TypeChecker<'a> {
has_return: false, has_return: false,
has_finalize: false, has_finalize: false,
is_finalize: false, is_finalize: false,
is_imported: false,
} }
} }
@ -387,6 +390,10 @@ impl<'a> TypeChecker<'a> {
/// Emits an error if the type is not valid. /// Emits an error if the type is not valid.
pub(crate) fn assert_type_is_valid(&self, span: Span, type_: &Type) { pub(crate) fn assert_type_is_valid(&self, span: Span, type_: &Type) {
match type_ { match type_ {
// String types are temporarily disabled.
Type::String => {
self.emit_err(TypeCheckerError::strings_are_not_supported(span));
}
// Check that the named composite type has been defined. // Check that the named composite type has been defined.
Type::Identifier(identifier) if self.symbol_table.borrow().lookup_struct(identifier.name).is_none() => { Type::Identifier(identifier) if self.symbol_table.borrow().lookup_struct(identifier.name).is_none() => {
self.emit_err(TypeCheckerError::undefined_type(identifier.name, span)); self.emit_err(TypeCheckerError::undefined_type(identifier.name, span));

View File

@ -26,7 +26,7 @@ features = ["serde"]
version = "0.2.1" version = "0.2.1"
[dependencies.scoped-tls] [dependencies.scoped-tls]
version = "1.0.0" version = "1.0.1"
[dependencies.serde] [dependencies.serde]
version = "1.0.147" version = "1.0.147"

71
docs/troubleshooting.md Normal file
View File

@ -0,0 +1,71 @@
# Troubleshooting Guide
In this guide, we will cover some common issues that may arise when installing and using Leo for the first time.
## Downloading parameters
When running `leo run` for the first time, Leo will download the necessary parameters from a remote server.
This may take a while and may outright fail, depending on your internet connection and network configuration.
You will know that the download has failed if you see the following error message or something similar:
```bash
ATTENTION - "genesis.prover.1c9bbe9" does not exist, downloading this file remotely and storing it locally. Please ensure "genesis.prover.1c9bbe9" is stored in "/Users/xxx/.aleo/resources/genesis.prover.1c9bbe9".
snarkvm_parameters::testnet3 - Downloading parameters...
snarkvm_parameters::testnet3 - thread `main` panicked at 'Failed to load proving key: Crate("curl::error", "Error { description: \"Transferred a partial file\", code: 18, extra: Some(\"transfer closed with 92197356 bytes remaining to read\") }")', /Users/xxx/.cargo/git/checkouts/snarkvm-f1160780ffe17de8/ea14990/parameters/src/testnet3/mod.rs:95:9
stack backtrace:
0: backtrace::capture::Backtrace::new
1: leo::set_panic_hook::{{closure}}
2: std::panicking::rust_panic_with_hook
3: std::panicking::begin_panic_handler::{{closure}}
4: std::sys_common::backtrace::__rust_end_short_backtrace
5: _rust_begin_unwind
6: core::panicking::panic_fmt
7: core::result::unwrap_failed
8: std::sync::once::Once::call_once::{{closure}}
9: std::sync::once::Once::call_inner
10: snarkvm_compiler::process::Process<N>::load
11: snarkvm::package::Package<N>::get_process
12: snarkvm::package::build::<impl snarkvm::package::Package<N>>::build
13: aleo::commands::build::Build::parse
14: <leo::commands::build::Build as leo::commands::Command>::apply
15: leo::commands::Command::execute
16: leo::commands::Command::try_execute
17: leo::run_with_args
18: scoped_tls::ScopedKey<T>::set
19: leo::main
20: std::sys_common::backtrace::__rust_begin_short_backtrace
21: std::rt::lang_start::{{closure}}
22: std::rt::lang_start_internal
23: _main
```
If this happens, try using the following script to download the parameters until it succeeds:
```bash
#!/bin/bash
echo "
Downloading parameters. This will take a few minutes...
"
# Create a new Leo project.
leo new install > /dev/null 2>&1
cd install
# Attempt to compile the program until it passes.
# This is necessary to ensure that the universal parameters are downloaded.
declare -i DONE
DONE=1
while [ $DONE -ne 0 ]
do
leo build 2>&1
DONE=$?
sleep 0.5
done
# Remove the program.
cd .. && rm -rf install
```

View File

@ -430,4 +430,18 @@ create_messages!(
msg: format!("Loop bound must be a literal."), msg: format!("Loop bound must be a literal."),
help: None, help: None,
} }
@formatted
strings_are_not_supported {
args: (),
msg: format!("Strings are not yet supported."),
help: None,
}
@formatted
imported_program_cannot_import_program {
args: (),
msg: format!("An imported program cannot import another program."),
help: None,
}
); );

View File

@ -27,8 +27,8 @@ pub use deploy::Deploy;
pub mod new; pub mod new;
pub use new::New; pub use new::New;
pub mod node; // pub mod node;
pub use node::Node; // pub use node::Node;
pub mod run; pub mod run;
pub use run::Run; pub use run::Run;

View File

@ -82,9 +82,8 @@ enum Commands {
#[structopt(flatten)] #[structopt(flatten)]
command: Run, command: Run,
}, },
#[structopt(subcommand)] // #[structopt(subcommand)]
Node(Node), // Node(Node),
#[structopt(about = "Deploy a program")] #[structopt(about = "Deploy a program")]
Deploy { Deploy {
#[structopt(flatten)] #[structopt(flatten)]
@ -153,7 +152,7 @@ pub fn run_with_args(cli: CLI) -> Result<()> {
Commands::Build { command } => command.try_execute(context), Commands::Build { command } => command.try_execute(context),
Commands::Clean { command } => command.try_execute(context), Commands::Clean { command } => command.try_execute(context),
Commands::Run { command } => command.try_execute(context), Commands::Run { command } => command.try_execute(context),
Commands::Node(command) => command.try_execute(context), // Commands::Node(command) => command.try_execute(context),
Commands::Deploy { command } => command.try_execute(context), Commands::Deploy { command } => command.try_execute(context),
} }
} }

View File

@ -0,0 +1,26 @@
/*
namespace: Compile
expectation: Fail
*/
program test.aleo {
function f1(a: u8) -> u8 {
let b: u8 = a + 1u8;
return b;
}
function f3(u2: u8, u3: i16) -> u8 {
return 0u8;
}
transition main(id_type: i8, s: u8) -> u8 {
let x: i8 = 1i8;
x = f1(1u8);
let y: i8 = 1i8;
let z: i16 = 100i16;
y = f3(y, z);
return s;
}
}

View File

@ -1,6 +1,6 @@
/* /*
namespace: Compile namespace: Compile
expectation: Pass expectation: Fail
*/ */
program test.aleo { program test.aleo {

View File

@ -0,0 +1,19 @@
/*
namespace: Compile
expectation: Fail
*/
program test.aleo {
struct s1 {
f1: u32,
f2: u32
}
transition main(id_type: i8, s: s1) -> i8 {
let x: i8 = s.f1;
x = x + 1i8;
return x;
}
}

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- "Error [ETYC0372003]: Expected type `i8` but type `u8` was found\n --> compiler-test:16:13\n |\n 16 | x = f1(1u8);\n | ^^^^^^^\nError [ETYC0372003]: Expected type `i8` but type `u8` was found\n --> compiler-test:20:13\n |\n 20 | y = f3(y, z);\n | ^^^^^^^^\nError [ETYC0372003]: Expected type `u8` but type `i8` was found\n --> compiler-test:20:16\n |\n 20 | y = f3(y, z);\n | ^\n"

View File

@ -2,4 +2,4 @@
namespace: Compile namespace: Compile
expectation: Fail expectation: Fail
outputs: outputs:
- "Error [ETYC0372017]: The type `Foo` is not found in the current scope.\n --> compiler-test:4:28\n |\n 4 | transition main(a: u8, foo: Foo) -> u8 {\n | ^^^\nError [ETYC0372017]: The type `Foo` is not found in the current scope.\n --> compiler-test:8:38\n |\n 8 | transition returns_foo(a: u8) -> Foo {\n | ^^^\nError [ETYC0372003]: Expected type `Foo` but type `u8` was found\n --> compiler-test:8:28\n |\n 8 | transition returns_foo(a: u8) -> Foo {\n | ^\nError [ETYC0372017]: The type `Foo` is not found in the current scope.\n --> compiler-test:8:5\n |\n 8 | transition returns_foo(a: u8) -> Foo {\n 9 | return a;\n 10 | }}\n | ^\n" - "Error [ETYC0372017]: The type `Foo` is not found in the current scope.\n --> compiler-test:4:28\n |\n 4 | transition main(a: u8, foo: Foo) -> u8 {\n | ^^^\nError [ETYC0372017]: The type `Foo` is not found in the current scope.\n --> compiler-test:8:38\n |\n 8 | transition returns_foo(a: u8) -> Foo {\n | ^^^\nError [ETYC0372003]: Expected type `Foo` but type `u8` was found\n --> compiler-test:9:16\n |\n 9 | return a;\n | ^\nError [ETYC0372017]: The type `Foo` is not found in the current scope.\n --> compiler-test:8:5\n |\n 8 | transition returns_foo(a: u8) -> Foo {\n 9 | return a;\n 10 | }}\n | ^\n"

View File

@ -2,4 +2,4 @@
namespace: Compile namespace: Compile
expectation: Fail expectation: Fail
outputs: outputs:
- "Error [ETYC0372003]: Expected type `address` but type `u64` was found\n --> compiler-test:13:32\n |\n 13 | function mint(r0: address, r1: u64) -> Token {\n | ^^\nError [ETYC0372003]: Expected type `u64` but type `address` was found\n --> compiler-test:13:19\n |\n 13 | function mint(r0: address, r1: u64) -> Token {\n | ^^\nError [ETYC0372047]: Cannot call another function from a standard function.\n --> compiler-test:23:24\n |\n 23 | let t: Token = mint(x, c);\n | ^^^^^^^^^^\n" - "Error [ETYC0372003]: Expected type `address` but type `u64` was found\n --> compiler-test:15:20\n |\n 15 | owner: r1, // This variable should be type address.\n | ^^\nError [ETYC0372003]: Expected type `u64` but type `address` was found\n --> compiler-test:17:21\n |\n 17 | amount: r0, // This variable should be type u64.\n | ^^\nError [ETYC0372047]: Cannot call another function from a standard function.\n --> compiler-test:23:24\n |\n 23 | let t: Token = mint(x, c);\n | ^^^^^^^^^^\n"

View File

@ -2,4 +2,4 @@
namespace: Compile namespace: Compile
expectation: Fail expectation: Fail
outputs: outputs:
- "Error [ETYC0372003]: Expected type `boolean` but type `u32` was found\n --> compiler-test:4:19\n |\n 4 | function main(x: u32) {\n | ^\nError [EAST0372011]: variable `x` shadowed by\n --> compiler-test:5:9\n |\n 5 | let x: bool = true ? x: true;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" - "Error [ETYC0372003]: Expected type `boolean` but type `u32` was found\n --> compiler-test:5:30\n |\n 5 | let x: bool = true ? x: true;\n | ^\nError [EAST0372011]: variable `x` shadowed by\n --> compiler-test:5:9\n |\n 5 | let x: bool = true ? x: true;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"

File diff suppressed because one or more lines are too long

View File

@ -1,10 +1,5 @@
--- ---
namespace: Compile namespace: Compile
expectation: Pass expectation: Fail
outputs: outputs:
- output: - "Error [ETYC0372050]: Strings are not yet supported.\n --> compiler-test:6:9\n |\n 6 | let str:string = \"a a a\";\n | ^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372050]: Strings are not yet supported.\n --> compiler-test:6:26\n |\n 6 | let str:string = \"a a a\";\n | ^^^^^^^\nError [ETYC0372050]: Strings are not yet supported.\n --> compiler-test:7:19\n |\n 7 | if(str == \"b b b\") {\n | ^^^^^^^^\n"
- initial_input_ast: no input
initial_ast: d0b2004e12f3110cdaa10fdb79b46df1feb01dff5bf7285a7770910cad91b531
unrolled_ast: d0b2004e12f3110cdaa10fdb79b46df1feb01dff5bf7285a7770910cad91b531
ssa_ast: 016ce666473f43fda070fda790466b0c6907871eaeb0cb1e1d99e22cb025e5be
flattened_ast: 31f292c587ed5bfacfbf81159532bcf87d2d2673d7301adfe6e7ea914923fe6e

View File

@ -2,4 +2,4 @@
namespace: Compile namespace: Compile
expectation: Fail expectation: Fail
outputs: outputs:
- "Error [ETYC0372029]: Standard functions cannot have modes associated with their inputs.\n --> compiler-test:8:25\n |\n 8 | function main(const x: u8, y: bool) -> bool {\n | ^\n |\n = Consider removing the mode or using the keyword `transition` instead of `function`.\nError [ETYC0372005]: Unknown variable `b`\n --> compiler-test:11:17\n |\n 11 | return (b.x == a.x) == y;\n | ^\nError [ETYC0372004]: Could not determine the type of `b`\n --> compiler-test:11:17\n |\n 11 | return (b.x == a.x) == y;\n | ^\nError [ETYC0372003]: Expected type `u8` but type `no type` was found\n --> compiler-test:11:17\n |\n 11 | return (b.x == a.x) == y;\n | ^^^^^^^^\n" - "Error [ETYC0372029]: Standard functions cannot have modes associated with their inputs.\n --> compiler-test:8:25\n |\n 8 | function main(const x: u8, y: bool) -> bool {\n | ^\n |\n = Consider removing the mode or using the keyword `transition` instead of `function`.\nError [ETYC0372005]: Unknown variable `b`\n --> compiler-test:11:17\n |\n 11 | return (b.x == a.x) == y;\n | ^\nError [ETYC0372004]: Could not determine the type of `b`\n --> compiler-test:11:17\n |\n 11 | return (b.x == a.x) == y;\n | ^\nError [ETYC0372003]: Expected type `u8` but type `no type` was found\n --> compiler-test:11:17\n |\n 11 | return (b.x == a.x) == y;\n | ^^^^^^^^^^\n"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- "Error [ETYC0372003]: Expected type `i8` but type `u32` was found\n --> compiler-test:11:21\n |\n 11 | let x: i8 = s.f1;\n | ^^^^\n"