From 052b0a142bee9cfd221e65fe443b7448488d6039 Mon Sep 17 00:00:00 2001 From: damirka Date: Sat, 17 Jul 2021 02:37:34 +0300 Subject: [PATCH 1/5] patch abnf to 0.12.0, uncomment leo-abnf crate --- Cargo.lock | 56 +++++++ grammar/Cargo.toml | 3 + grammar/src/main.rs | 355 ++++++++++++++++++++++---------------------- 3 files changed, 237 insertions(+), 177 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 61bc9874ab..a7753d8000 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,25 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "abnf" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33741baa462d86e43fdec5e8ffca7c6ac82847ad06cbfb382c1bdbf527de9e6b" +dependencies = [ + "abnf-core", + "nom", +] + +[[package]] +name = "abnf-core" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c44e09c43ae1c368fb91a03a566472d0087c26cf7e1b9e8e289c14ede681dd7d" +dependencies = [ + "nom", +] + [[package]] name = "addr2line" version = "0.15.2" @@ -50,6 +69,12 @@ version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "595d3cfa7a60d4555cb5067b99f07142a08ea778de5cf993f7b75c7d8fabc486" +[[package]] +name = "arrayvec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" + [[package]] name = "assert_cmd" version = "1.0.7" @@ -1101,6 +1126,7 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" name = "leo-abnf" version = "1.5.2" dependencies = [ + "abnf", "anyhow", ] @@ -1322,6 +1348,19 @@ dependencies = [ "serde_yaml", ] +[[package]] +name = "lexical-core" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe" +dependencies = [ + "arrayvec", + "bitflags", + "cfg-if 1.0.0", + "ryu", + "static_assertions", +] + [[package]] name = "libc" version = "0.2.95" @@ -1517,6 +1556,17 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab250442c86f1850815b5d268639dff018c0627022bc1940eb2d642ca1ce12f0" +[[package]] +name = "nom" +version = "7.0.0-alpha1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd43cd1e53168596e629accc602ada1297f5125fed588d62cf8be81175b46002" +dependencies = [ + "lexical-core", + "memchr", + "version_check", +] + [[package]] name = "notify" version = "4.0.17" @@ -2499,6 +2549,12 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "strsim" version = "0.8.0" diff --git a/grammar/Cargo.toml b/grammar/Cargo.toml index 25a27d723d..d9fc3e5b9c 100644 --- a/grammar/Cargo.toml +++ b/grammar/Cargo.toml @@ -19,3 +19,6 @@ edition = "2018" [dependencies.anyhow] version = "1.0" + +[dependencies.abnf] +version = "0.12.0" diff --git a/grammar/src/main.rs b/grammar/src/main.rs index 9c91b165b6..8ef25c11a5 100644 --- a/grammar/src/main.rs +++ b/grammar/src/main.rs @@ -38,180 +38,181 @@ // ;;;;;;;;; // ``` // -// use abnf::types::{Node, Rule}; -// use anyhow::Result; -// use std::collections::{HashMap, HashSet}; -// -// /// Processor's scope. Used when code block or definition starts or ends. -// #[derive(Debug, Clone)] -// enum Scope { -// Free, -// Code, -// Definition(Rule), -// } -// -// /// Transforms abnf file into Markdown. -// #[derive(Debug, Clone)] -// struct Processor<'a> { -// rules: HashMap, -// grammar: &'a str, -// scope: Scope, -// line: u32, -// out: String, -// } -// -// impl<'a> Processor<'a> { -// fn new(grammar: &'a str, abnf: Vec) -> Processor<'a> { -// // we need a hashmap to pull rules easily -// let rules: HashMap = abnf.into_iter().map(|rule| (rule.name().to_string(), rule)).collect(); -// -// Processor { -// grammar, -// line: 0, -// out: String::new(), -// rules, -// scope: Scope::Free, -// } -// } -// -// /// Main function for this struct. -// /// Goes through each line and transforms it into proper markdown. -// fn process(&mut self) { -// let lines = self.grammar.lines(); -// let mut prev = ""; -// -// for line in lines { -// self.line += 1; -// -// // code block in comment (not highlighted as abnf) -// if let Some(code) = line.strip_prefix("; ") { -// self.enter_scope(Scope::Code); -// self.append_str(code); -// -// // just comment. end of code block -// } else if let Some(code) = line.strip_prefix("; ") { -// self.enter_scope(Scope::Free); -// self.append_str(code); -// -// // horizontal rule - section separator -// } else if line.starts_with(";;;;;;;;;;") { -// self.enter_scope(Scope::Free); -// self.append_str("\n--------\n"); -// -// // empty line in comment. end of code block -// } else if line.starts_with(';') { -// self.enter_scope(Scope::Free); -// self.append_str("\n\n"); -// -// // just empty line. end of doc, start of definition -// } else if line.is_empty() { -// self.enter_scope(Scope::Free); -// self.append_str(""); -// -// // definition (may be multiline) -// } else { -// // if there's an equality sign and previous line was empty -// if line.contains('=') && prev.is_empty() { -// let (def, _) = line.split_at(line.find('=').unwrap()); -// let def = def.trim(); -// -// // try to find rule matching definition or fail -// let rule = self.rules.get(&def.to_string()).cloned().unwrap(); -// -// self.enter_scope(Scope::Definition(rule)); -// } -// -// self.append_str(line); -// } -// -// prev = line; -// } -// } -// -// /// Append new line into output, add newline character. -// fn append_str(&mut self, line: &str) { -// self.out.push_str(line); -// self.out.push('\n'); -// } -// -// /// Enter new scope (definition or code block). Allows customizing -// /// pre and post lines for each scope entered or exited. -// fn enter_scope(&mut self, new_scope: Scope) { -// match (&self.scope, &new_scope) { -// // exchange scopes between Free and Code -// (Scope::Free, Scope::Code) => self.append_str("```"), -// (Scope::Code, Scope::Free) => self.append_str("```"), -// // exchange scopes between Free and Definition -// (Scope::Free, Scope::Definition(rule)) => { -// self.append_str(&format!("", rule.name())); -// self.append_str("```abnf"); -// } -// (Scope::Definition(rule), Scope::Free) => { -// let mut rules: Vec = Vec::new(); -// parse_abnf_node(rule.node(), &mut rules); -// -// // 1. leave only unique keys -// // 2. map each rule into a link -// // 3. join results as a list -// // Note: GitHub only allows custom tags with 'user-content-' prefix -// let keys = rules -// .into_iter() -// .collect::>() -// .into_iter() -// .map(|tag| format!("[{}](#user-content-{})", &tag, tag)) -// .collect::>() -// .join(", "); -// -// self.append_str("```"); -// -// if !keys.is_empty() { -// self.append_str(&format!("\nGo to: _{}_;\n", keys)); -// } -// } -// (_, _) => (), -// }; -// -// self.scope = new_scope; -// } -// } -// -// /// Recursively parse ABNF Node and fill sum vec with found rule names. -// fn parse_abnf_node(node: &Node, sum: &mut Vec) { -// match node { -// // these two are just vectors of rules -// Node::Alternatives(vec) | Node::Concatenation(vec) => { -// for node in vec { -// parse_abnf_node(node, sum); -// } -// } -// Node::Group(node) | Node::Optional(node) => parse_abnf_node(node.as_ref(), sum), -// -// // push rulename if it is known -// Node::Rulename(name) => sum.push(name.clone()), -// -// // do nothing for other nodes -// _ => (), -// } -// } -// -// fn main() -> Result<()> { -// // Take Leo ABNF grammar file. -// let grammar = include_str!("../abnf-grammar.txt"); -// -// // Parse ABNF to get list of all definitions. -// // Rust ABNF does not provide support for `%s` (case sensitive strings, part of -// // the standard); so we need to remove all occurrences before parsing. -// let parsed = abnf::rulelist(&str::replace(grammar, "%s", "")).map_err(|e| { -// eprintln!("{}", &e); -// anyhow::anyhow!(e) -// })?; -// -// // Init parser and run it. That's it. -// let mut parser = Processor::new(grammar, parsed); -// parser.process(); -// -// // Print result of conversion to STDOUT. -// println!("{}", parser.out); -// -// Ok(()) -// } + +use abnf::types::{Node, Rule}; +use anyhow::Result; +use std::collections::{HashMap, HashSet}; + +/// Processor's scope. Used when code block or definition starts or ends. +#[derive(Debug, Clone)] +enum Scope { + Free, + Code, + Definition(Rule), +} + +/// Transforms abnf file into Markdown. +#[derive(Debug, Clone)] +struct Processor<'a> { + rules: HashMap, + grammar: &'a str, + scope: Scope, + line: u32, + out: String, +} + +impl<'a> Processor<'a> { + fn new(grammar: &'a str, abnf: Vec) -> Processor<'a> { + // we need a hashmap to pull rules easily + let rules: HashMap = abnf.into_iter().map(|rule| (rule.name().to_string(), rule)).collect(); + + Processor { + grammar, + line: 0, + out: String::new(), + rules, + scope: Scope::Free, + } + } + + /// Main function for this struct. + /// Goes through each line and transforms it into proper markdown. + fn process(&mut self) { + let lines = self.grammar.lines(); + let mut prev = ""; + + for line in lines { + self.line += 1; + + // code block in comment (not highlighted as abnf) + if let Some(code) = line.strip_prefix("; ") { + self.enter_scope(Scope::Code); + self.append_str(code); + + // just comment. end of code block + } else if let Some(code) = line.strip_prefix("; ") { + self.enter_scope(Scope::Free); + self.append_str(code); + + // horizontal rule - section separator + } else if line.starts_with(";;;;;;;;;;") { + self.enter_scope(Scope::Free); + self.append_str("\n--------\n"); + + // empty line in comment. end of code block + } else if line.starts_with(';') { + self.enter_scope(Scope::Free); + self.append_str("\n\n"); + + // just empty line. end of doc, start of definition + } else if line.is_empty() { + self.enter_scope(Scope::Free); + self.append_str(""); + + // definition (may be multiline) + } else { + // if there's an equality sign and previous line was empty + if line.contains('=') && prev.is_empty() { + let (def, _) = line.split_at(line.find('=').unwrap()); + let def = def.trim(); + + // try to find rule matching definition or fail + let rule = self.rules.get(&def.to_string()).cloned().unwrap(); + + self.enter_scope(Scope::Definition(rule)); + } + + self.append_str(line); + } + + prev = line; + } + } + + /// Append new line into output, add newline character. + fn append_str(&mut self, line: &str) { + self.out.push_str(line); + self.out.push('\n'); + } + + /// Enter new scope (definition or code block). Allows customizing + /// pre and post lines for each scope entered or exited. + fn enter_scope(&mut self, new_scope: Scope) { + match (&self.scope, &new_scope) { + // exchange scopes between Free and Code + (Scope::Free, Scope::Code) => self.append_str("```"), + (Scope::Code, Scope::Free) => self.append_str("```"), + // exchange scopes between Free and Definition + (Scope::Free, Scope::Definition(rule)) => { + self.append_str(&format!("", rule.name())); + self.append_str("```abnf"); + } + (Scope::Definition(rule), Scope::Free) => { + let mut rules: Vec = Vec::new(); + parse_abnf_node(rule.node(), &mut rules); + + // 1. leave only unique keys + // 2. map each rule into a link + // 3. join results as a list + // Note: GitHub only allows custom tags with 'user-content-' prefix + let keys = rules + .into_iter() + .collect::>() + .into_iter() + .map(|tag| format!("[{}](#user-content-{})", &tag, tag)) + .collect::>() + .join(", "); + + self.append_str("```"); + + if !keys.is_empty() { + self.append_str(&format!("\nGo to: _{}_;\n", keys)); + } + } + (_, _) => (), + }; + + self.scope = new_scope; + } +} + +/// Recursively parse ABNF Node and fill sum vec with found rule names. +fn parse_abnf_node(node: &Node, sum: &mut Vec) { + match node { + // these two are just vectors of rules + Node::Alternatives(vec) | Node::Concatenation(vec) => { + for node in vec { + parse_abnf_node(node, sum); + } + } + Node::Group(node) | Node::Optional(node) => parse_abnf_node(node.as_ref(), sum), + + // push rulename if it is known + Node::Rulename(name) => sum.push(name.clone()), + + // do nothing for other nodes + _ => (), + } +} + +fn main() -> Result<()> { + // Take Leo ABNF grammar file. + let grammar = include_str!("../abnf-grammar.txt"); + + // Parse ABNF to get list of all definitions. + // Rust ABNF does not provide support for `%s` (case sensitive strings, part of + // the standard); so we need to remove all occurrences before parsing. + let parsed = abnf::rulelist(&str::replace(grammar, "%s", "")).map_err(|e| { + eprintln!("{}", &e); + anyhow::anyhow!(e) + })?; + + // Init parser and run it. That's it. + let mut parser = Processor::new(grammar, parsed); + parser.process(); + + // Print result of conversion to STDOUT. + println!("{}", parser.out); + + Ok(()) +} From 546636152b3829eafd716edcc92bc70338f8286a Mon Sep 17 00:00:00 2001 From: howardwu Date: Sat, 17 Jul 2021 00:42:24 -0700 Subject: [PATCH 2/5] Updates Leo to snarkVM v0.7.4 --- Cargo.lock | 314 ++++++++++++------ Cargo.toml | 10 +- compiler/Cargo.toml | 15 +- compiler/src/expression/array/access.rs | 6 +- compiler/src/expression/relational/eq.rs | 2 +- compiler/src/function/result/result.rs | 2 +- .../statement/assign/assignee/array_index.rs | 2 +- compiler/src/value/address/address.rs | 16 +- compiler/src/value/char/char.rs | 8 +- .../src/value/group/targets/edwards_bls12.rs | 44 +-- leo/commands/prove.rs | 2 +- leo/commands/setup.rs | 5 +- state/Cargo.toml | 9 +- .../local_data_commitment.rs | 35 +- .../record_commitment/dpc_record_values.rs | 6 +- .../record_commitment/record_commitment.rs | 23 +- .../test_verify_local_data_commitment.rs | 20 +- synthesizer/Cargo.toml | 8 +- synthesizer/src/circuit_synthesizer.rs | 4 + synthesizer/src/serialized_field.rs | 2 +- 20 files changed, 335 insertions(+), 198 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 61bc9874ab..adaba50db7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,6 +17,17 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "ahash" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43bb833f0bf979d8475d38fbf09ed3b8a55e1885fe93ad3f93239fc6a4f17b98" +dependencies = [ + "getrandom 0.2.3", + "once_cell", + "version_check", +] + [[package]] name = "aho-corasick" version = "0.7.18" @@ -110,9 +121,9 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" [[package]] name = "bech32" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c7f7096bc256f5e5cb960f60dfc4f4ef979ca65abe7fb9d5a4f77150d3783d4" +checksum = "cf9ff0bbfd639f15c74af777d81383cf53efb7c93613f6cab67c6c11e05bbf8b" [[package]] name = "bincode" @@ -220,9 +231,9 @@ checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" [[package]] name = "bzip2" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf8012c8a15d5df745fcf258d93e6149dcf102882c8d8702d9cff778eab43a8" +checksum = "6afcd980b5f3a45017c57e57a2fcccbb351cc43a356ce117ef760ef8052b89b0" dependencies = [ "bzip2-sys", "libc", @@ -230,9 +241,9 @@ dependencies = [ [[package]] name = "bzip2-sys" -version = "0.1.10+1.0.8" +version = "0.1.11+1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17fa3d1ac1ca21c5c4e36a97f3c3eb25084576f6fc47bf0139c1123434216c6c" +checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" dependencies = [ "cc", "libc", @@ -241,18 +252,18 @@ dependencies = [ [[package]] name = "cast" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57cdfa5d50aad6cb4d44dcab6101a7f79925bd59d82ca42f38a9856a28865374" +checksum = "4c24dab4283a142afa2fdca129b80ad2c6284e073930f964c3a1293c225ee39a" dependencies = [ - "rustc_version", + "rustc_version 0.4.0", ] [[package]] name = "cc" -version = "1.0.68" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a72c244c1ff497a746a7e1fb3d14bd08420ecda70c8f25c7112f2781652d787" +checksum = "e70cc2f62c6ce1868963827bd677764c62d07c3d9a3e1fb1177ee1a9ab199eb2" [[package]] name = "cfg-if" @@ -348,9 +359,9 @@ checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" [[package]] name = "cpufeatures" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed00c67cb5d0a7d64a44f6ad2668db7e7530311dd53ea79bcd4fb022c64911c8" +checksum = "66c99696f6c9dd7f35d486b9d04d7e6e202aa3e8c40d553f2fdf5e7e0c6a71ef" dependencies = [ "libc", ] @@ -476,6 +487,36 @@ dependencies = [ "memchr", ] +[[package]] +name = "curl" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "003cb79c1c6d1c93344c7e1201bb51c2148f24ec2bd9c253709d6b2efb796515" +dependencies = [ + "curl-sys", + "libc", + "openssl-probe", + "openssl-sys", + "schannel", + "socket2", + "winapi 0.3.9", +] + +[[package]] +name = "curl-sys" +version = "0.4.44+curl-7.77.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b6d85e9322b193f117c966e79c2d6929ec08c02f339f950044aba12e20bbaf1" +dependencies = [ + "cc", + "libc", + "libz-sys", + "openssl-sys", + "pkg-config", + "vcpkg", + "winapi 0.3.9", +] + [[package]] name = "derivative" version = "2.2.0" @@ -484,7 +525,7 @@ checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" dependencies = [ "proc-macro2 1.0.27", "quote 1.0.9", - "syn 1.0.72", + "syn 1.0.73", ] [[package]] @@ -592,7 +633,7 @@ checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" dependencies = [ "proc-macro2 1.0.27", "quote 1.0.9", - "syn 1.0.72", + "syn 1.0.73", "synstructure", ] @@ -868,6 +909,9 @@ name = "hashbrown" version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +dependencies = [ + "ahash", +] [[package]] name = "heck" @@ -880,9 +924,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ "libc", ] @@ -929,9 +973,9 @@ checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440" [[package]] name = "hyper" -version = "0.14.9" +version = "0.14.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07d6baa1b441335f3ce5098ac421fb6547c46dda735ca1bc6d0153c838f9dd83" +checksum = "7728a72c4c7d72665fde02204bcbd93b247721025b222ef78606f14513e0fd03" dependencies = [ "bytes", "futures-channel", @@ -1029,9 +1073,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47be2f14c678be2fdcab04ab1171db51b2762ce6f0a8ee87c8dd4a04ed216135" +checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" [[package]] name = "itertools" @@ -1324,9 +1368,21 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.95" +version = "0.2.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "789da6d93f1b866ffe175afc5322a4d76c038605a1c3319bb57b06967ca98a36" +checksum = "320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790" + +[[package]] +name = "libz-sys" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de5435b8549c16d423ed0c03dbaafe57cf6c3344744f1242520d59c9d8ecec66" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] [[package]] name = "linked-hash-map" @@ -1432,9 +1488,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.7.11" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf80d3e903b34e0bd7282b218398aec54e082c840d9baf8339e0080a0c542956" +checksum = "8c2bdb6314ec10835cd3293dd268473a835c02b7b352e788be788b3c6ca6bb16" dependencies = [ "libc", "log", @@ -1592,9 +1648,9 @@ checksum = "17b02fc0ff9a9e4b35b3342880f48e896ebf69f2967921fe8646bf5b7125956a" [[package]] name = "object" -version = "0.25.2" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8bc1d42047cf336f0f939c99e97183cf31551bf0f2865a2ec9c8d91fd4ffb5e" +checksum = "a38f2be3697a57b4060074ff41b44c16870d916ad7877c17696e063257482bc7" dependencies = [ "memchr", ] @@ -1625,9 +1681,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.34" +version = "0.10.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7830286ad6a3973c0f1d9b73738f69c76b739301d0229c4b96501695cbe4c8" +checksum = "549430950c79ae24e6d02e0b7404534ecf311d94cc9f861e9e4020187d13d885" dependencies = [ "bitflags", "cfg-if 1.0.0", @@ -1645,9 +1701,9 @@ checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" [[package]] name = "openssl-sys" -version = "0.9.63" +version = "0.9.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6b0d6fb7d80f877617dfcb014e605e2b5ab2fb0afdf27935219bb6bd984cb98" +checksum = "7a7907e3bfa08bb85105209cdfcb6c63d109f8f6c1ed6ca318fff5c1853fbc1d" dependencies = [ "autocfg", "cc", @@ -1704,7 +1760,7 @@ dependencies = [ "pest_meta", "proc-macro2 1.0.27", "quote 1.0.9", - "syn 1.0.72", + "syn 1.0.73", ] [[package]] @@ -1720,9 +1776,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905" +checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443" [[package]] name = "pin-utils" @@ -1751,15 +1807,15 @@ dependencies = [ [[package]] name = "plotters-backend" -version = "0.3.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" +checksum = "d88417318da0eaf0fdcdb51a0ee6c3bed624333bff8f946733049380be67ac1c" [[package]] name = "plotters-svg" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" +checksum = "521fa9638fa597e1dc53e9412a4f9cefb01187ee1f7413076f9e6749e2885ba9" dependencies = [ "plotters-backend", ] @@ -1815,7 +1871,7 @@ dependencies = [ "proc-macro-error-attr", "proc-macro2 1.0.27", "quote 1.0.9", - "syn 1.0.72", + "syn 1.0.73", "version_check", ] @@ -1901,9 +1957,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" dependencies = [ "libc", - "rand_chacha 0.3.0", + "rand_chacha 0.3.1", "rand_core 0.6.3", - "rand_hc 0.3.0", + "rand_hc 0.3.1", ] [[package]] @@ -1918,9 +1974,9 @@ dependencies = [ [[package]] name = "rand_chacha" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", "rand_core 0.6.3", @@ -1955,9 +2011,9 @@ dependencies = [ [[package]] name = "rand_hc" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" +checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" dependencies = [ "rand_core 0.6.3", ] @@ -1998,9 +2054,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "742739e41cd49414de871ea5e549afb7e2a3ac77b589bcbebe8c82fab37147fc" +checksum = "5ab49abadf3f9e1c4bc499e8845e152ad87d2ad2d30371841171169e9d75feee" dependencies = [ "bitflags", ] @@ -2088,9 +2144,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.19" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "410f7acf3cb3a44527c5d9546bad4bf4e6c460915d5f9f2fc524498bfe8f70ce" +checksum = "dead70b0b5e03e9c814bcb6b01e03e68f7c57a80aa48c72ec92152ab3e818d49" [[package]] name = "rustc_version" @@ -2098,7 +2154,16 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" dependencies = [ - "semver", + "semver 0.11.0", +] + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver 1.0.3", ] [[package]] @@ -2179,7 +2244,7 @@ dependencies = [ "quick-xml", "regex", "reqwest", - "semver", + "semver 0.11.0", "serde_json", "tempfile", "zip", @@ -2194,6 +2259,12 @@ dependencies = [ "semver-parser", ] +[[package]] +name = "semver" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f3aac57ee7f3272d8395c6e4f502f434f0e289fcd62876f70daa008c20dcabe" + [[package]] name = "semver-parser" version = "0.10.2" @@ -2230,7 +2301,7 @@ checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43" dependencies = [ "proc-macro2 1.0.27", "quote 1.0.9", - "syn 1.0.72", + "syn 1.0.73", ] [[package]] @@ -2325,10 +2396,11 @@ checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" [[package]] name = "snarkvm-algorithms" -version = "0.6.0" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba6482ab4ec9170c9b8ce6c1ac9689d02aba1e112b474fa10cb72e8dda6ae0bd" +checksum = "352a3345d4ba258c1454b459f6449b48ae2062c686e8beba43805031abb70c72" dependencies = [ + "anyhow", "bitvec", "blake2", "crossbeam-channel", @@ -2338,7 +2410,7 @@ dependencies = [ "lazy_static", "once_cell", "rand 0.8.4", - "rand_chacha 0.3.0", + "rand_chacha 0.3.1", "rayon", "sha2", "smallvec", @@ -2352,14 +2424,14 @@ dependencies = [ [[package]] name = "snarkvm-curves" -version = "0.6.0" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29f5549929d0cc1cb8165e643f2d348f619f2f7cd5ce655201b36bf8b1aa4494" +checksum = "f97e6d7dc07a949050728353f2de05fd2ea376515a866fb9f06cfde14803a91e" dependencies = [ "derivative", "rand 0.8.4", "rand_xorshift", - "rustc_version", + "rustc_version 0.3.3", "serde", "snarkvm-fields", "snarkvm-utilities", @@ -2368,22 +2440,22 @@ dependencies = [ [[package]] name = "snarkvm-derives" -version = "0.6.0" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45886a0c7a81323c267a4c2cfab1de7f0621a8f03a04fb78e2ea4f3ae5e26066" +checksum = "ffcfd2f005ec8c25c627516dfe4245e330792d22a21f6176627309072cd65176" dependencies = [ "proc-macro-crate", "proc-macro-error", "proc-macro2 1.0.27", "quote 1.0.9", - "syn 1.0.72", + "syn 1.0.73", ] [[package]] name = "snarkvm-dpc" -version = "0.6.0" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03ce3598d82ad7b3401c6d9a2a1a97dfce24eb25dba75e366389d106a62d3995" +checksum = "4e778b5e032a4c48e2a12a1806ca10044900d92c0ae42e721faa85af40430109" dependencies = [ "anyhow", "base58", @@ -2402,7 +2474,9 @@ dependencies = [ "snarkvm-curves", "snarkvm-fields", "snarkvm-gadgets", + "snarkvm-marlin", "snarkvm-parameters", + "snarkvm-polycommit", "snarkvm-profiler", "snarkvm-r1cs", "snarkvm-utilities", @@ -2411,10 +2485,11 @@ dependencies = [ [[package]] name = "snarkvm-fields" -version = "0.6.0" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9467325948cf839e5aeb5c91a502a2b79474d35672155a225b51b7b2c39e8e5e" +checksum = "aab09f08aee0e85613772242a442ad7057f166c54150ac52d5d5fbe00df77f1b" dependencies = [ + "anyhow", "bincode", "derivative", "rand 0.8.4", @@ -2426,9 +2501,9 @@ dependencies = [ [[package]] name = "snarkvm-gadgets" -version = "0.6.0" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2511b5493f835f6908ee1c1411b233c1abb5de7937925dd17ca44ae6e819a186" +checksum = "552bb91384d004a314d27eefd863c0992a3a984b7e5dcfce711b4e85f1cbfc03" dependencies = [ "derivative", "digest 0.9.0", @@ -2445,11 +2520,36 @@ dependencies = [ ] [[package]] -name = "snarkvm-parameters" -version = "0.6.0" +name = "snarkvm-marlin" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8591a36b0a21f24394ec6a592ac3e6d669694156094771bd0a58c0c113b2d25" +checksum = "e2af3e3720556f0fd653e2255c0e2aa1333624e658b759eb109f6364f9456c7f" dependencies = [ + "blake2", + "derivative", + "digest 0.9.0", + "hashbrown", + "rand 0.8.4", + "rand_chacha 0.3.1", + "rand_core 0.6.3", + "rayon", + "snarkvm-algorithms", + "snarkvm-curves", + "snarkvm-fields", + "snarkvm-gadgets", + "snarkvm-polycommit", + "snarkvm-profiler", + "snarkvm-r1cs", + "snarkvm-utilities", +] + +[[package]] +name = "snarkvm-parameters" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bae615fbc1065cfe3e23dd8e3407148c4e7a5afa1632e3120f4b85ad099d810" +dependencies = [ + "curl", "hex", "snarkvm-algorithms", "snarkvm-utilities", @@ -2457,16 +2557,35 @@ dependencies = [ ] [[package]] -name = "snarkvm-profiler" -version = "0.6.0" +name = "snarkvm-polycommit" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8892a13630b65576cd983bc69fa89bdff3f568e56466cc523a1cee783ec1513" +checksum = "c7f72af773beed90a4ef947ad153b7cc9733e543414d144b68d7d3d62b32fd98" +dependencies = [ + "derivative", + "digest 0.9.0", + "hashbrown", + "rand_core 0.6.3", + "snarkvm-algorithms", + "snarkvm-curves", + "snarkvm-fields", + "snarkvm-gadgets", + "snarkvm-profiler", + "snarkvm-r1cs", + "snarkvm-utilities", +] + +[[package]] +name = "snarkvm-profiler" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a428f675f2df8c3aa3683ee583ea36fd8ecff5959cdcd528c07f209986d3614" [[package]] name = "snarkvm-r1cs" -version = "0.6.0" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea6805a58c986fd78be5cf474a62e40b19abf64187457874a7c93f0b8573fde6" +checksum = "42fc7eaab616b21fb6e0dab4f0c9402a8c831d7c65fa5e4eb941919bf7d9ea33" dependencies = [ "cfg-if 1.0.0", "fxhash", @@ -2479,11 +2598,13 @@ dependencies = [ [[package]] name = "snarkvm-utilities" -version = "0.6.0" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f6dcdbf85edf6a03157aef21608e3c44835eeff97d0c2d0b3c90b3bcb869e82" +checksum = "c47f9b27b3dadda802b019e494bd6ddb6b4b3cc001b402eb217b75d66ff7758f" dependencies = [ + "anyhow", "bincode", + "num-bigint", "rand 0.8.4", "snarkvm-derives", "thiserror", @@ -2526,14 +2647,14 @@ dependencies = [ "proc-macro-error", "proc-macro2 1.0.27", "quote 1.0.9", - "syn 1.0.72", + "syn 1.0.73", ] [[package]] name = "subtle" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" @@ -2548,9 +2669,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.72" +version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1e8cdbefb79a9a5a65e0db8b47b723ee907b7c7f8496c76a1770b5c310bab82" +checksum = "f71489ff30030d2ae598524f61326b902466f72a0fb1a8564c001cc63425bcc7" dependencies = [ "proc-macro2 1.0.27", "quote 1.0.9", @@ -2559,13 +2680,13 @@ dependencies = [ [[package]] name = "synstructure" -version = "0.12.4" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" +checksum = "474aaa926faa1603c40b7885a9eaea29b444d1cb2850cb7c0e37bb1a4182f4fa" dependencies = [ "proc-macro2 1.0.27", "quote 1.0.9", - "syn 1.0.72", + "syn 1.0.73", "unicode-xid 0.2.2", ] @@ -2645,7 +2766,7 @@ checksum = "060d69a0afe7796bf42e9e2ff91f5ee691fb15c53d38b4b62a9a53eb23164745" dependencies = [ "proc-macro2 1.0.27", "quote 1.0.9", - "syn 1.0.72", + "syn 1.0.73", ] [[package]] @@ -2694,17 +2815,18 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.6.1" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a38d31d7831c6ed7aad00aa4c12d9375fd225a6dd77da1d25b707346319a975" +checksum = "98c8b05dc14c75ea83d63dd391100353789f5f24b8b3866542a5e85c8be8e985" dependencies = [ "autocfg", "bytes", "libc", "memchr", - "mio 0.7.11", + "mio 0.7.13", "num_cpus", "pin-project-lite", + "winapi 0.3.9", ] [[package]] @@ -2766,7 +2888,7 @@ checksum = "c42e6fa53307c8a17e4ccd4dc81cf5ec38db9209f59b222210375b54ee40d1e2" dependencies = [ "proc-macro2 1.0.27", "quote 1.0.9", - "syn 1.0.72", + "syn 1.0.73", ] [[package]] @@ -2880,9 +3002,9 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.7.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" +checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" [[package]] name = "unicode-width" @@ -2922,9 +3044,9 @@ checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" [[package]] name = "vcpkg" -version = "0.2.13" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "025ce40a007e1907e58d5bc1a594def78e5573bb0b1160bc389634e8f12e4faa" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "vec_map" @@ -3009,7 +3131,7 @@ dependencies = [ "log", "proc-macro2 1.0.27", "quote 1.0.9", - "syn 1.0.72", + "syn 1.0.73", "wasm-bindgen-shared", ] @@ -3043,7 +3165,7 @@ checksum = "be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97" dependencies = [ "proc-macro2 1.0.27", "quote 1.0.9", - "syn 1.0.72", + "syn 1.0.73", "wasm-bindgen-backend", "wasm-bindgen-shared", ] diff --git a/Cargo.toml b/Cargo.toml index a99ee780e1..68ab110f40 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -74,22 +74,22 @@ path = "./synthesizer" version = "1.5.2" [dependencies.snarkvm-algorithms] -version = "0.6.0" +version = "0.7.4" [dependencies.snarkvm-curves] -version = "0.6.0" +version = "0.7.4" default-features = false [dependencies.snarkvm-gadgets] -version = "0.6.0" +version = "0.7.4" default-features = false [dependencies.snarkvm-r1cs] -version = "0.6.0" +version = "0.7.4" default-features = false [dependencies.snarkvm-utilities] -version = "0.6.0" +version = "0.7.4" [dependencies.anyhow] version = "1.0" diff --git a/compiler/Cargo.toml b/compiler/Cargo.toml index 02807568e1..7f4cfb0580 100644 --- a/compiler/Cargo.toml +++ b/compiler/Cargo.toml @@ -57,27 +57,28 @@ version = "1.5.2" version = "0.4" [dependencies.snarkvm-curves] -version = "0.6.0" +version = "0.7.4" default-features = false [dependencies.snarkvm-fields] -version = "0.6.0" +version = "0.7.4" default-features = false [dependencies.snarkvm-dpc] -version = "0.6.0" +version = "0.7.4" default-features = false [dependencies.snarkvm-gadgets] -version = "0.6.0" +version = "0.7.4" default-features = false +features = ["curves"] [dependencies.snarkvm-r1cs] -version = "0.6.0" +version = "0.7.4" default-features = false [dependencies.snarkvm-utilities] -version = "0.6.0" +version = "0.7.4" [dependencies.bincode] version = "1.3" @@ -118,7 +119,7 @@ version = "0.3" default-features = false [dev-dependencies.snarkvm-algorithms] -version = "0.6.0" +version = "0.7.4" default-features = false [dev-dependencies.tempfile] diff --git a/compiler/src/expression/array/access.rs b/compiler/src/expression/array/access.rs index 1438ef5b91..11009dbd64 100644 --- a/compiler/src/expression/array/access.rs +++ b/compiler/src/expression/array/access.rs @@ -31,8 +31,10 @@ use leo_asg::{ConstInt, Expression, Span}; use snarkvm_fields::PrimeField; use snarkvm_gadgets::{ boolean::Boolean, - eq::{EqGadget, EvaluateEqGadget}, - select::CondSelectGadget, + traits::{ + eq::{EqGadget, EvaluateEqGadget}, + select::CondSelectGadget, + }, }; use snarkvm_r1cs::ConstraintSystem; diff --git a/compiler/src/expression/relational/eq.rs b/compiler/src/expression/relational/eq.rs index b7be209181..6e5fa0f874 100644 --- a/compiler/src/expression/relational/eq.rs +++ b/compiler/src/expression/relational/eq.rs @@ -20,7 +20,7 @@ use crate::{enforce_and, errors::ExpressionError, value::ConstrainedValue, Group use leo_asg::Span; use snarkvm_fields::PrimeField; -use snarkvm_gadgets::{boolean::Boolean, eq::EvaluateEqGadget}; +use snarkvm_gadgets::{boolean::Boolean, traits::eq::EvaluateEqGadget}; use snarkvm_r1cs::ConstraintSystem; pub fn evaluate_eq<'a, F: PrimeField, G: GroupType, CS: ConstraintSystem>( diff --git a/compiler/src/function/result/result.rs b/compiler/src/function/result/result.rs index be09a87c69..a0f71b896c 100644 --- a/compiler/src/function/result/result.rs +++ b/compiler/src/function/result/result.rs @@ -27,7 +27,7 @@ use crate::{ use leo_asg::{Span, Type}; use snarkvm_fields::PrimeField; -use snarkvm_gadgets::{boolean::Boolean, select::CondSelectGadget}; +use snarkvm_gadgets::{boolean::Boolean, traits::select::CondSelectGadget}; use snarkvm_r1cs::ConstraintSystem; impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { diff --git a/compiler/src/statement/assign/assignee/array_index.rs b/compiler/src/statement/assign/assignee/array_index.rs index 0ef0007a0b..4b7fc6f3b0 100644 --- a/compiler/src/statement/assign/assignee/array_index.rs +++ b/compiler/src/statement/assign/assignee/array_index.rs @@ -28,7 +28,7 @@ use crate::{ use leo_asg::{ConstInt, Expression, Node}; use snarkvm_fields::PrimeField; -use snarkvm_gadgets::{eq::EvaluateEqGadget, select::CondSelectGadget}; +use snarkvm_gadgets::traits::{eq::EvaluateEqGadget, select::CondSelectGadget}; use snarkvm_r1cs::ConstraintSystem; use super::ResolverContext; diff --git a/compiler/src/value/address/address.rs b/compiler/src/value/address/address.rs index 05ef09accd..f706448c4d 100644 --- a/compiler/src/value/address/address.rs +++ b/compiler/src/value/address/address.rs @@ -17,7 +17,7 @@ use crate::{errors::AddressError, ConstrainedValue, GroupType, IntegerTrait}; use leo_ast::{InputValue, Span}; -use snarkvm_dpc::{account::AccountAddress, testnet1::instantiated::Components}; +use snarkvm_dpc::{account::Address as AleoAddress, testnet1::instantiated::Components}; use snarkvm_fields::PrimeField; use snarkvm_gadgets::{ boolean::Boolean, @@ -35,16 +35,16 @@ use std::{borrow::Borrow, str::FromStr}; /// A public address #[derive(Clone, Debug, PartialEq, Eq)] pub struct Address { - pub address: Option>, + pub address: Option>, pub bytes: Vec, } impl Address { pub(crate) fn constant(address: String, span: &Span) -> Result { - let address = AccountAddress::from_str(&address).map_err(|error| AddressError::account_error(error, span))?; + let address = AleoAddress::from_str(&address).map_err(|error| AddressError::account_error(error, span))?; let mut address_bytes = vec![]; - address.write(&mut address_bytes).unwrap(); + address.write_le(&mut address_bytes).unwrap(); let bytes = UInt8::constant_vec(&address_bytes[..]); @@ -87,7 +87,7 @@ impl Address { pub(crate) fn alloc_helper Result, T: Borrow>( value_gen: Fn, - ) -> Result, SynthesisError> { + ) -> Result, SynthesisError> { let address_string = match value_gen() { Ok(value) => { let string_value = value.borrow().clone(); @@ -96,7 +96,7 @@ impl Address { _ => Err(SynthesisError::AssignmentMissing), }?; - AccountAddress::from_str(&address_string).map_err(|_| SynthesisError::AssignmentMissing) + AleoAddress::from_str(&address_string).map_err(|_| SynthesisError::AssignmentMissing) } } @@ -108,7 +108,7 @@ impl AllocGadget for Address { let address = Self::alloc_helper(value_gen)?; let mut address_bytes = vec![]; address - .write(&mut address_bytes) + .write_le(&mut address_bytes) .map_err(|_| SynthesisError::AssignmentMissing)?; let bytes = UInt8::alloc_vec(cs, &address_bytes[..])?; @@ -126,7 +126,7 @@ impl AllocGadget for Address { let address = Self::alloc_helper(value_gen)?; let mut address_bytes = vec![]; address - .write(&mut address_bytes) + .write_le(&mut address_bytes) .map_err(|_| SynthesisError::AssignmentMissing)?; let bytes = UInt8::alloc_input_vec_le(cs, &address_bytes[..])?; diff --git a/compiler/src/value/char/char.rs b/compiler/src/value/char/char.rs index 9ff0f782c9..efa6e81ca5 100644 --- a/compiler/src/value/char/char.rs +++ b/compiler/src/value/char/char.rs @@ -25,9 +25,11 @@ use leo_ast::{InputValue, Span}; use snarkvm_fields::PrimeField; use snarkvm_gadgets::{ boolean::Boolean, - eq::{ConditionalEqGadget, EqGadget, EvaluateEqGadget, NEqGadget}, - select::CondSelectGadget, - traits::bits::comparator::{ComparatorGadget, EvaluateLtGadget}, + traits::{ + bits::comparator::{ComparatorGadget, EvaluateLtGadget}, + eq::{ConditionalEqGadget, EqGadget, EvaluateEqGadget, NEqGadget}, + select::CondSelectGadget, + }, }; use snarkvm_r1cs::{ConstraintSystem, SynthesisError}; diff --git a/compiler/src/value/group/targets/edwards_bls12.rs b/compiler/src/value/group/targets/edwards_bls12.rs index 815e095e85..bf6367ea35 100644 --- a/compiler/src/value/group/targets/edwards_bls12.rs +++ b/compiler/src/value/group/targets/edwards_bls12.rs @@ -19,15 +19,15 @@ use leo_asg::{GroupCoordinate, GroupValue, Span}; use snarkvm_curves::{ edwards_bls12::{EdwardsAffine, EdwardsParameters, Fq}, - templates::twisted_edwards_extended::GroupAffine, + templates::twisted_edwards_extended::Affine, AffineCurve, - TEModelParameters, + TwistedEdwardsParameters, }; use snarkvm_fields::{Fp256, One, Zero}; use snarkvm_gadgets::{ bits::{ToBitsBEGadget, ToBytesGadget}, boolean::Boolean, - curves::edwards_bls12::EdwardsBlsGadget, + curves::edwards_bls12::EdwardsBls12Gadget, fields::{AllocatedFp, FpGadget}, integers::uint::UInt8, traits::{ @@ -48,7 +48,7 @@ use std::{ #[derive(Clone, Debug)] pub enum EdwardsGroupType { Constant(EdwardsAffine), - Allocated(Box), + Allocated(Box), } impl GroupType for EdwardsGroupType { @@ -68,7 +68,7 @@ impl GroupType for EdwardsGroupType { match self { EdwardsGroupType::Constant(group) => Ok(EdwardsGroupType::Constant(group.neg())), EdwardsGroupType::Allocated(group) => { - let result = , Fq>>::negate(group, cs) + let result = , Fq>>::negate(group, cs) .map_err(|e| GroupError::negate_operation(e, span))?; Ok(EdwardsGroupType::Allocated(Box::new(result))) @@ -83,7 +83,7 @@ impl GroupType for EdwardsGroupType { } (EdwardsGroupType::Allocated(self_value), EdwardsGroupType::Allocated(other_value)) => { - let result = , Fq>>::add( + let result = , Fq>>::add( self_value, cs, other_value, @@ -111,7 +111,7 @@ impl GroupType for EdwardsGroupType { } (EdwardsGroupType::Allocated(self_value), EdwardsGroupType::Allocated(other_value)) => { - let result = , Fq>>::sub( + let result = , Fq>>::sub( self_value, cs, other_value, @@ -317,10 +317,10 @@ impl EdwardsGroupType { Self::edwards_affine_from_value(&group_value, &Span::default()).map_err(|_| SynthesisError::AssignmentMissing) } - pub fn allocated>(&self, mut cs: CS) -> Result { + pub fn allocated>(&self, mut cs: CS) -> Result { match self { EdwardsGroupType::Constant(constant) => { - , Fq>>::alloc( + , Fq>>::alloc( &mut cs.ns(|| format!("{:?}", constant)), || Ok(constant), ) @@ -332,7 +332,7 @@ impl EdwardsGroupType { let x_allocated = FpGadget::alloc(cs.ns(|| "x"), || x_value.ok_or(SynthesisError::AssignmentMissing))?; let y_allocated = FpGadget::alloc(cs.ns(|| "y"), || y_value.ok_or(SynthesisError::AssignmentMissing))?; - Ok(EdwardsBlsGadget::new(x_allocated, y_allocated)) + Ok(EdwardsBls12Gadget::new(x_allocated, y_allocated)) } } } @@ -343,7 +343,7 @@ impl AllocGadget for EdwardsGroupType { cs: CS, value_gen: Fn, ) -> Result { - let value = , Fq>>::alloc(cs, || { + let value = , Fq>>::alloc(cs, || { Self::alloc_helper(value_gen) })?; @@ -354,7 +354,7 @@ impl AllocGadget for EdwardsGroupType { cs: CS, value_gen: Fn, ) -> Result { - let value = , Fq>>::alloc_input(cs, || { + let value = , Fq>>::alloc_input(cs, || { Self::alloc_helper(value_gen) })?; @@ -375,7 +375,7 @@ impl PartialEq for EdwardsGroupType { (EdwardsGroupType::Constant(constant_value), EdwardsGroupType::Allocated(allocated_value)) | (EdwardsGroupType::Allocated(allocated_value), EdwardsGroupType::Constant(constant_value)) => { - , Fq>>::get_value(allocated_value) + , Fq>>::get_value(allocated_value) .map(|allocated_value| allocated_value == *constant_value) .unwrap_or(false) } @@ -387,8 +387,8 @@ impl Eq for EdwardsGroupType {} // fn compare_allocated_edwards_bls_gadgets>( // mut cs: CS, -// first: &EdwardsBlsGadget, -// second: &EdwardsBlsGadget, +// first: &EdwardsBls12Gadget, +// second: &EdwardsBls12Gadget, // ) -> Result { // // compare x coordinates // let x_first = &first.x; @@ -422,7 +422,7 @@ impl EvaluateEqGadget for EdwardsGroupType { // (EdwardsGroupType::Constant(constant_value), EdwardsGroupType::Allocated(allocated_value)) // | (EdwardsGroupType::Allocated(allocated_value), EdwardsGroupType::Constant(constant_value)) => { // let allocated_constant_value = - // , Fq>>::alloc( + // , Fq>>::alloc( // &mut cs.ns(|| format!("alloc constant for eq")), // || Ok(constant_value), // )?; @@ -452,14 +452,14 @@ impl ConditionalEqGadget for EdwardsGroupType { } // a - a (EdwardsGroupType::Allocated(self_value), EdwardsGroupType::Allocated(other_value)) => { - ::conditional_enforce_equal(self_value, cs, other_value, condition) + ::conditional_enforce_equal(self_value, cs, other_value, condition) } // c - a = a - c (EdwardsGroupType::Constant(constant_value), EdwardsGroupType::Allocated(allocated_value)) | (EdwardsGroupType::Allocated(allocated_value), EdwardsGroupType::Constant(constant_value)) => { let x = FpGadget::from(AllocatedFp::from(&mut cs, &constant_value.x)); let y = FpGadget::from(AllocatedFp::from(&mut cs, &constant_value.y)); - let constant_gadget = EdwardsBlsGadget::new(x, y); + let constant_gadget = EdwardsBls12Gadget::new(x, y); constant_gadget.conditional_enforce_equal(cs, allocated_value, condition) } @@ -467,7 +467,7 @@ impl ConditionalEqGadget for EdwardsGroupType { } fn cost() -> usize { - 2 * >::cost() //upper bound + 2 * >::cost() //upper bound } } @@ -483,14 +483,14 @@ impl CondSelectGadget for EdwardsGroupType { } else { let first_gadget = first.allocated(cs.ns(|| "first"))?; let second_gadget = second.allocated(cs.ns(|| "second"))?; - let result = EdwardsBlsGadget::conditionally_select(cs, cond, &first_gadget, &second_gadget)?; + let result = EdwardsBls12Gadget::conditionally_select(cs, cond, &first_gadget, &second_gadget)?; Ok(EdwardsGroupType::Allocated(Box::new(result))) } } fn cost() -> usize { - 2 * >::cost() + 2 * >::cost() } } @@ -518,7 +518,7 @@ impl ToBytesGadget for EdwardsGroupType { } } -fn edwards_affine_one() -> GroupAffine { +fn edwards_affine_one() -> Affine { let (x, y) = EdwardsParameters::AFFINE_GENERATOR_COEFFS; EdwardsAffine::new(x, y) diff --git a/leo/commands/prove.rs b/leo/commands/prove.rs index 799b155688..46fdac1dad 100644 --- a/leo/commands/prove.rs +++ b/leo/commands/prove.rs @@ -70,7 +70,7 @@ impl Command for Prove { // Write the proof file to the output directory let mut proof = vec![]; - program_proof.write(&mut proof)?; + program_proof.write_le(&mut proof)?; ProofFile::new(&package_name).write_to(&path, &proof)?; Ok((program_proof, prepared_verifying_key)) diff --git a/leo/commands/setup.rs b/leo/commands/setup.rs index e2d29ca90b..cfa15c6871 100644 --- a/leo/commands/setup.rs +++ b/leo/commands/setup.rs @@ -24,6 +24,7 @@ use snarkvm_algorithms::{ traits::snark::SNARK, }; use snarkvm_curves::bls12_377::{Bls12_377, Fr}; +use snarkvm_utilities::ToBytes; use anyhow::{anyhow, Result}; use rand::thread_rng; @@ -86,7 +87,7 @@ impl Command for Setup { let proving_key_file = ProvingKeyFile::new(&package_name); tracing::info!("Saving proving key ({:?})", proving_key_file.full_path(&path)); let mut proving_key_bytes = vec![]; - proving_key.write(&mut proving_key_bytes)?; + proving_key.write_le(&mut proving_key_bytes)?; let _ = proving_key_file.write_to(&path, &proving_key_bytes)?; tracing::info!("Complete"); @@ -94,7 +95,7 @@ impl Command for Setup { let verification_key_file = VerificationKeyFile::new(&package_name); tracing::info!("Saving verification key ({:?})", verification_key_file.full_path(&path)); let mut verification_key = vec![]; - proving_key.vk.write(&mut verification_key)?; + proving_key.vk.write_le(&mut verification_key)?; let _ = verification_key_file.write_to(&path, &verification_key)?; tracing::info!("Complete"); diff --git a/state/Cargo.toml b/state/Cargo.toml index 249fad4266..b91debc546 100644 --- a/state/Cargo.toml +++ b/state/Cargo.toml @@ -26,19 +26,18 @@ path = "../ast" version = "1.5.2" [dependencies.snarkvm-algorithms] -version = "0.6.0" +version = "0.7.4" [dependencies.snarkvm-curves] -version = "0.6.0" +version = "0.7.4" default-features = false [dependencies.snarkvm-dpc] -version = "0.6.0" -default-features = false +version = "0.7.4" features = [ "testnet1" ] [dependencies.snarkvm-utilities] -version = "0.6.0" +version = "0.7.4" [dependencies.indexmap] version = "1.7.0" diff --git a/state/src/local_data_commitment/local_data_commitment.rs b/state/src/local_data_commitment/local_data_commitment.rs index 1dba386945..19b74c6f22 100644 --- a/state/src/local_data_commitment/local_data_commitment.rs +++ b/state/src/local_data_commitment/local_data_commitment.rs @@ -22,25 +22,22 @@ use snarkvm_algorithms::{ traits::{CommitmentScheme, CRH}, }; use snarkvm_dpc::{ - testnet1::{ - instantiated::{Components, LocalDataCRH, LocalDataCommitment}, - parameters::SystemParameters, - }, - traits::DPCComponents, + testnet1::{instantiated::Components, parameters::SystemParameters}, + DPCComponents, }; -use snarkvm_utilities::{bytes::ToBytes, to_bytes, FromBytes}; +use snarkvm_utilities::{bytes::ToBytes, to_bytes_le, FromBytes}; use std::convert::TryFrom; /// Returns `true` if the path to the local data commitment leaf is a valid path in the record /// commitment Merkle tree. pub fn verify_local_data_commitment( - system_parameters: &SystemParameters, + dpc: &SystemParameters, ast_input: &AstInput, ) -> Result { // Verify record commitment. let typed_record = ast_input.get_record(); - let dpc_record_values = verify_record_commitment(system_parameters, typed_record)?; + let dpc_record_values = verify_record_commitment(dpc, typed_record)?; let record_commitment: Vec = dpc_record_values.commitment; let record_serial_number: Vec = dpc_record_values.serial_number; @@ -61,26 +58,32 @@ pub fn verify_local_data_commitment( // Select local data commitment input bytes. let is_death = leaf_index < (Components::NUM_INPUT_RECORDS as u32); let input_bytes = if is_death { - to_bytes![record_serial_number, record_commitment, memo, network_id]? + to_bytes_le![record_serial_number, record_commitment, memo, network_id]? } else { - to_bytes![record_commitment, memo, network_id]? + to_bytes_le![record_commitment, memo, network_id]? }; // Construct local data commitment leaf. - let local_data_leaf_randomness = ::Randomness::read(&leaf_randomness[..])?; - let local_data_commitment_leaf = LocalDataCommitment::commit( - &system_parameters.local_data_commitment, + let local_data_leaf_randomness = + <::LocalDataCommitment as CommitmentScheme>::Randomness::read_le( + &leaf_randomness[..], + )?; + let local_data_commitment_leaf = ::LocalDataCommitment::commit( + &dpc.local_data_commitment, &input_bytes, &local_data_leaf_randomness, )?; // Construct record commitment merkle path. - let local_data_merkle_path = CommitmentMerklePath::::read(&path[..])?; + let local_data_merkle_path = CommitmentMerklePath::< + ::LocalDataCommitment, + ::LocalDataCRH, + >::read_le(&path[..])?; // Check record commitment merkle path is valid for the given local data commitment root. - let local_data_commitment_root = ::Output::read(&root[..])?; + let local_data_commitment_root = <::LocalDataCRH as CRH>::Output::read_le(&root[..])?; let result = local_data_merkle_path.verify( - &system_parameters.local_data_crh, + &dpc.local_data_crh, &local_data_commitment_root, &local_data_commitment_leaf, )?; diff --git a/state/src/record_commitment/dpc_record_values.rs b/state/src/record_commitment/dpc_record_values.rs index 065e423313..7de85e1cc0 100644 --- a/state/src/record_commitment/dpc_record_values.rs +++ b/state/src/record_commitment/dpc_record_values.rs @@ -17,7 +17,7 @@ use crate::{utilities::*, DPCRecordValuesError}; use leo_ast::Record as AstRecord; -use snarkvm_dpc::{testnet1::instantiated::Components, AccountAddress}; +use snarkvm_dpc::{testnet1::instantiated::Components, Address}; use std::{convert::TryFrom, str::FromStr}; @@ -36,7 +36,7 @@ static COMMITMENT_RANDOMNESS_PARAMETER_STRING: &str = "commitment_randomness"; /// A new [`DPCRecordValues`] type can be constructed from an [`AstRecord`] type. pub struct DPCRecordValues { pub serial_number: Vec, - pub owner: AccountAddress, + pub owner: Address, pub is_dummy: bool, pub value: u64, pub payload: Vec, @@ -59,7 +59,7 @@ impl TryFrom<&AstRecord> for DPCRecordValues { // Lookup record owner let owner_value = find_input(OWNER_PARAMETER_STRING.to_owned(), ¶meters)?; - let owner = AccountAddress::::from_str(&owner_value.to_string())?; + let owner = Address::::from_str(&owner_value.to_string())?; // Lookup record is_dummy let is_dummy_value = find_input(IS_DUMMY_PARAMETER_STRING.to_owned(), ¶meters)?; diff --git a/state/src/record_commitment/record_commitment.rs b/state/src/record_commitment/record_commitment.rs index b46730c916..c4b7549b1d 100644 --- a/state/src/record_commitment/record_commitment.rs +++ b/state/src/record_commitment/record_commitment.rs @@ -18,25 +18,25 @@ use crate::{DPCRecordValues, RecordVerificationError}; use leo_ast::Record as AstRecord; use snarkvm_algorithms::traits::CommitmentScheme; -use snarkvm_dpc::testnet1::{ - instantiated::{Components, RecordCommitment}, - parameters::SystemParameters, +use snarkvm_dpc::{ + testnet1::{instantiated::Components, parameters::SystemParameters}, + DPCComponents, }; -use snarkvm_utilities::{bytes::ToBytes, to_bytes, FromBytes}; +use snarkvm_utilities::{bytes::ToBytes, to_bytes_le, FromBytes}; use std::convert::TryFrom; /// Returns a serialized [`DPCRecordValues`] type if the record commitment is valid given the /// system parameters. pub fn verify_record_commitment( - system_parameters: &SystemParameters, + dpc: &SystemParameters, ast_record: &AstRecord, ) -> Result { // generate a dpc record from the typed record let record = DPCRecordValues::try_from(ast_record)?; // verify record commitment - let record_commitment_input = to_bytes![ + let record_commitment_input = to_bytes_le![ record.owner, record.is_dummy, record.value, @@ -46,12 +46,15 @@ pub fn verify_record_commitment( record.serial_number_nonce ]?; - let commitment = ::Output::read(&record.commitment[..])?; + let commitment = + <::RecordCommitment as CommitmentScheme>::Output::read_le(&record.commitment[..])?; let commitment_randomness = - ::Randomness::read(&record.commitment_randomness[..])?; + <::RecordCommitment as CommitmentScheme>::Randomness::read_le( + &record.commitment_randomness[..], + )?; - let record_commitment = RecordCommitment::commit( - &system_parameters.record_commitment, + let record_commitment = ::RecordCommitment::commit( + &dpc.record_commitment, &record_commitment_input, &commitment_randomness, )?; diff --git a/state/tests/test_verify_local_data_commitment.rs b/state/tests/test_verify_local_data_commitment.rs index bdf45033a9..d722de562a 100644 --- a/state/tests/test_verify_local_data_commitment.rs +++ b/state/tests/test_verify_local_data_commitment.rs @@ -72,10 +72,10 @@ // let noop_program_snark_pp = // InstantiatedDPC::generate_noop_program_snark_parameters(&system_parameters, &mut rng).unwrap(); // -// let noop_program_id = to_bytes![ +// let noop_program_id = to_bytes_le![ // ProgramVerificationKeyCRH::hash( // &system_parameters.program_verification_key_crh, -// &to_bytes![noop_program_snark_pp.verification_key].unwrap() +// &to_bytes_le![noop_program_snark_pp.verification_key].unwrap() // ) // .unwrap() // ] @@ -160,11 +160,11 @@ // let root = local_data.local_data_merkle_tree.root(); // // let serial_number = local_data.old_serial_numbers[0]; -// let serial_number_bytes = to_bytes![serial_number].unwrap(); +// let serial_number_bytes = to_bytes_le![serial_number].unwrap(); // // let memorandum = local_data.memorandum; // let network_id = local_data.network_id; -// let input_bytes = to_bytes![serial_number, record.commitment(), memorandum, network_id].unwrap(); +// let input_bytes = to_bytes_le![serial_number, record.commitment(), memorandum, network_id].unwrap(); // let leaf_randomness = local_data.local_data_commitment_randomizers[0]; // // let old_record_leaf = ::commit( @@ -185,7 +185,7 @@ // println!(); // println!("[state]"); // println!("leaf index {}", leaf_index); -// println!("root {:?}", to_bytes![root].unwrap()); +// println!("root {:?}", to_bytes_le![root].unwrap()); // println!(); // println!("[record]"); // println!( @@ -193,7 +193,7 @@ // serial_number_bytes, // serial_number_bytes.len() // ); -// println!("commitment {:?}", to_bytes![record.commitment()].unwrap()); +// println!("commitment {:?}", to_bytes_le![record.commitment()].unwrap()); // println!("owner {}", record.owner()); // println!("is_dummy {:?}", record.is_dummy()); // println!("value {:?}", record.value()); @@ -202,18 +202,18 @@ // println!("death_program_id {:?}", record.death_program_id()); // println!( // "serial number nonce {:?}", -// to_bytes![record.serial_number_nonce()].unwrap() +// to_bytes_le![record.serial_number_nonce()].unwrap() // ); // println!( // "commitment randomness {:?}", -// to_bytes![record.commitment_randomness()].unwrap() +// to_bytes_le![record.commitment_randomness()].unwrap() // ); // println!(); // println!("[state_leaf]"); -// println!("path {:?}", to_bytes![path].unwrap()); +// println!("path {:?}", to_bytes_le![path].unwrap()); // println!("memo {:?}", memorandum); // println!("network id {:?}", network_id); -// println!("leaf randomness {:?}", to_bytes![leaf_randomness].unwrap()); +// println!("leaf randomness {:?}", to_bytes_le![leaf_randomness].unwrap()); // println!(); // println!("////////////////////////////////////////////////////"); // } diff --git a/synthesizer/Cargo.toml b/synthesizer/Cargo.toml index 909f4f7f88..383975948c 100644 --- a/synthesizer/Cargo.toml +++ b/synthesizer/Cargo.toml @@ -18,18 +18,18 @@ license = "GPL-3.0" edition = "2018" [dependencies.snarkvm-curves] -version = "0.6.0" +version = "0.7.4" default-features = false [dependencies.snarkvm-fields] -version = "0.6.0" +version = "0.7.4" default-features = false [dependencies.snarkvm-gadgets] -version = "0.6.0" +version = "0.7.4" [dependencies.snarkvm-r1cs] -version = "0.6.0" +version = "0.7.4" default-features = false [dependencies.num-bigint] diff --git a/synthesizer/src/circuit_synthesizer.rs b/synthesizer/src/circuit_synthesizer.rs index 2433869d30..44443491ee 100644 --- a/synthesizer/src/circuit_synthesizer.rs +++ b/synthesizer/src/circuit_synthesizer.rs @@ -155,6 +155,10 @@ impl ConstraintSystem for CircuitSynthesizer { fn num_private_variables(&self) -> usize { self.private_variables.len() } + + fn is_in_setup_mode(&self) -> bool { + true + } } fn push_constraints(l: LinearCombination, constraint: &mut Vec<(F, Index)>) { diff --git a/synthesizer/src/serialized_field.rs b/synthesizer/src/serialized_field.rs index acb25e0ce2..78d0f13d13 100644 --- a/synthesizer/src/serialized_field.rs +++ b/synthesizer/src/serialized_field.rs @@ -29,7 +29,7 @@ impl From<&F> for SerializedField { let mut buf = Vec::new(); - field.write(&mut buf).unwrap(); + field.write_le(&mut buf).unwrap(); // convert to base 10 integer From 97c5dd12f4404c06f23d99b14e7b1f5820f5c280 Mon Sep 17 00:00:00 2001 From: howardwu Date: Sat, 17 Jul 2021 00:47:31 -0700 Subject: [PATCH 3/5] Update CI to Rust 1.53 --- .circleci/config.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 602894ba20..fcb2246a7b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -44,7 +44,7 @@ jobs: rust-stable: docker: - - image: cimg/rust:1.52.1 + - image: cimg/rust:1.53 resource_class: xlarge steps: - checkout @@ -77,7 +77,7 @@ jobs: leo-executable: docker: - - image: cimg/rust:1.52.1 + - image: cimg/rust:1.53 resource_class: xlarge steps: - checkout @@ -95,7 +95,7 @@ jobs: leo-new: docker: - - image: cimg/rust:1.52.1 + - image: cimg/rust:1.53 resource_class: xlarge steps: - attach_workspace: @@ -108,7 +108,7 @@ jobs: leo-init: docker: - - image: cimg/rust:1.52.1 + - image: cimg/rust:1.53 resource_class: xlarge steps: - attach_workspace: @@ -121,7 +121,7 @@ jobs: leo-clean: docker: - - image: cimg/rust:1.52.1 + - image: cimg/rust:1.53 resource_class: xlarge steps: - attach_workspace: @@ -134,7 +134,7 @@ jobs: leo-setup: docker: - - image: cimg/rust:1.52.1 + - image: cimg/rust:1.53 resource_class: xlarge steps: - attach_workspace: @@ -147,7 +147,7 @@ jobs: leo-add-remove: docker: - - image: cimg/rust:1.52.1 + - image: cimg/rust:1.53 resource_class: xlarge steps: - attach_workspace: @@ -160,7 +160,7 @@ jobs: leo-check-constraints: docker: - - image: cimg/rust:1.50.0 + - image: cimg/rust:1.53 resource_class: xlarge steps: - attach_workspace: @@ -173,7 +173,7 @@ jobs: leo-login-logout: docker: - - image: cimg/rust:1.52.1 + - image: cimg/rust:1.53 resource_class: xlarge steps: - attach_workspace: @@ -186,7 +186,7 @@ jobs: leo-clone: docker: - - image: cimg/rust:1.52.1 + - image: cimg/rust:1.53 resource_class: xlarge steps: - attach_workspace: @@ -199,7 +199,7 @@ jobs: leo-publish: docker: - - image: cimg/rust:1.52.1 + - image: cimg/rust:1.53 resource_class: xlarge steps: - attach_workspace: From 9b5a36c59aa8d308d53ed658655cdb9e49c39f19 Mon Sep 17 00:00:00 2001 From: Weikeng Chen Date: Sat, 17 Jul 2021 01:09:21 -0700 Subject: [PATCH 4/5] Update circuit_synthesizer.rs --- synthesizer/src/circuit_synthesizer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synthesizer/src/circuit_synthesizer.rs b/synthesizer/src/circuit_synthesizer.rs index 44443491ee..480a7284c4 100644 --- a/synthesizer/src/circuit_synthesizer.rs +++ b/synthesizer/src/circuit_synthesizer.rs @@ -157,7 +157,7 @@ impl ConstraintSystem for CircuitSynthesizer { } fn is_in_setup_mode(&self) -> bool { - true + false } } From fef7fe6c90c77fd6851c3b6ffad639ccb0129aa8 Mon Sep 17 00:00:00 2001 From: weikeng Date: Sat, 17 Jul 2021 01:55:11 -0700 Subject: [PATCH 5/5] update the test as well as ci --- .circleci/config.yml | 16 ---------------- .../compiler/compiler/integers/i128/div.leo.out | 10 +++++----- .../compiler/compiler/integers/i16/div.leo.out | 10 +++++----- .../compiler/compiler/integers/i32/div.leo.out | 10 +++++----- .../compiler/compiler/integers/i64/div.leo.out | 10 +++++----- .../compiler/compiler/integers/i8/div.leo.out | 10 +++++----- .../compiler/compiler/integers/u128/div.leo.out | 10 +++++----- .../compiler/compiler/integers/u16/div.leo.out | 10 +++++----- .../compiler/compiler/integers/u32/div.leo.out | 10 +++++----- .../compiler/compiler/integers/u64/div.leo.out | 10 +++++----- .../compiler/compiler/integers/u8/div.leo.out | 10 +++++----- .../compiler/mutability/let_mut_nested.leo.out | 10 +++++----- 12 files changed, 55 insertions(+), 71 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fcb2246a7b..3582b41796 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -60,21 +60,6 @@ jobs: - clear_environment: cache_key: leo-stable-cache - rust-nightly: - docker: - - image: howardwu/snarkos-ci:2021-03-25 - resource_class: xlarge - steps: - - checkout - - setup_environment: - cache_key: leo-nightly-cache - - run: - name: Build and test - no_output_timeout: 30m - command: cargo test --all - - clear_environment: - cache_key: leo-nightly-cache - leo-executable: docker: - image: cimg/rust:1.53 @@ -215,7 +200,6 @@ workflows: main-workflow: jobs: - rust-stable - - rust-nightly - leo-executable - leo-new: requires: diff --git a/tests/expectations/compiler/compiler/integers/i128/div.leo.out b/tests/expectations/compiler/compiler/integers/i128/div.leo.out index ee1d268947..8938726b96 100644 --- a/tests/expectations/compiler/compiler/integers/i128/div.leo.out +++ b/tests/expectations/compiler/compiler/integers/i128/div.leo.out @@ -4,11 +4,11 @@ expectation: Pass outputs: - circuit: num_public_variables: 0 - num_private_variables: 506500 - num_constraints: 556546 - at: 168dc7e5a5c91155b81d611ec03fe223c562493918fb29fc46ce84cb1f54b7f5 - bt: b9699f707750827fa2663e2e2c6ef82c786ed4c74556e3bed076d78eb1a896b1 - ct: ee951676608c1176ff532d3d37c5827e2180105104289b2b1b273333677227cc + num_private_variables: 264820 + num_constraints: 330868 + at: 90e89968758ed4552073b4217621741d7471a683f004aff63679ee176690ebb4 + bt: a83224709a5d2ea9ba982fd81f35188e299590ab7ce201773857c54a39b27d93 + ct: 26d5f56acb9effc130128af10b00b426d2396e7d8962636268b3dd08ba8df5e3 output: - input_file: i128.in output: diff --git a/tests/expectations/compiler/compiler/integers/i16/div.leo.out b/tests/expectations/compiler/compiler/integers/i16/div.leo.out index 1a096c95e5..0adf8013cc 100644 --- a/tests/expectations/compiler/compiler/integers/i16/div.leo.out +++ b/tests/expectations/compiler/compiler/integers/i16/div.leo.out @@ -4,11 +4,11 @@ expectation: Pass outputs: - circuit: num_public_variables: 0 - num_private_variables: 7764 - num_constraints: 8642 - at: 021e947acc78bbd99baa676d90f79998564e19d2b0478fb1e2e7946189d94bc2 - bt: eadd8a53b4c1d8efbd2015f9e358120b022061fc46b548fdab054b5a75a79757 - ct: 496912e80f22b87bffa4fcb70059f09f267d5edf5f85e42030b7bd3d65bc57d3 + num_private_variables: 4358 + num_constraints: 5446 + at: 285c49252166e044a1648d7cdeaa3975efca0e746efd365d2f170900157df8b9 + bt: b7dcf6f446108df31801263f54f0d504800d85f341baa945f13eb2dbbbbe4851 + ct: 6743f276428e33d909885898f76d747836254decaf153021c75df8d62b890e41 output: - input_file: i16.in output: diff --git a/tests/expectations/compiler/compiler/integers/i32/div.leo.out b/tests/expectations/compiler/compiler/integers/i32/div.leo.out index afdd87dd91..153d3f936a 100644 --- a/tests/expectations/compiler/compiler/integers/i32/div.leo.out +++ b/tests/expectations/compiler/compiler/integers/i32/div.leo.out @@ -4,11 +4,11 @@ expectation: Pass outputs: - circuit: num_public_variables: 0 - num_private_variables: 31396 - num_constraints: 34690 - at: c916998b93bc4ded6f989fe837aa04d3a2ea3c46c26bba70514d346ddf13f7dc - bt: 2b765f5660bc847af13d6361ed89fbc296cfa094fd80972604f1745259c14289 - ct: 3054de0adc6f09929e39a097dc66d9dace247ff1481254154c31e5416d6b82e7 + num_private_variables: 16918 + num_constraints: 21142 + at: a8ca22c0da8166ef4f88e959be315231681516ee6113dff620637774f8e4a670 + bt: e09097be6926888dddac4cd61c1b3419e05b5b700ba3acca116f6eb2c01cb0a4 + ct: 13922ea4b7763c9228f5dfedfb0d8e2f7d5a3bbed934cd6df5ae99f4150222d2 output: - input_file: i32.in output: diff --git a/tests/expectations/compiler/compiler/integers/i64/div.leo.out b/tests/expectations/compiler/compiler/integers/i64/div.leo.out index f19f052911..bbd47b9f3e 100644 --- a/tests/expectations/compiler/compiler/integers/i64/div.leo.out +++ b/tests/expectations/compiler/compiler/integers/i64/div.leo.out @@ -4,11 +4,11 @@ expectation: Pass outputs: - circuit: num_public_variables: 0 - num_private_variables: 126276 - num_constraints: 139010 - at: 5569763c96399af86cb10f3f5658e82c52594a8b4bd085542d92a6090db5f83f - bt: 2a2b1dfbe635b61460fcba331f7383edd70f065881804500e5c4068771b1b040 - ct: 4dab363af1609fb733af59eb97aed35a67429bfa2cdd45c8c2bc8fcfa1ae6268 + num_private_variables: 66614 + num_constraints: 83254 + at: 329edae9756f7bd721526c1b0790df530231fd3294f92161fb6c6b92036f03cd + bt: 81f681cc8f8cfc15fbecf76405b9a65ee9bf78492f8c012067a6a3db6efd466a + ct: 308cc563c21dc87ce980daf26ae9f4716b2e9f26517940e244ce3d98f488d280 output: - input_file: i64.in output: diff --git a/tests/expectations/compiler/compiler/integers/i8/div.leo.out b/tests/expectations/compiler/compiler/integers/i8/div.leo.out index ba8146ea8c..f8f355396e 100644 --- a/tests/expectations/compiler/compiler/integers/i8/div.leo.out +++ b/tests/expectations/compiler/compiler/integers/i8/div.leo.out @@ -4,11 +4,11 @@ expectation: Pass outputs: - circuit: num_public_variables: 0 - num_private_variables: 1900 - num_constraints: 2146 - at: 78254e9ffa335030ec73b144fe62ec20ae56e25f40dda07a761f8dae73d4a5ec - bt: b857cea12f4b3716495ef7dffecf8cc30b26e4f560fa0464c4a04df43a1f18ef - ct: b45ff088d9439c294745b670408d93a081733efdff5b80d9369e287974cd22b8 + num_private_variables: 1150 + num_constraints: 1438 + at: ea4e10bc92af056bb4b3797063565094853fe4ba595f03fd6d4a8a0fc30ca195 + bt: a41852ab8ac16bc91220ddd5b2fd1dacf3bebb624715cf2c3dc53f5dd172da9b + ct: 0449683ea39f4822da71f08082f051f005ecf6b846ab99e48c6ab9ac5aaa75be output: - input_file: i8.in output: diff --git a/tests/expectations/compiler/compiler/integers/u128/div.leo.out b/tests/expectations/compiler/compiler/integers/u128/div.leo.out index 6ad0455f03..60336be5ff 100644 --- a/tests/expectations/compiler/compiler/integers/u128/div.leo.out +++ b/tests/expectations/compiler/compiler/integers/u128/div.leo.out @@ -4,11 +4,11 @@ expectation: Pass outputs: - circuit: num_public_variables: 0 - num_private_variables: 50562 - num_constraints: 50946 - at: 70bbe9c287066bbab7efc8c955d61d85862da186d3a0fe741fb3c7af670521f6 - bt: 5f17f32257e466ef51120fe4cb2d1d2039bcf5bf39c3c477ec09c966419719c9 - ct: d4285993ccb479eefff4da2590ce08924fe8d1750c916a794036f8131d1d720e + num_private_variables: 263418 + num_constraints: 329465 + at: 7f9291f6c2c9d381cb6d96c1b958eb025a7fa82d19065612225198341d8ed37d + bt: e26d177238ab12a9e8091dfb18f68e0e82d410b1ebce7c8633bd0a4973f5db2f + ct: f36c23bcc522e47f2efe7c42ec8f9bccfb980c46c71d03f69222eb87a3aa6dd5 output: - input_file: u128.in output: diff --git a/tests/expectations/compiler/compiler/integers/u16/div.leo.out b/tests/expectations/compiler/compiler/integers/u16/div.leo.out index d90e60bfca..a4a23eba83 100644 --- a/tests/expectations/compiler/compiler/integers/u16/div.leo.out +++ b/tests/expectations/compiler/compiler/integers/u16/div.leo.out @@ -4,11 +4,11 @@ expectation: Pass outputs: - circuit: num_public_variables: 0 - num_private_variables: 913 - num_constraints: 961 - at: d047f1835e03694527f9382bab398f5e463fdde613b59b26f060fd2a0e8e65d6 - bt: 9a48749a964cf80e8bacc149bcdc3524853fb3517f848522553e7da6e273f715 - ct: 82ac3f91dba2daec2992e4aaea085ff388f59e0e26330488e1dd2be11d79308d + num_private_variables: 4188 + num_constraints: 5275 + at: f1b7abc9150b53dfc10ee7e67e8c985a07f4e0169cd1e8ed234c67c14019f669 + bt: ce2d469f0b5ace885987081e8dca6a93f663d3f90317850debc36b4fa3ebed96 + ct: 5ecb4125316e7086ed355d51b635965c19ce3f234575dd3e521c187714c00dda output: - input_file: u16.in output: diff --git a/tests/expectations/compiler/compiler/integers/u32/div.leo.out b/tests/expectations/compiler/compiler/integers/u32/div.leo.out index f094dd40c7..1f59de387e 100644 --- a/tests/expectations/compiler/compiler/integers/u32/div.leo.out +++ b/tests/expectations/compiler/compiler/integers/u32/div.leo.out @@ -4,11 +4,11 @@ expectation: Pass outputs: - circuit: num_public_variables: 0 - num_private_variables: 3361 - num_constraints: 3457 - at: b4586913c6db620e8148b90ba3be229f924a47980b735a0c4e2cece8f1334761 - bt: 4984a34e571417eb6ce209b1542beefad525200e782ec88e6f5c58c440402f33 - ct: a0b70b0006b80beff40b0f991739c129cdf3a759c4d7c85c274f59ad62e103d5 + num_private_variables: 16572 + num_constraints: 20795 + at: 4f6450d5e7991f179adb08e1b026e453c4c6abd66f38ea4a175a888b3c1bdbf1 + bt: 3f6fd055b4a8dacc1138d93848e7ea7424a5bc64af98ad3ee1e6e5ff4719e3c3 + ct: a5941a2d70ce52e20004890f9a7198b0f22c93803e9d159824e716ff2ed2d223 output: - input_file: u32.in output: diff --git a/tests/expectations/compiler/compiler/integers/u64/div.leo.out b/tests/expectations/compiler/compiler/integers/u64/div.leo.out index 666d307e42..6f41082712 100644 --- a/tests/expectations/compiler/compiler/integers/u64/div.leo.out +++ b/tests/expectations/compiler/compiler/integers/u64/div.leo.out @@ -4,11 +4,11 @@ expectation: Pass outputs: - circuit: num_public_variables: 0 - num_private_variables: 12865 - num_constraints: 13057 - at: 9d9258e2128a7d269df73826378edef9d92a54ddce7a119886b62b30792c6682 - bt: 37b9014d1049204c4dcc70c10ddba1f7cf576ac366850b6a839896ca106b5e45 - ct: 96c178c46c3d65d0d19f71fede0add7de947179c34ad70565bf34b80ca88fa4a + num_private_variables: 65916 + num_constraints: 82555 + at: 071831a1f073f5ba74377785488634267645562682b9dbeaafd1f65e39bf17d3 + bt: bcde87dd40262305d4c32a5949fa939d1b83f6ae51143eba7c147eab61314987 + ct: 7c81f1ec1d5e9746863df8f4128342df3b6ad3abe2397c2274a0c3fc45750094 output: - input_file: u64.in output: diff --git a/tests/expectations/compiler/compiler/integers/u8/div.leo.out b/tests/expectations/compiler/compiler/integers/u8/div.leo.out index 1497ad09b0..c94069a60e 100644 --- a/tests/expectations/compiler/compiler/integers/u8/div.leo.out +++ b/tests/expectations/compiler/compiler/integers/u8/div.leo.out @@ -4,11 +4,11 @@ expectation: Pass outputs: - circuit: num_public_variables: 0 - num_private_variables: 265 - num_constraints: 289 - at: 0dc1e93afeaa315465d5b3b595255d51ec60c250628f6240753c8108ab9e8053 - bt: 781b0b03c0008f52efceb5be0abe02d4ac135ac1df6cda486eb941e9e6df53f5 - ct: c137ae93c16c69c41bc1758702a1b64e14ed572dab2f1461552c328dfb4b173a + num_private_variables: 1068 + num_constraints: 1355 + at: 8ed58147507a99812dafb5a57a6c403d92d4454ea232cc7ee8b7f387a1435aa4 + bt: 9e0ee614664ff1c133eff0a1bdb47f8521967aacb928ff34195d0639aec895d6 + ct: 0b81ff43876b3dbc83461a76cfd1c6ff5513f2a5597441d526a472bd74b66ad1 output: - input_file: u8.in output: diff --git a/tests/expectations/compiler/compiler/mutability/let_mut_nested.leo.out b/tests/expectations/compiler/compiler/mutability/let_mut_nested.leo.out index 13998e432d..b9b6741851 100644 --- a/tests/expectations/compiler/compiler/mutability/let_mut_nested.leo.out +++ b/tests/expectations/compiler/compiler/mutability/let_mut_nested.leo.out @@ -4,11 +4,11 @@ expectation: Pass outputs: - circuit: num_public_variables: 0 - num_private_variables: 18 - num_constraints: 18 - at: 0af86ba5c2862fbd3f6877188bf7b64b0e1c943322d72aa1eeff86e3d4782a66 - bt: 337d485395ace679b31230eee59c92054ba721ca86d569123ddd4625d611b595 - ct: 6c0e1fd41ec8a0fa1ac6c5c845ac3158b5a6846d089b98fab88b4d9b9e41f6a8 + num_private_variables: 1 + num_constraints: 1 + at: 042610d0fd1fe6d6ac112138f8755752f44c7d2a00f1b5960574d6da5cda393f + bt: e97756698880ab7555a959a5fb5c6b4e15bd64612aa677adbfe2d0bd91f0a83c + ct: cf1cbb66a638b4860a516671fb74850e6ccf787fe6c4c8d29e9c04efe880bd05 output: - input_file: input/dummy.in output: