mirror of
https://github.com/AleoHQ/leo.git
synced 2024-11-29 03:35:10 +03:00
Bump snarkvm to v0.0.6
This commit is contained in:
parent
a0b6dba14d
commit
8a05594b42
118
Cargo.lock
generated
118
Cargo.lock
generated
@ -378,16 +378,6 @@ dependencies = [
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "console_error_panic_hook"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8d976903543e0c48546a91908f21588a680a8c8f984df9a5d69feccb2b2a211"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "constant_time_eq"
|
||||
version = "0.1.5"
|
||||
@ -1407,19 +1397,6 @@ dependencies = [
|
||||
"snarkvm-models",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "leo-wasm"
|
||||
version = "1.2.3"
|
||||
dependencies = [
|
||||
"leo-asg",
|
||||
"leo-ast",
|
||||
"leo-grammar",
|
||||
"leo-imports",
|
||||
"serde",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-test",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.86"
|
||||
@ -2307,12 +2284,6 @@ dependencies = [
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scoped-tls"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.1.0"
|
||||
@ -2509,9 +2480,9 @@ checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-algorithms"
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "739c2aaf5dbf6322d3a40bbb9739a87d458f32460da1b8affeae45214ec88e8c"
|
||||
checksum = "7d3de956d0221ff897ebcc2a36e8a88482dee06acaebce67f7819c41be843a11"
|
||||
dependencies = [
|
||||
"blake2",
|
||||
"derivative",
|
||||
@ -2530,9 +2501,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-curves"
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c39148bec803c5e41b0696326a60817d9b84c4c2c1df6ea5be56f857b078988"
|
||||
checksum = "dd45a9c60e9c81bbfc4568f8c7d4c3fd0b6dc7b75916086eb16795fc3ea854b2"
|
||||
dependencies = [
|
||||
"derivative",
|
||||
"rand",
|
||||
@ -2546,9 +2517,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-derives"
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24c5c4170d43a65e23bce115d6d2940c7fc66e1562a7822dd460db56f1fb07b1"
|
||||
checksum = "1b3339f816745870549adbcf7f5b1db3441c8d73377278fec9c7829a87ebdc07"
|
||||
dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro-error",
|
||||
@ -2559,9 +2530,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-dpc"
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3feb5d2cec547779e0acec01cd58f5d5fe6aac60cc4804e5e3cf9c807bb1880"
|
||||
checksum = "f9d43c0c63eedf067284496e068527f2448ea3ecba1ba9c44d486c3fb66e04e2"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"blake2",
|
||||
@ -2582,9 +2553,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-errors"
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2cfe9f6fac097aed079fa68a63c8989783b2cf21705de75bc91672dec60c9684"
|
||||
checksum = "ce13866aa05abf33972261ab9803b2f223bd5bee9e5336aac0618c2aa8249f24"
|
||||
dependencies = [
|
||||
"base58",
|
||||
"bech32",
|
||||
@ -2596,9 +2567,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-gadgets"
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "978bcc75bce7a1274f51b2adc4d69c30d866930aa37c656b4b8c1be5d631891c"
|
||||
checksum = "e5f6de0307dba124bf510fdf52b870a9ba76ad3177b2b742f91c87ee39a038d8"
|
||||
dependencies = [
|
||||
"derivative",
|
||||
"digest 0.9.0",
|
||||
@ -2612,9 +2583,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-models"
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2c8da5920c6f4062c0d348e93ff0f72d17681c34f3c13ee4e99196495d896ed9"
|
||||
checksum = "21afc37b95e310387d9a7ea25e439c7e5f444896a760e5f3893d4e6ef387d48c"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bincode",
|
||||
@ -2632,9 +2603,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-objects"
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4641e23002d38caeb51fa3244320355cab07eaf22d17dc44b481c763b63b5f4d"
|
||||
checksum = "724332214a919a1c14f07c458c191319101cc3252319cf2f9e8f122fd2a5f5d5"
|
||||
dependencies = [
|
||||
"base58",
|
||||
"bech32",
|
||||
@ -2654,29 +2625,46 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-parameters"
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8cb0f27fbccad7dee0ad4c2e5aeb0832c393fec76b4ad5d834c2e6cc0297e9a9"
|
||||
checksum = "9e69a1db7cba8b07538943c0a9c547f515a4d726d8863dc1d40c5f9266a8af27"
|
||||
dependencies = [
|
||||
"curl",
|
||||
"hex",
|
||||
"snarkvm-algorithms",
|
||||
"snarkvm-errors",
|
||||
"snarkvm-models",
|
||||
"snarkvm-polycommit",
|
||||
"snarkvm-utilities",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-polycommit"
|
||||
version = "0.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d1f29eab35b3214dee0847deae11ea3af13c42e3beefb8cf7c22ed567cf3a70e"
|
||||
dependencies = [
|
||||
"derivative",
|
||||
"digest 0.9.0",
|
||||
"rand_core",
|
||||
"snarkvm-algorithms",
|
||||
"snarkvm-errors",
|
||||
"snarkvm-models",
|
||||
"snarkvm-profiler",
|
||||
"snarkvm-utilities",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-profiler"
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3fb5e9b964cb9653588607d8793bc7d6d0dfa78763a02d61aa3daa6c7d665e2b"
|
||||
checksum = "37ce2100d7198526f11290d70d83a1bb6a1dd578f43821ceb544421ebd398312"
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-storage"
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3ef134de5e33fe0577f3936e9dcf9bfac1973a0d820390e19558672808bad6b9"
|
||||
checksum = "b57ef27e6b3073f4681332ac018158cea1f28c8a14e2187085e2c656f1641550"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bincode",
|
||||
@ -2696,9 +2684,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "snarkvm-utilities"
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "872c2ee1675c5039caf8cb4c5ef37b0ad844ffe7e0d81b68fb39f713da199561"
|
||||
checksum = "272b8758ef7fed8dc70cc01ecfd13e9add23edbabcaae1c5c7cfaca54d0fcae5"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"rand",
|
||||
@ -3234,30 +3222,6 @@ version = "0.2.71"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d6f8ec44822dd71f5f221a5847fb34acd9060535c1211b70a05844c0f6383b1"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-test"
|
||||
version = "0.3.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2ea9e4f0050d5498a160e6b9d278a9699598e445b51dacd05598da55114c801a"
|
||||
dependencies = [
|
||||
"console_error_panic_hook",
|
||||
"js-sys",
|
||||
"scoped-tls",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"wasm-bindgen-test-macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-test-macro"
|
||||
version = "0.3.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43f40402f495d92df6cdd0d329e7cc2580c8f99bcd74faff0e468923a764b7d4"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.24",
|
||||
"quote 1.0.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.48"
|
||||
|
13
Cargo.toml
13
Cargo.toml
@ -37,7 +37,6 @@ members = [
|
||||
"package",
|
||||
"state",
|
||||
"synthesizer",
|
||||
"wasm"
|
||||
]
|
||||
|
||||
[dependencies.leo-ast]
|
||||
@ -73,27 +72,27 @@ path = "./synthesizer"
|
||||
version = "1.2.3"
|
||||
|
||||
[dependencies.snarkvm-algorithms]
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-curves]
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-errors]
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-gadgets]
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-models]
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-utilities]
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
|
||||
[dependencies.anyhow]
|
||||
version = "1.0"
|
||||
|
@ -50,31 +50,31 @@ path = "../asg"
|
||||
version = "1.2.3"
|
||||
|
||||
[dependencies.snarkvm-curves]
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-dpc]
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-errors]
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-gadgets]
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-models]
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-objects]
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-utilities]
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
|
||||
[dependencies.bincode]
|
||||
version = "1.3"
|
||||
@ -115,7 +115,7 @@ version = "0.3"
|
||||
default-features = false
|
||||
|
||||
[dev-dependencies.snarkvm-algorithms]
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
default-features = false
|
||||
|
||||
[features]
|
||||
|
@ -18,15 +18,15 @@ license = "GPL-3.0"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies.snarkvm-errors]
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-models]
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-utilities]
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
|
||||
[dependencies.rand]
|
||||
version = "0.8"
|
||||
|
@ -26,31 +26,31 @@ path = "../ast"
|
||||
version = "1.2.3"
|
||||
|
||||
[dependencies.snarkvm-algorithms]
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-curves]
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-dpc]
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-errors]
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-models]
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-objects]
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-utilities]
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
|
||||
[dependencies.indexmap]
|
||||
version = "1.6.1"
|
||||
@ -66,7 +66,7 @@ version = "0.3"
|
||||
version = "1.0"
|
||||
|
||||
[dev-dependencies.snarkvm-storage]
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
|
||||
[dev-dependencies.rand_core]
|
||||
version = "0.6.2"
|
||||
|
@ -18,15 +18,15 @@ license = "GPL-3.0"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies.snarkvm-curves]
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-errors]
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
default-features = false
|
||||
|
||||
[dependencies.snarkvm-models]
|
||||
version = "0.0.5"
|
||||
version = "0.0.6"
|
||||
default-features = false
|
||||
|
||||
[dependencies.num-bigint]
|
||||
|
@ -1,77 +0,0 @@
|
||||
{
|
||||
"name": "basic",
|
||||
"expected_input": [],
|
||||
"imports": [],
|
||||
"circuits": {},
|
||||
"functions": {
|
||||
"{\"name\":\"main\",\"span\":\"{\\\"text\\\":\\\" function main() {\\\",\\\"line\\\":1,\\\"start\\\":10,\\\"end\\\":14}\"}": {
|
||||
"identifier": "{\"name\":\"main\",\"span\":\"{\\\"text\\\":\\\" function main() {\\\",\\\"line\\\":1,\\\"start\\\":10,\\\"end\\\":14}\"}",
|
||||
"input": [],
|
||||
"output": null,
|
||||
"block": {
|
||||
"statements": [
|
||||
{
|
||||
"Return": {
|
||||
"expression": {
|
||||
"Binary": {
|
||||
"left": {
|
||||
"Value": {
|
||||
"Implicit": [
|
||||
"1",
|
||||
{
|
||||
"text": " return 1 + 1",
|
||||
"line": 2,
|
||||
"start": 12,
|
||||
"end": 13
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"right": {
|
||||
"Value": {
|
||||
"Implicit": [
|
||||
"1",
|
||||
{
|
||||
"text": " return 1 + 1",
|
||||
"line": 2,
|
||||
"start": 16,
|
||||
"end": 17
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"op": "Add",
|
||||
"span": {
|
||||
"text": " return 1 + 1",
|
||||
"line": 2,
|
||||
"start": 12,
|
||||
"end": 17
|
||||
}
|
||||
}
|
||||
},
|
||||
"span": {
|
||||
"text": " return 1 + 1",
|
||||
"line": 2,
|
||||
"start": 5,
|
||||
"end": 17
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"span": {
|
||||
"text": " function main() {",
|
||||
"line": 1,
|
||||
"start": 17,
|
||||
"end": 2
|
||||
}
|
||||
},
|
||||
"span": {
|
||||
"text": " function main() {",
|
||||
"line": 1,
|
||||
"start": 1,
|
||||
"end": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
"tests": {}
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
{
|
||||
"definitions": [
|
||||
{
|
||||
"Function": {
|
||||
"identifier": {
|
||||
"value": "main",
|
||||
"span": {
|
||||
"input": "main",
|
||||
"start": 9,
|
||||
"end": 13
|
||||
}
|
||||
},
|
||||
"parameters": [],
|
||||
"returns": null,
|
||||
"block": {
|
||||
"statements": [
|
||||
{
|
||||
"Return": {
|
||||
"expression": {
|
||||
"Binary": {
|
||||
"operation": "Add",
|
||||
"left": {
|
||||
"Value": {
|
||||
"Implicit": {
|
||||
"Positive": {
|
||||
"value": "1",
|
||||
"span": {
|
||||
"input": "1",
|
||||
"start": 29,
|
||||
"end": 30
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"right": {
|
||||
"Value": {
|
||||
"Implicit": {
|
||||
"Positive": {
|
||||
"value": "1",
|
||||
"span": {
|
||||
"input": "1",
|
||||
"start": 33,
|
||||
"end": 34
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"span": {
|
||||
"input": "1 + 1",
|
||||
"start": 29,
|
||||
"end": 34
|
||||
}
|
||||
}
|
||||
},
|
||||
"span": {
|
||||
"input": "return 1 + 1",
|
||||
"start": 22,
|
||||
"end": 34
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"span": {
|
||||
"input": "{\n return 1 + 1\n}",
|
||||
"start": 16,
|
||||
"end": 36
|
||||
}
|
||||
},
|
||||
"span": {
|
||||
"input": "function main() {\n return 1 + 1\n}",
|
||||
"start": 0,
|
||||
"end": 36
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"eoi": null,
|
||||
"span": {
|
||||
"input": "function main() {\n return 1 + 1\n}\n",
|
||||
"start": 0,
|
||||
"end": 37
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
function main() {
|
||||
return 1 + 1
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
[package]
|
||||
name = "leo-wasm"
|
||||
version = "1.2.3"
|
||||
authors = [ "The Aleo Team <hello@aleo.org>" ]
|
||||
description = "WASM interpreter of the Leo programming language"
|
||||
homepage = "https://aleo.org"
|
||||
repository = "https://github.com/AleoHQ/leo"
|
||||
keywords = [
|
||||
"aleo",
|
||||
"cryptography",
|
||||
"leo",
|
||||
"programming-language",
|
||||
"zero-knowledge"
|
||||
]
|
||||
categories = [ "cryptography::cryptocurrencies", "web-programming" ]
|
||||
include = [ "Cargo.toml", "src", "README.md", "LICENSE.md" ]
|
||||
license = "GPL-3.0"
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
crate-type = [ "cdylib", "rlib" ]
|
||||
|
||||
#[dependencies.snarkvm-curves]
|
||||
#version = "0.0.5"
|
||||
#default-features = false
|
||||
|
||||
[dependencies.leo-asg]
|
||||
path = "../asg"
|
||||
version = "1.2.3"
|
||||
|
||||
[dependencies.leo-ast]
|
||||
path = "../ast"
|
||||
version = "1.2.3"
|
||||
|
||||
[dependencies.leo-grammar]
|
||||
path = "../grammar"
|
||||
version = "1.2.3"
|
||||
|
||||
[dependencies.leo-imports]
|
||||
path = "../imports"
|
||||
version = "1.2.3"
|
||||
|
||||
#[dependencies.leo-synthesizer]
|
||||
#path = "../synthesizer"
|
||||
#version = "1.2.3"
|
||||
#default-features = false
|
||||
|
||||
[dependencies.serde]
|
||||
version = "1.0"
|
||||
features = [ "derive" ]
|
||||
|
||||
[dependencies.wasm-bindgen]
|
||||
version = "0.2"
|
||||
features = [ "serde-serialize" ]
|
||||
|
||||
[dev-dependencies.wasm-bindgen-test]
|
||||
version = "0.3.20"
|
@ -1,75 +0,0 @@
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::ast::Ast;
|
||||
use leo_asg::{new_alloc_context, new_context, Asg as LeoAsg, AsgContext};
|
||||
use leo_grammar::Grammar as LeoGrammar;
|
||||
|
||||
use std::{boxed::Box, path::Path};
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
thread_local! {
|
||||
static THREAD_GLOBAL_CONTEXT: AsgContext<'static> = {
|
||||
let leaked = Box::leak(Box::new(leo_asg::new_alloc_context()));
|
||||
leo_asg::new_context(leaked)
|
||||
}
|
||||
}
|
||||
|
||||
/// Convenience function to return a leaked thread-local global context. Should only be used for transient programs.
|
||||
pub fn thread_leaked_context() -> AsgContext<'static> {
|
||||
THREAD_GLOBAL_CONTEXT.with(|f| *f)
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub struct Asg(LeoAsg<'static>);
|
||||
|
||||
#[wasm_bindgen]
|
||||
impl Asg {
|
||||
#[wasm_bindgen(constructor)]
|
||||
pub fn from(ast: &Ast) -> Self {
|
||||
let asg = LeoAsg::new(
|
||||
thread_leaked_context(),
|
||||
&ast.0,
|
||||
&mut leo_imports::ImportParser::default(),
|
||||
)
|
||||
.unwrap();
|
||||
Self(asg)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use wasm_bindgen_test::*;
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
fn asg_test() {
|
||||
// let expected = include_str!("../.resources/basic/expected_ast.json");
|
||||
|
||||
let filepath = "../.resources/basic/main.leo";
|
||||
let program_name = "basic";
|
||||
let program_string = include_str!("../.resources/basic/main.leo");
|
||||
|
||||
let ast = Ast::new(filepath, program_name, program_string);
|
||||
let candidate = Asg::from(&ast);
|
||||
|
||||
// let expected = JsValue::from_str(expected);
|
||||
// let candidate = JsValue::from_serde(&candidate).unwrap();
|
||||
//
|
||||
// assert_eq!(expected, candidate);
|
||||
}
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_ast::Ast as LeoAst;
|
||||
use leo_grammar::Grammar as LeoGrammar;
|
||||
|
||||
use std::path::Path;
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub struct Ast(pub(crate) LeoAst);
|
||||
|
||||
#[wasm_bindgen]
|
||||
impl Ast {
|
||||
#[wasm_bindgen(constructor)]
|
||||
pub fn new(filepath: &str, program_name: &str, program_string: &str) -> Self {
|
||||
let grammar = LeoGrammar::new(&Path::new(filepath), &program_string).unwrap();
|
||||
let ast = LeoAst::new(program_name, &grammar).unwrap();
|
||||
Self(ast)
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn to_string(&self) -> String {
|
||||
self.0.to_json_string().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use wasm_bindgen_test::*;
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
fn ast_test() {
|
||||
let expected = include_str!("../.resources/basic/expected_ast.json");
|
||||
|
||||
let filepath = "../.resources/basic/main.leo";
|
||||
let program_name = "basic";
|
||||
let program_string = include_str!("../.resources/basic/main.leo");
|
||||
|
||||
let candidate = Ast::new(filepath, program_name, program_string).to_string();
|
||||
|
||||
let expected = JsValue::from_str(expected);
|
||||
let candidate = JsValue::from_serde(&candidate).unwrap();
|
||||
|
||||
assert_eq!(expected, candidate);
|
||||
}
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{asg::Asg, ast::Ast};
|
||||
use leo_compiler::generate_constraints;
|
||||
// use leo_synthesizer::CircuitSynthesizer;
|
||||
|
||||
// use snarkvm_curves::Bls12_377;
|
||||
|
||||
use std::path::Path;
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub struct Compiler(String);
|
||||
|
||||
#[wasm_bindgen]
|
||||
impl Compiler {
|
||||
#[wasm_bindgen(constructor)]
|
||||
pub fn new(filepath: &str, program_name: &str, program_string: &str) -> Self {
|
||||
let ast = Ast::new(filepath, program_name, program_string).unwrap();
|
||||
let asg = Asg::from(&ast);
|
||||
|
||||
// Generate the program on the constraint system and verify correctness
|
||||
{
|
||||
// let mut cs = CircuitSynthesizer::<Bls12_377> {
|
||||
// at: vec![],
|
||||
// bt: vec![],
|
||||
// ct: vec![],
|
||||
// input_assignment: vec![],
|
||||
// aux_assignment: vec![],
|
||||
// };
|
||||
// let temporary_program = program.clone();
|
||||
// let output = temporary_program.compile_constraints(&mut cs)?;
|
||||
//
|
||||
// tracing::debug!("Compiled output - {:#?}", output);
|
||||
// tracing::info!("Number of constraints - {:#?}", cs.num_constraints());
|
||||
//
|
||||
// // Serialize the circuit
|
||||
// let circuit_object = SerializedCircuit::from(cs);
|
||||
// let json = circuit_object.to_json_string().unwrap();
|
||||
// // println!("json: {}", json);
|
||||
//
|
||||
// // Write serialized circuit to circuit `.json` file.
|
||||
// let circuit_file = CircuitFile::new(&package_name);
|
||||
// circuit_file.write_to(&path, json)?;
|
||||
|
||||
// Check that we can read the serialized circuit file
|
||||
// let serialized = circuit_file.read_from(&package_path)?;
|
||||
|
||||
// Deserialize the circuit
|
||||
// let deserialized = SerializedCircuit::from_json_string(&serialized).unwrap();
|
||||
// let _circuit_synthesizer = CircuitSynthesizer::<Bls12_377>::try_from(deserialized).unwrap();
|
||||
// println!("deserialized {:?}", circuit_synthesizer.num_constraints());
|
||||
}
|
||||
|
||||
// TODO (howardwu): Support program inputs.
|
||||
generate_constraints(cs, &asg.as_ref().unwrap(), &Input::new()).unwrap();
|
||||
Self(ast.to_string())
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn to_string(&self) -> String {
|
||||
self.0.clone()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use wasm_bindgen_test::*;
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
fn ast_test() {}
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_ast::Ast as LeoAst;
|
||||
use leo_grammar::Grammar as LeoGrammar;
|
||||
|
||||
use std::path::Path;
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub struct Grammar(pub(crate) String);
|
||||
|
||||
#[wasm_bindgen]
|
||||
impl Grammar {
|
||||
#[wasm_bindgen(constructor)]
|
||||
pub fn new(filepath: &str, program_string: &str) -> Self {
|
||||
let grammar = LeoGrammar::new(&Path::new(filepath), &program_string).unwrap();
|
||||
Self(grammar.to_json_string().unwrap())
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn to_string(&self) -> String {
|
||||
self.0.clone()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use wasm_bindgen_test::*;
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
fn grammar_test() {
|
||||
let expected = include_str!("../.resources/basic/expected_grammar.json");
|
||||
|
||||
let filepath = "../.resources/basic/main.leo";
|
||||
let program_string = include_str!("../.resources/basic/main.leo");
|
||||
|
||||
let candidate = Grammar::new(filepath, program_string).to_string();
|
||||
|
||||
let expected = JsValue::from_str(expected);
|
||||
let candidate = JsValue::from_serde(&candidate).unwrap();
|
||||
|
||||
assert_eq!(expected, candidate);
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// 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/>.
|
||||
|
||||
pub mod asg;
|
||||
pub use asg::*;
|
||||
|
||||
pub mod ast;
|
||||
pub use ast::*;
|
||||
|
||||
pub mod grammar;
|
||||
pub use grammar::*;
|
||||
|
||||
// pub mod compiler;
|
||||
// pub use compiler::*;
|
Loading…
Reference in New Issue
Block a user