merge master and fix build issues

This commit is contained in:
collin 2021-03-04 14:11:17 -08:00
commit 10ecc6e6e2
143 changed files with 1000 additions and 839 deletions

201
Cargo.lock generated
View File

@ -186,7 +186,7 @@ dependencies = [
"block-padding",
"byte-tools",
"byteorder",
"generic-array 0.12.3",
"generic-array 0.12.4",
]
[[package]]
@ -575,7 +575,7 @@ version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5"
dependencies = [
"generic-array 0.12.3",
"generic-array 0.12.4",
]
[[package]]
@ -844,9 +844,9 @@ dependencies = [
[[package]]
name = "generic-array"
version = "0.12.3"
version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec"
checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd"
dependencies = [
"typenum",
]
@ -955,9 +955,9 @@ dependencies = [
[[package]]
name = "hex"
version = "0.4.2"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]]
name = "http"
@ -1242,10 +1242,9 @@ dependencies = [
"snarkvm-algorithms",
"snarkvm-curves",
"snarkvm-dpc",
"snarkvm-errors",
"snarkvm-fields",
"snarkvm-gadgets",
"snarkvm-models",
"snarkvm-objects",
"snarkvm-r1cs",
"snarkvm-utilities",
"thiserror",
"tracing",
@ -1259,8 +1258,9 @@ dependencies = [
"rand",
"rand_core",
"rand_xorshift",
"snarkvm-errors",
"snarkvm-models",
"snarkvm-fields",
"snarkvm-gadgets",
"snarkvm-r1cs",
"snarkvm-utilities",
"thiserror",
]
@ -1318,9 +1318,8 @@ dependencies = [
"serde_json",
"snarkvm-algorithms",
"snarkvm-curves",
"snarkvm-errors",
"snarkvm-gadgets",
"snarkvm-models",
"snarkvm-r1cs",
"snarkvm-utilities",
"structopt",
"thiserror",
@ -1374,9 +1373,6 @@ dependencies = [
"snarkvm-algorithms",
"snarkvm-curves",
"snarkvm-dpc",
"snarkvm-errors",
"snarkvm-models",
"snarkvm-objects",
"snarkvm-storage",
"snarkvm-utilities",
"thiserror",
@ -1390,15 +1386,16 @@ dependencies = [
"serde",
"serde_json",
"snarkvm-curves",
"snarkvm-errors",
"snarkvm-models",
"snarkvm-fields",
"snarkvm-gadgets",
"snarkvm-r1cs",
]
[[package]]
name = "libc"
version = "0.2.86"
version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7282d924be3275cec7f6756ff4121987bc6481325397dde6ba3e7802b1a8b1c"
checksum = "265d751d31d6780a3f956bb5b8022feba2d94eeee5a84ba64f4212eedca42213"
[[package]]
name = "libloading"
@ -1715,9 +1712,9 @@ checksum = "a9a7ab5d64814df0fe4a4b5ead45ed6c5f181ee3ff04ba344313a6c80446c5d4"
[[package]]
name = "once_cell"
version = "1.7.0"
version = "1.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10acf907b94fc1b1a152d08ef97e7759650268cf986bf127f387e602b02c7e5a"
checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3"
[[package]]
name = "oorandom"
@ -1885,9 +1882,9 @@ dependencies = [
[[package]]
name = "pin-project-lite"
version = "0.2.4"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "439697af366c49a6d0a010c56a0d97685bc140ce0d377b13a2ea2aa42d64a827"
checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905"
[[package]]
name = "pin-utils"
@ -2393,9 +2390,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.63"
version = "1.0.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43535db9747a4ba938c0ce0a98cc631a46ebf943c9e1d604e091df6007620bf6"
checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79"
dependencies = [
"itoa",
"ryu",
@ -2477,9 +2474,9 @@ checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
[[package]]
name = "snarkvm-algorithms"
version = "0.0.6"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d3de956d0221ff897ebcc2a36e8a88482dee06acaebce67f7819c41be843a11"
checksum = "fbb6ec1d5757858ec54ccbb211c7366e601cb495e4d6c3f1a6dd16507834f2b0"
dependencies = [
"blake2",
"derivative",
@ -2490,33 +2487,35 @@ dependencies = [
"rayon",
"sha2",
"smallvec",
"snarkvm-errors",
"snarkvm-models",
"snarkvm-curves",
"snarkvm-fields",
"snarkvm-profiler",
"snarkvm-r1cs",
"snarkvm-utilities",
"thiserror",
]
[[package]]
name = "snarkvm-curves"
version = "0.0.6"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd45a9c60e9c81bbfc4568f8c7d4c3fd0b6dc7b75916086eb16795fc3ea854b2"
checksum = "fb783fb37b05716640c50fbc180758dd999e34837767dbe6170a961e89ae0098"
dependencies = [
"derivative",
"rand",
"rand_xorshift",
"rustc_version 0.3.3",
"serde",
"snarkvm-errors",
"snarkvm-models",
"snarkvm-fields",
"snarkvm-utilities",
"thiserror",
]
[[package]]
name = "snarkvm-derives"
version = "0.0.6"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b3339f816745870549adbcf7f5b1db3441c8d73377278fec9c7829a87ebdc07"
checksum = "f5055a2424bfceca62bee32ec1d7ce86149c7daf880dbc71eb0b6001ab20043f"
dependencies = [
"proc-macro-crate",
"proc-macro-error",
@ -2527,11 +2526,13 @@ dependencies = [
[[package]]
name = "snarkvm-dpc"
version = "0.0.6"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9d43c0c63eedf067284496e068527f2448ea3ecba1ba9c44d486c3fb66e04e2"
checksum = "e9837ffa247354b6e3590e5482e3e109afb70e6af9953b475cd1ccdcd0ca40e2"
dependencies = [
"anyhow",
"base58",
"bech32",
"blake2",
"derivative",
"hex",
@ -2539,75 +2540,56 @@ dependencies = [
"rand",
"snarkvm-algorithms",
"snarkvm-curves",
"snarkvm-errors",
"snarkvm-fields",
"snarkvm-gadgets",
"snarkvm-models",
"snarkvm-objects",
"snarkvm-parameters",
"snarkvm-profiler",
"snarkvm-r1cs",
"snarkvm-utilities",
"thiserror",
]
[[package]]
name = "snarkvm-errors"
version = "0.0.6"
name = "snarkvm-fields"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce13866aa05abf33972261ab9803b2f223bd5bee9e5336aac0618c2aa8249f24"
checksum = "4d23901c74a59ddee3792f00a1bbc7846f35900f087f0cb0731a42d7a8601f71"
dependencies = [
"base58",
"bech32",
"bincode",
"curl",
"hex",
"derivative",
"rand",
"rand_xorshift",
"serde",
"snarkvm-utilities",
"thiserror",
]
[[package]]
name = "snarkvm-gadgets"
version = "0.0.6"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5f6de0307dba124bf510fdf52b870a9ba76ad3177b2b742f91c87ee39a038d8"
checksum = "03e586f5528c542e8ccc0d9036667f00956dcd03433ed35953ff345db18854ea"
dependencies = [
"derivative",
"digest 0.9.0",
"itertools 0.10.0",
"snarkvm-algorithms",
"snarkvm-curves",
"snarkvm-errors",
"snarkvm-models",
"snarkvm-utilities",
]
[[package]]
name = "snarkvm-models"
version = "0.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21afc37b95e310387d9a7ea25e439c7e5f444896a760e5f3893d4e6ef387d48c"
dependencies = [
"anyhow",
"bincode",
"cfg-if 1.0.0",
"derivative",
"fxhash",
"indexmap",
"itertools 0.10.0",
"rand",
"rand_xorshift",
"serde",
"snarkvm-errors",
"snarkvm-fields",
"snarkvm-r1cs",
"snarkvm-utilities",
"thiserror",
]
[[package]]
name = "snarkvm-objects"
version = "0.0.6"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "724332214a919a1c14f07c458c191319101cc3252319cf2f9e8f122fd2a5f5d5"
checksum = "58db14d80c9d5496badf4c0aec9c75e7c40dbcdd50480b924968c36a4211b4d5"
dependencies = [
"base58",
"bech32",
"anyhow",
"chrono",
"derivative",
"hex",
"once_cell",
"rand",
@ -2615,53 +2597,49 @@ dependencies = [
"sha2",
"snarkvm-algorithms",
"snarkvm-curves",
"snarkvm-errors",
"snarkvm-models",
"snarkvm-utilities",
"thiserror",
]
[[package]]
name = "snarkvm-parameters"
version = "0.0.6"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e69a1db7cba8b07538943c0a9c547f515a4d726d8863dc1d40c5f9266a8af27"
checksum = "0ef0c06581616f1f7d8f993c8ab89f6f804bd2e2712b3db03f791edbfad340c8"
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",
"thiserror",
]
[[package]]
name = "snarkvm-profiler"
version = "0.0.6"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37ce2100d7198526f11290d70d83a1bb6a1dd578f43821ceb544421ebd398312"
checksum = "cf2fd43f8abfc3e87f03fd13ea260d14133f4716fa99eaf1578799ae85676530"
[[package]]
name = "snarkvm-r1cs"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f34179150793df4add4c8ee67929ea7a3606c272b4849d9cfc4df2779a49ac58"
dependencies = [
"cfg-if 1.0.0",
"fxhash",
"indexmap",
"itertools 0.10.0",
"snarkvm-curves",
"snarkvm-fields",
"snarkvm-utilities",
]
[[package]]
name = "snarkvm-storage"
version = "0.0.6"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b57ef27e6b3073f4681332ac018158cea1f28c8a14e2187085e2c656f1641550"
checksum = "6b5602ba49e2cb2726931262e961a38a95955aa3bf1881c9e84b62f8176b3079"
dependencies = [
"anyhow",
"bincode",
@ -2671,8 +2649,7 @@ dependencies = [
"rocksdb",
"serde",
"snarkvm-algorithms",
"snarkvm-errors",
"snarkvm-models",
"snarkvm-dpc",
"snarkvm-objects",
"snarkvm-parameters",
"snarkvm-utilities",
@ -2681,14 +2658,14 @@ dependencies = [
[[package]]
name = "snarkvm-utilities"
version = "0.0.6"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "272b8758ef7fed8dc70cc01ecfd13e9add23edbabcaae1c5c7cfaca54d0fcae5"
checksum = "307edca1c7fe02a498933808b70feb73ae5d60f8dad2e9ecba3f9cd65569d6a4"
dependencies = [
"bincode",
"rand",
"snarkvm-derives",
"snarkvm-errors",
"thiserror",
]
[[package]]
@ -2855,9 +2832,9 @@ dependencies = [
[[package]]
name = "tinytemplate"
version = "1.2.0"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2ada8616fad06a2d0c455adc530de4ef57605a8120cc65da9653e0e9623ca74"
checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc"
dependencies = [
"serde",
"serde_json",
@ -3302,9 +3279,9 @@ dependencies = [
[[package]]
name = "zip"
version = "0.5.10"
version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a8977234acab718eb2820494b2f96cbb16004c19dddf88b7445b27381450997"
checksum = "8264fcea9b7a036a4a5103d7153e988dbc2ebbafb34f68a3c2d404b6b82d74b6"
dependencies = [
"byteorder",
"bzip2",

View File

@ -72,27 +72,23 @@ path = "./synthesizer"
version = "1.2.3"
[dependencies.snarkvm-algorithms]
version = "0.0.6"
default-features = false
version = "0.2.0"
#default-features = false
[dependencies.snarkvm-curves]
version = "0.0.6"
default-features = false
[dependencies.snarkvm-errors]
version = "0.0.6"
version = "0.2.0"
default-features = false
[dependencies.snarkvm-gadgets]
version = "0.0.6"
version = "0.2.0"
default-features = false
[dependencies.snarkvm-models]
version = "0.0.6"
[dependencies.snarkvm-r1cs]
version = "0.2.0"
default-features = false
[dependencies.snarkvm-utilities]
version = "0.0.6"
version = "0.2.0"
[dependencies.anyhow]
version = "1.0"

View File

@ -16,7 +16,7 @@
use leo_asg::*;
use leo_ast::Ast;
use leo_grammar::Grammar;
use leo_parser::parse_ast;
use std::path::Path;
@ -35,7 +35,7 @@ fn load_asg_imports<'a, T: ImportResolver<'a>>(
program_string: &str,
imports: &mut T,
) -> Result<Program<'a>, AsgConvertError> {
let grammar = Grammar::new(Path::new(&TESTING_FILEPATH), program_string)?;
// let grammar = Grammar::new(Path::new(&TESTING_FILEPATH), program_string)?;
let ast = Ast::new(TESTING_PROGRAM_NAME, &grammar)?;
InternalProgram::new(context, &ast.as_repr(), imports)
}

View File

@ -19,7 +19,10 @@ use leo_input::common::Identifier as InputIdentifier;
use crate::Node;
use serde::{
de::{self, Visitor},
de::{
Visitor,
{self},
},
Deserialize,
Deserializer,
Serialize,

View File

@ -70,7 +70,7 @@ pub struct Ast {
}
impl Ast {
/// Creates a new AST from a given program name and grammar tree.
/// Creates a new AST from a given program tree.
pub fn new(program: Program) -> Self {
Self { ast: program }
}

View File

@ -50,31 +50,27 @@ path = "../parser"
version = "1.2.3"
[dependencies.snarkvm-curves]
version = "0.0.6"
version = "0.2.0"
default-features = false
[dependencies.snarkvm-fields]
version = "0.2.0"
default-features = false
[dependencies.snarkvm-dpc]
version = "0.0.6"
default-features = false
[dependencies.snarkvm-errors]
version = "0.0.6"
version = "0.2.0"
default-features = false
[dependencies.snarkvm-gadgets]
version = "0.0.6"
version = "0.2.0"
default-features = false
[dependencies.snarkvm-models]
version = "0.0.6"
default-features = false
[dependencies.snarkvm-objects]
version = "0.0.6"
[dependencies.snarkvm-r1cs]
version = "0.2.0"
default-features = false
[dependencies.snarkvm-utilities]
version = "0.0.6"
version = "0.2.0"
[dependencies.bincode]
version = "1.3"
@ -115,7 +111,7 @@ version = "0.3"
default-features = false
[dev-dependencies.snarkvm-algorithms]
version = "0.0.6"
version = "0.2.0"
default-features = false
[features]

View File

@ -25,17 +25,16 @@ use crate::{
};
use indexmap::IndexMap;
use leo_asg::Asg;
pub use leo_asg::{new_context, AsgContext as Context, AsgContext};
use leo_ast::{Input, LeoError, MainInput, Program};
use leo_input::LeoInputParser;
use leo_package::inputs::InputPairs;
use leo_parser::parse_ast;
use leo_state::verify_local_data_commitment;
use snarkvm_dpc::{base_dpc::instantiated::Components, SystemParameters};
use snarkvm_errors::gadgets::SynthesisError;
use snarkvm_models::{
curves::PrimeField,
gadgets::r1cs::{ConstraintSynthesizer, ConstraintSystem},
};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::{ConstraintSynthesizer, ConstraintSystem, SynthesisError};
use sha2::{Digest, Sha256};
use std::{
@ -46,8 +45,6 @@ use std::{
rc::Rc,
};
pub use leo_asg::{new_context, AsgContext as Context, AsgContext};
thread_local! {
static THREAD_GLOBAL_CONTEXT: AsgContext<'static> = {
let leaked = Box::leak(Box::new(leo_asg::new_alloc_context()));
@ -55,7 +52,7 @@ thread_local! {
}
}
/// Conventience function to return a leaked thread-local global context. Should only be used for transient programs (like cli).
/// Convenience function to return a leaked thread-local global context. Should only be used for transient programs (like cli).
pub fn thread_leaked_context() -> AsgContext<'static> {
THREAD_GLOBAL_CONTEXT.with(|f| *f)
}
@ -235,7 +232,7 @@ impl<'a, F: PrimeField, G: GroupType<F>> Compiler<'a, F, G> {
Rc::new(lines),
);
let ast = leo_parser::parse_ast(self.main_file_path.to_str().unwrap_or_default(), program_string)?;
let ast = parse_ast(self.main_file_path.to_str().unwrap_or_default(), program_string)?;
// Store the main program file.
self.program = ast.into_repr();

View File

@ -25,10 +25,9 @@ use crate::{
};
use leo_asg::{Expression, Span};
use snarkvm_models::{
curves::PrimeField,
gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean},
};
use snarkvm_fields::PrimeField;
use snarkvm_gadgets::traits::utilities::boolean::Boolean;
use snarkvm_r1cs::ConstraintSystem;
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
pub fn evaluate_console_assert<CS: ConstraintSystem<F>>(

View File

@ -19,10 +19,9 @@
use crate::{errors::ConsoleError, program::ConstrainedProgram, statement::get_indicator_value, GroupType};
use leo_asg::{ConsoleFunction, ConsoleStatement};
use snarkvm_models::{
curves::PrimeField,
gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean},
};
use snarkvm_fields::PrimeField;
use snarkvm_gadgets::traits::utilities::boolean::Boolean;
use snarkvm_r1cs::ConstraintSystem;
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
pub fn evaluate_console_function_call<CS: ConstraintSystem<F>>(

View File

@ -18,9 +18,9 @@
use crate::{errors::ConsoleError, program::ConstrainedProgram, GroupType};
use leo_asg::FormattedString;
use leo_ast::FormattedStringPart;
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
pub fn format<CS: ConstraintSystem<F>>(

View File

@ -22,10 +22,8 @@ use leo_ast::{Input, LeoError};
use leo_input::LeoInputParser;
use leo_package::inputs::InputPairs;
use snarkvm_models::{
curves::PrimeField,
gadgets::r1cs::{ConstraintSystem, TestConstraintSystem},
};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::{ConstraintSystem, TestConstraintSystem};
use std::path::Path;
pub fn generate_constraints<'a, F: PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>>(

View File

@ -19,7 +19,7 @@
use crate::{program::ConstrainedProgram, value::ConstrainedValue, GroupType};
use leo_asg::Variable;
use snarkvm_models::curves::PrimeField;
use snarkvm_fields::PrimeField;
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
pub fn store_definition(&mut self, variable: &Variable, value: ConstrainedValue<'a, F, G>) {

View File

@ -16,8 +16,7 @@
use crate::errors::{AddressError, BooleanError, FieldError, FunctionError, GroupError, IntegerError, ValueError};
use leo_ast::{ArrayDimensions, FormattedError, Identifier, LeoError, PositiveNumber, Span};
use snarkvm_errors::gadgets::SynthesisError;
use snarkvm_r1cs::SynthesisError;
#[derive(Debug, Error)]
pub enum ExpressionError {

View File

@ -15,8 +15,8 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use leo_ast::{FormattedError, LeoError, Span};
use snarkvm_errors::{gadgets::SynthesisError, objects::account::AccountError};
use snarkvm_dpc::AccountError;
use snarkvm_r1cs::SynthesisError;
#[derive(Debug, Error)]
pub enum AddressError {

View File

@ -15,8 +15,7 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use leo_ast::{FormattedError, LeoError, Span};
use snarkvm_errors::gadgets::SynthesisError;
use snarkvm_r1cs::SynthesisError;
#[derive(Debug, Error)]
pub enum BooleanError {

View File

@ -15,8 +15,7 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use leo_ast::{FormattedError, LeoError, Span};
use snarkvm_errors::gadgets::SynthesisError;
use snarkvm_r1cs::SynthesisError;
#[derive(Debug, Error)]
pub enum FieldError {

View File

@ -15,8 +15,7 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use leo_ast::{FormattedError, LeoError, Span};
use snarkvm_errors::gadgets::SynthesisError;
use snarkvm_r1cs::SynthesisError;
#[derive(Debug, Error)]
pub enum GroupError {

View File

@ -15,9 +15,8 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use leo_ast::{FormattedError, IntegerType, LeoError, Span, Type};
use leo_gadgets::errors::SignedIntegerError;
use snarkvm_errors::gadgets::SynthesisError;
use snarkvm_r1cs::SynthesisError;
#[derive(Debug, Error)]
pub enum IntegerError {

View File

@ -19,7 +19,8 @@
use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType};
use leo_ast::Span;
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
pub fn enforce_add<'a, F: PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>>(
cs: &mut CS,

View File

@ -19,7 +19,7 @@
use crate::{errors::IntegerError, value::ConstrainedValue, GroupType};
use leo_asg::Span;
use snarkvm_models::curves::PrimeField;
use snarkvm_fields::PrimeField;
pub fn evaluate_bit_not<'a, F: PrimeField, G: GroupType<F>>(
value: ConstrainedValue<'a, F, G>,

View File

@ -19,7 +19,8 @@
use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType};
use leo_ast::Span;
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
pub fn enforce_div<'a, F: PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>>(
cs: &mut CS,

View File

@ -19,7 +19,8 @@
use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType};
use leo_ast::Span;
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
pub fn enforce_mul<'a, F: PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>>(
cs: &mut CS,

View File

@ -19,7 +19,8 @@
use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType};
use leo_ast::Span;
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
pub fn enforce_negate<'a, F: PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>>(
cs: &mut CS,

View File

@ -19,7 +19,8 @@
use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType};
use leo_ast::Span;
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
pub fn enforce_pow<'a, F: PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>>(
cs: &mut CS,

View File

@ -19,7 +19,8 @@
use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType};
use leo_ast::Span;
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
pub fn enforce_sub<'a, F: PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>>(
cs: &mut CS,

View File

@ -19,7 +19,8 @@
use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
use leo_asg::{Expression, Span};
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
#[allow(clippy::too_many_arguments)]

View File

@ -21,7 +21,8 @@ use std::cell::Cell;
use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
use leo_asg::{Expression, Span};
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
/// Enforce array expressions

View File

@ -19,7 +19,8 @@
use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
use leo_asg::{Expression, Span};
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
pub(crate) fn enforce_index<CS: ConstraintSystem<F>>(

View File

@ -19,7 +19,8 @@
use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
use leo_asg::Expression;
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
type ConstrainedValuePair<'a, T, U> = (ConstrainedValue<'a, T, U>, ConstrainedValue<'a, T, U>);

View File

@ -19,7 +19,8 @@
use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
use leo_asg::{CircuitAccessExpression, Node};
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
#[allow(clippy::too_many_arguments)]

View File

@ -24,7 +24,8 @@ use crate::{
};
use leo_asg::{CircuitInitExpression, CircuitMember, Span};
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
pub fn enforce_circuit<CS: ConstraintSystem<F>>(

View File

@ -19,10 +19,9 @@
use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
use leo_asg::{Expression, Span};
use snarkvm_models::{
curves::PrimeField,
gadgets::{r1cs::ConstraintSystem, utilities::select::CondSelectGadget},
};
use snarkvm_fields::PrimeField;
use snarkvm_gadgets::traits::utilities::select::CondSelectGadget;
use snarkvm_r1cs::ConstraintSystem;
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
/// Enforce ternary conditional expression

View File

@ -29,10 +29,9 @@ use crate::{
};
use leo_asg::{expression::*, ConstValue, Expression, Node};
use snarkvm_models::{
curves::PrimeField,
gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean},
};
use snarkvm_fields::PrimeField;
use snarkvm_gadgets::traits::utilities::boolean::Boolean;
use snarkvm_r1cs::ConstraintSystem;
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
pub(crate) fn enforce_expression<CS: ConstraintSystem<F>>(

View File

@ -20,7 +20,8 @@ use crate::{program::ConstrainedProgram, value::ConstrainedValue, CoreCircuit, G
use crate::errors::ExpressionError;
use leo_asg::{Expression, Function, Span};
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
/// Call a default core circuit function with arguments

View File

@ -21,7 +21,8 @@ use std::cell::Cell;
use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
use leo_asg::{Expression, Function, Span};
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
#[allow(clippy::too_many_arguments)]

View File

@ -19,10 +19,9 @@
use crate::{errors::BooleanError, value::ConstrainedValue, GroupType};
use leo_asg::Span;
use snarkvm_models::{
curves::PrimeField,
gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean},
};
use snarkvm_fields::PrimeField;
use snarkvm_gadgets::traits::utilities::boolean::Boolean;
use snarkvm_r1cs::ConstraintSystem;
pub fn enforce_and<'a, F: PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>>(
cs: &mut CS,

View File

@ -19,7 +19,7 @@
use crate::{errors::BooleanError, value::ConstrainedValue, GroupType};
use leo_asg::Span;
use snarkvm_models::curves::PrimeField;
use snarkvm_fields::PrimeField;
pub fn evaluate_not<'a, F: PrimeField, G: GroupType<F>>(
value: ConstrainedValue<'a, F, G>,

View File

@ -19,10 +19,9 @@
use crate::{errors::BooleanError, value::ConstrainedValue, GroupType};
use leo_asg::Span;
use snarkvm_models::{
curves::PrimeField,
gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean},
};
use snarkvm_fields::PrimeField;
use snarkvm_gadgets::traits::utilities::boolean::Boolean;
use snarkvm_r1cs::ConstraintSystem;
pub fn enforce_or<'a, F: PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>>(
cs: &mut CS,

View File

@ -19,13 +19,9 @@
use crate::{enforce_and, errors::ExpressionError, value::ConstrainedValue, GroupType};
use leo_asg::Span;
use snarkvm_models::{
curves::PrimeField,
gadgets::{
r1cs::ConstraintSystem,
utilities::{boolean::Boolean, eq::EvaluateEqGadget},
},
};
use snarkvm_fields::PrimeField;
use snarkvm_gadgets::traits::utilities::{boolean::Boolean, eq::EvaluateEqGadget};
use snarkvm_r1cs::ConstraintSystem;
pub fn evaluate_eq<'a, F: PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>>(
cs: &mut CS,

View File

@ -20,7 +20,8 @@ use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType};
use leo_asg::Span;
use leo_gadgets::bits::ComparatorGadget;
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
pub fn evaluate_ge<'a, F: PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>>(
cs: &mut CS,

View File

@ -20,7 +20,8 @@ use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType};
use leo_asg::Span;
use leo_gadgets::bits::ComparatorGadget;
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
pub fn evaluate_gt<'a, F: PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>>(
cs: &mut CS,

View File

@ -20,7 +20,8 @@ use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType};
use leo_asg::Span;
use leo_gadgets::bits::ComparatorGadget;
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
pub fn evaluate_le<'a, F: PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>>(
cs: &mut CS,

View File

@ -20,7 +20,8 @@ use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType};
use leo_asg::Span;
use leo_gadgets::bits::comparator::EvaluateLtGadget;
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
pub fn evaluate_lt<'a, F: PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>>(
cs: &mut CS,

View File

@ -19,7 +19,8 @@
use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
use leo_asg::{Expression, Span};
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
#[allow(clippy::too_many_arguments)]

View File

@ -21,7 +21,8 @@ use std::cell::Cell;
use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
use leo_asg::Expression;
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
/// Enforce tuple expressions

View File

@ -19,7 +19,7 @@
use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
use leo_asg::VariableRef;
use snarkvm_models::curves::PrimeField;
use snarkvm_fields::PrimeField;
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
/// Enforce a variable expression by getting the resolved value

View File

@ -21,10 +21,9 @@ use crate::{errors::FunctionError, program::ConstrainedProgram, value::Constrain
use leo_asg::{Expression, Function, FunctionQualifier};
use std::cell::Cell;
use snarkvm_models::{
curves::PrimeField,
gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean},
};
use snarkvm_fields::PrimeField;
use snarkvm_gadgets::traits::utilities::boolean::Boolean;
use snarkvm_r1cs::ConstraintSystem;
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
pub(crate) fn enforce_function<CS: ConstraintSystem<F>>(

View File

@ -21,7 +21,8 @@ use crate::{errors::FunctionError, program::ConstrainedProgram, value::Constrain
use leo_asg::Type;
use leo_ast::{InputValue, Span};
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
pub fn allocate_array<CS: ConstraintSystem<F>>(

View File

@ -18,7 +18,8 @@ use crate::{errors::FunctionError, ConstrainedCircuitMember, ConstrainedProgram,
use leo_asg::{Circuit, CircuitMember, Type};
use leo_ast::{Identifier, Input, Span};
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
pub const RECORD_VARIABLE_NAME: &str = "record";
pub const REGISTERS_VARIABLE_NAME: &str = "registers";

View File

@ -18,7 +18,8 @@ use crate::{errors::FunctionError, ConstrainedCircuitMember, ConstrainedProgram,
use leo_asg::{AsgConvertError, Circuit, CircuitMember};
use leo_ast::{Identifier, InputValue, Parameter};
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
use indexmap::IndexMap;

View File

@ -32,7 +32,8 @@ use crate::{
use leo_asg::Type;
use leo_ast::{InputValue, Span};
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
pub fn allocate_main_function_input<CS: ConstraintSystem<F>>(

View File

@ -21,7 +21,8 @@ use crate::{errors::FunctionError, program::ConstrainedProgram, value::Constrain
use leo_asg::Type;
use leo_ast::{InputValue, Span};
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
pub fn allocate_tuple<CS: ConstraintSystem<F>>(

View File

@ -22,7 +22,8 @@ use leo_asg::{Expression, Function, FunctionQualifier};
use leo_ast::Input;
use std::cell::Cell;
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
pub fn enforce_main_function<CS: ConstraintSystem<F>>(

View File

@ -34,7 +34,8 @@ use leo_asg::{
Variable,
};
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
fn prepare_mut_access<CS: ConstraintSystem<F>>(

View File

@ -26,13 +26,9 @@ use crate::{
use leo_asg::{Span, Type};
use snarkvm_models::{
curves::PrimeField,
gadgets::{
r1cs::ConstraintSystem,
utilities::{boolean::Boolean, select::CondSelectGadget},
},
};
use snarkvm_fields::PrimeField;
use snarkvm_gadgets::traits::utilities::{boolean::Boolean, select::CondSelectGadget};
use snarkvm_r1cs::ConstraintSystem;
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
///

View File

@ -18,7 +18,7 @@ use crate::{errors::OutputBytesError, ConstrainedValue, GroupType, REGISTERS_VAR
use leo_asg::Program;
use leo_ast::{Parameter, Registers, Span};
use snarkvm_models::curves::PrimeField;
use snarkvm_fields::PrimeField;
use serde::{Deserialize, Serialize};

View File

@ -20,7 +20,10 @@ use crate::errors::OutputFileError;
use std::{
borrow::Cow,
fs::{self, File},
fs::{
File,
{self},
},
io::Write,
path::Path,
};

View File

@ -17,15 +17,15 @@
use super::CoreCircuit;
use crate::{errors::ExpressionError, ConstrainedValue, GroupType, Integer};
use leo_asg::{Function, Span};
use snarkvm_gadgets::algorithms::prf::Blake2sGadget;
use snarkvm_models::{
curves::PrimeField,
gadgets::{
use snarkvm_fields::PrimeField;
use snarkvm_gadgets::{
algorithms::prf::Blake2sGadget,
traits::{
algorithms::PRFGadget,
r1cs::ConstraintSystem,
utilities::{uint::UInt8, ToBytesGadget},
},
};
use snarkvm_r1cs::ConstraintSystem;
pub struct Blake2s;

View File

@ -19,7 +19,8 @@ pub use blake2s::*;
use crate::{errors::ExpressionError, ConstrainedValue, GroupType};
use leo_asg::{Function, Span};
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
pub trait CoreCircuit<'a, F: PrimeField, G: GroupType<F>>: Send + Sync {
fn call_function<CS: ConstraintSystem<F>>(

View File

@ -19,7 +19,7 @@
use crate::{value::ConstrainedValue, GroupType};
use leo_asg::Program;
use snarkvm_models::curves::PrimeField;
use snarkvm_fields::PrimeField;
use indexmap::IndexMap;

View File

@ -19,13 +19,9 @@
use crate::{arithmetic::*, errors::StatementError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
use leo_asg::{AssignOperation, AssignStatement, Span};
use snarkvm_models::{
curves::PrimeField,
gadgets::{
r1cs::ConstraintSystem,
utilities::{boolean::Boolean, select::CondSelectGadget},
},
};
use snarkvm_fields::PrimeField;
use snarkvm_gadgets::traits::utilities::{boolean::Boolean, select::CondSelectGadget};
use snarkvm_r1cs::ConstraintSystem;
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
#[allow(clippy::too_many_arguments)]

View File

@ -19,7 +19,8 @@
use crate::{errors::StatementError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
use leo_asg::{AssignAccess, AssignStatement, Identifier, Span};
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
pub(crate) enum ResolvedAssigneeAccess {
ArrayRange(Option<usize>, Option<usize>),

View File

@ -19,10 +19,9 @@
use crate::{program::ConstrainedProgram, GroupType, IndicatorAndConstrainedValue, StatementResult};
use leo_asg::BlockStatement;
use snarkvm_models::{
curves::PrimeField,
gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean},
};
use snarkvm_fields::PrimeField;
use snarkvm_gadgets::traits::utilities::boolean::Boolean;
use snarkvm_r1cs::ConstraintSystem;
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
/// Evaluates a branch of one or more statements and returns a result in

View File

@ -26,10 +26,9 @@ use crate::{
};
use leo_asg::ConditionalStatement;
use snarkvm_models::{
curves::PrimeField,
gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean},
};
use snarkvm_fields::PrimeField;
use snarkvm_gadgets::traits::utilities::boolean::Boolean;
use snarkvm_r1cs::ConstraintSystem;
fn indicator_to_string(indicator: &Boolean) -> String {
indicator

View File

@ -19,7 +19,8 @@
use crate::{errors::StatementError, program::ConstrainedProgram, ConstrainedValue, GroupType};
use leo_asg::{DefinitionStatement, Span, Variable};
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
fn enforce_multiple_definition(

View File

@ -26,13 +26,9 @@ use crate::{
};
use leo_asg::IterationStatement;
use snarkvm_models::{
curves::PrimeField,
gadgets::{
r1cs::ConstraintSystem,
utilities::{boolean::Boolean, uint::UInt32},
},
};
use snarkvm_fields::PrimeField;
use snarkvm_gadgets::traits::utilities::{boolean::Boolean, uint::UInt32};
use snarkvm_r1cs::ConstraintSystem;
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
#[allow(clippy::too_many_arguments)]

View File

@ -19,7 +19,8 @@
use crate::{errors::StatementError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
use leo_asg::ReturnStatement;
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
pub fn enforce_return_statement<CS: ConstraintSystem<F>>(

View File

@ -19,10 +19,9 @@
use crate::{errors::StatementError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
use leo_asg::Statement;
use snarkvm_models::{
curves::PrimeField,
gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean},
};
use snarkvm_fields::PrimeField;
use snarkvm_gadgets::traits::utilities::boolean::Boolean;
use snarkvm_r1cs::ConstraintSystem;
pub type StatementResult<T> = Result<T, StatementError>;
pub type IndicatorAndConstrainedValue<'a, T, U> = (Boolean, ConstrainedValue<'a, T, U>);

View File

@ -17,22 +17,16 @@
use crate::{errors::AddressError, ConstrainedValue, GroupType};
use leo_ast::{InputValue, Span};
use snarkvm_dpc::base_dpc::instantiated::Components;
use snarkvm_errors::gadgets::SynthesisError;
use snarkvm_models::{
curves::PrimeField,
gadgets::{
r1cs::{Assignment, ConstraintSystem},
utilities::{
alloc::AllocGadget,
boolean::Boolean,
eq::{ConditionalEqGadget, EqGadget, EvaluateEqGadget},
select::CondSelectGadget,
uint::{UInt, UInt8},
},
},
use snarkvm_dpc::{account::AccountAddress, base_dpc::instantiated::Components};
use snarkvm_fields::PrimeField;
use snarkvm_gadgets::traits::utilities::{
alloc::AllocGadget,
boolean::Boolean,
eq::{ConditionalEqGadget, EqGadget, EvaluateEqGadget},
select::CondSelectGadget,
uint::{UInt, UInt8},
};
use snarkvm_objects::account::AccountAddress;
use snarkvm_r1cs::{Assignment, ConstraintSystem, SynthesisError};
use snarkvm_utilities::ToBytes;
use std::{borrow::Borrow, str::FromStr};

View File

@ -19,14 +19,9 @@
use crate::{errors::BooleanError, value::ConstrainedValue, GroupType};
use leo_ast::{InputValue, Span};
use snarkvm_errors::gadgets::SynthesisError;
use snarkvm_models::{
curves::PrimeField,
gadgets::{
r1cs::ConstraintSystem,
utilities::{alloc::AllocGadget, boolean::Boolean},
},
};
use snarkvm_fields::PrimeField;
use snarkvm_gadgets::traits::utilities::{alloc::AllocGadget, boolean::Boolean};
use snarkvm_r1cs::{ConstraintSystem, SynthesisError};
pub(crate) fn allocate_bool<F: PrimeField, CS: ConstraintSystem<F>>(
cs: &mut CS,

View File

@ -19,12 +19,11 @@
use crate::{errors::FieldError, number_string_typing};
use leo_ast::Span;
use snarkvm_errors::gadgets::SynthesisError;
use snarkvm_models::{
curves::PrimeField,
gadgets::{
curves::{AllocatedFp, FieldGadget, FpGadget},
r1cs::ConstraintSystem,
use snarkvm_fields::PrimeField;
use snarkvm_gadgets::{
fields::{AllocatedFp, FpGadget},
traits::{
fields::FieldGadget,
utilities::{
alloc::AllocGadget,
boolean::Boolean,
@ -36,6 +35,7 @@ use snarkvm_models::{
},
},
};
use snarkvm_r1cs::{ConstraintSystem, SynthesisError};
use std::{borrow::Borrow, cmp::Ordering};

View File

@ -19,11 +19,9 @@
use crate::{errors::FieldError, number_string_typing, value::ConstrainedValue, FieldType, GroupType};
use leo_ast::{InputValue, Span};
use snarkvm_errors::gadgets::SynthesisError;
use snarkvm_models::{
curves::PrimeField,
gadgets::{r1cs::ConstraintSystem, utilities::alloc::AllocGadget},
};
use snarkvm_fields::PrimeField;
use snarkvm_gadgets::traits::utilities::alloc::AllocGadget;
use snarkvm_r1cs::{ConstraintSystem, SynthesisError};
pub(crate) fn allocate_field<F: PrimeField, CS: ConstraintSystem<F>>(
cs: &mut CS,

View File

@ -19,19 +19,15 @@
use crate::errors::GroupError;
use leo_asg::{GroupValue, Span};
use snarkvm_models::{
curves::{Field, One},
gadgets::{
r1cs::ConstraintSystem,
utilities::{
alloc::AllocGadget,
eq::{ConditionalEqGadget, EqGadget, EvaluateEqGadget},
select::CondSelectGadget,
ToBitsGadget,
ToBytesGadget,
},
},
use snarkvm_fields::{Field, One};
use snarkvm_gadgets::traits::utilities::{
alloc::AllocGadget,
eq::{ConditionalEqGadget, EqGadget, EvaluateEqGadget},
select::CondSelectGadget,
ToBitsGadget,
ToBytesGadget,
};
use snarkvm_r1cs::ConstraintSystem;
use std::fmt::{Debug, Display};
pub trait GroupType<F: Field>:

View File

@ -20,8 +20,8 @@ use crate::{errors::GroupError, ConstrainedValue, GroupType};
use leo_asg::{GroupValue, Span};
use leo_ast::InputValue;
use snarkvm_errors::gadgets::SynthesisError;
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::{ConstraintSystem, SynthesisError};
pub(crate) fn allocate_group<F: PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>>(
cs: &mut CS,

View File

@ -20,14 +20,16 @@ use leo_asg::{GroupCoordinate, GroupValue, Span};
use snarkvm_curves::{
edwards_bls12::{EdwardsAffine, EdwardsParameters, Fq},
templates::twisted_edwards_extended::GroupAffine,
AffineCurve,
TEModelParameters,
};
use snarkvm_errors::gadgets::SynthesisError;
use snarkvm_gadgets::curves::edwards_bls12::EdwardsBlsGadget;
use snarkvm_models::{
curves::{AffineCurve, Fp256, One, TEModelParameters, Zero},
gadgets::{
curves::{AllocatedFp, FieldGadget, FpGadget, GroupGadget},
r1cs::ConstraintSystem,
use snarkvm_fields::{Fp256, One, Zero};
use snarkvm_gadgets::{
curves::edwards_bls12::EdwardsBlsGadget,
fields::{AllocatedFp, FpGadget},
traits::{
curves::GroupGadget,
fields::FieldGadget,
utilities::{
alloc::AllocGadget,
boolean::Boolean,
@ -39,6 +41,7 @@ use snarkvm_models::{
},
},
};
use snarkvm_r1cs::{ConstraintSystem, SynthesisError};
use std::{
borrow::Borrow,
ops::{Mul, Neg, Sub},

View File

@ -24,20 +24,15 @@ use leo_gadgets::{
signed_integer::*,
};
use snarkvm_errors::gadgets::SynthesisError;
use snarkvm_models::{
curves::{Field, PrimeField},
gadgets::{
r1cs::ConstraintSystem,
utilities::{
alloc::AllocGadget,
boolean::Boolean,
eq::{ConditionalEqGadget, EqGadget, EvaluateEqGadget},
select::CondSelectGadget,
uint::*,
},
},
use snarkvm_fields::{Field, PrimeField};
use snarkvm_gadgets::traits::utilities::{
alloc::AllocGadget,
boolean::Boolean,
eq::{ConditionalEqGadget, EqGadget, EvaluateEqGadget},
select::CondSelectGadget,
uint::*,
};
use snarkvm_r1cs::{ConstraintSystem, SynthesisError};
use std::fmt;
/// An integer type enum wrapping the integer value.

View File

@ -16,7 +16,7 @@
use leo_gadgets::signed_integer::*;
use snarkvm_models::gadgets::utilities::{
use snarkvm_gadgets::traits::utilities::{
boolean::Boolean,
uint::{UInt128, UInt16, UInt32, UInt64, UInt8},
};

View File

@ -19,14 +19,9 @@
use crate::{errors::ValueError, Address, FieldType, GroupType, Integer};
use leo_asg::{Circuit, Identifier, Span, Type};
use snarkvm_errors::gadgets::SynthesisError;
use snarkvm_models::{
curves::PrimeField,
gadgets::{
r1cs::ConstraintSystem,
utilities::{boolean::Boolean, eq::ConditionalEqGadget, select::CondSelectGadget},
},
};
use snarkvm_fields::PrimeField;
use snarkvm_gadgets::traits::utilities::{boolean::Boolean, eq::ConditionalEqGadget, select::CondSelectGadget};
use snarkvm_r1cs::{ConstraintSystem, SynthesisError};
use std::fmt;
#[derive(Clone, PartialEq, Eq)]

View File

@ -28,8 +28,7 @@ use leo_input::types::{IntegerType, U8Type, UnsignedIntegerType};
use rand::Rng;
use rand_core::SeedableRng;
use rand_xorshift::XorShiftRng;
use snarkvm_algorithms::prf::blake2s::Blake2s as B2SPRF;
use snarkvm_models::algorithms::PRF;
use snarkvm_algorithms::{prf::blake2s::Blake2s as B2SPRF, traits::PRF};
#[test]
fn test_arguments_length_fail() {

View File

@ -48,7 +48,7 @@ use leo_compiler::{
use leo_input::types::{IntegerType, U32Type, UnsignedIntegerType};
use snarkvm_curves::edwards_bls12::Fq;
use snarkvm_models::gadgets::r1cs::TestConstraintSystem;
use snarkvm_r1cs::TestConstraintSystem;
use std::path::PathBuf;

View File

@ -17,16 +17,20 @@ include = [ "Cargo.toml", "src", "README.md", "LICENSE.md" ]
license = "GPL-3.0"
edition = "2018"
[dependencies.snarkvm-errors]
version = "0.0.6"
[dependencies.snarkvm-fields]
version = "0.2.0"
default-features = false
[dependencies.snarkvm-models]
version = "0.0.6"
[dependencies.snarkvm-gadgets]
version = "0.2.0"
default-features = false
[dependencies.snarkvm-r1cs]
version = "0.2.0"
default-features = false
[dependencies.snarkvm-utilities]
version = "0.0.6"
version = "0.2.0"
[dependencies.rand]
version = "0.8"

View File

@ -16,10 +16,8 @@
use leo_gadgets::{arithmetic::*, Int128, Int16, Int32, Int64, Int8};
use snarkvm_models::gadgets::{
r1cs::{ConstraintSystem, Fr, TestConstraintSystem},
utilities::alloc::AllocGadget,
};
use snarkvm_gadgets::traits::utilities::alloc::AllocGadget;
use snarkvm_r1cs::{ConstraintSystem, Fr, TestConstraintSystem};
use rand::{Rng, SeedableRng};
use rand_xorshift::XorShiftRng;

View File

@ -14,14 +14,9 @@
// 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 snarkvm_errors::gadgets::SynthesisError;
use snarkvm_models::{
curves::{Field, PrimeField},
gadgets::{
r1cs::ConstraintSystem,
utilities::uint::{UInt, UInt128, UInt16, UInt32, UInt64, UInt8},
},
};
use snarkvm_fields::{Field, PrimeField};
use snarkvm_gadgets::traits::utilities::uint::{UInt, UInt128, UInt16, UInt32, UInt64, UInt8};
use snarkvm_r1cs::{ConstraintSystem, SynthesisError};
/// Returns addition of `self` + `other` in the constraint system.
pub trait Add<F: Field, Rhs = Self>

View File

@ -14,7 +14,8 @@
// 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 snarkvm_models::{curves::Field, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::Field;
use snarkvm_r1cs::ConstraintSystem;
/// Returns division of `self` / `other` in the constraint system.
pub trait Div<F: Field, Rhs = Self>

View File

@ -14,7 +14,8 @@
// 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 snarkvm_models::{curves::Field, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::Field;
use snarkvm_r1cs::ConstraintSystem;
/// Returns multiplication of `self` * `other` in the constraint system.
pub trait Mul<F: Field, Rhs = Self>

View File

@ -16,11 +16,9 @@
use crate::bits::RippleCarryAdder;
use snarkvm_errors::gadgets::SynthesisError;
use snarkvm_models::{
curves::Field,
gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean},
};
use snarkvm_fields::Field;
use snarkvm_gadgets::traits::utilities::boolean::Boolean;
use snarkvm_r1cs::{ConstraintSystem, SynthesisError};
use std::iter;

View File

@ -14,7 +14,8 @@
// 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 snarkvm_models::{curves::Field, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::Field;
use snarkvm_r1cs::ConstraintSystem;
/// Returns exponentiation of `self` ** `other` in the constraint system.
pub trait Pow<F: Field, Rhs = Self>

View File

@ -14,7 +14,8 @@
// 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 snarkvm_models::{curves::Field, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::Field;
use snarkvm_r1cs::ConstraintSystem;
/// Returns subtraction of `self` - `other` in the constraint system.
pub trait Sub<F: Field, Rhs = Self>

View File

@ -14,11 +14,9 @@
// 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 snarkvm_errors::gadgets::SynthesisError;
use snarkvm_models::{
curves::Field,
gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean},
};
use snarkvm_fields::Field;
use snarkvm_gadgets::traits::utilities::boolean::Boolean;
use snarkvm_r1cs::{ConstraintSystem, SynthesisError};
/// Single bit binary adder with carry bit
/// https://en.wikipedia.org/wiki/Adder_(electronics)#Full_adder

View File

@ -14,18 +14,13 @@
// 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 snarkvm_errors::gadgets::SynthesisError;
use snarkvm_models::{
curves::{Field, PrimeField},
gadgets::{
r1cs::ConstraintSystem,
utilities::{
boolean::Boolean,
select::CondSelectGadget,
uint::{UInt128, UInt16, UInt32, UInt64, UInt8},
},
},
use snarkvm_fields::{Field, PrimeField};
use snarkvm_gadgets::traits::utilities::{
boolean::Boolean,
select::CondSelectGadget,
uint::{UInt128, UInt16, UInt32, UInt64, UInt8},
};
use snarkvm_r1cs::{ConstraintSystem, SynthesisError};
pub trait EvaluateLtGadget<F: Field> {
fn less_than<CS: ConstraintSystem<F>>(&self, cs: CS, other: &Self) -> Result<Boolean, SynthesisError>;

View File

@ -16,11 +16,9 @@
use crate::{bits::FullAdder, signed_integer::*};
use snarkvm_errors::gadgets::SynthesisError;
use snarkvm_models::{
curves::{Field, PrimeField},
gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean},
};
use snarkvm_fields::{Field, PrimeField};
use snarkvm_gadgets::traits::utilities::boolean::Boolean;
use snarkvm_r1cs::{ConstraintSystem, SynthesisError};
/// Returns the bitwise sum of a n-bit number with carry bit
pub trait RippleCarryAdder<F: Field, Rhs = Self>

View File

@ -14,7 +14,7 @@
// 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 snarkvm_models::gadgets::utilities::boolean::Boolean;
use snarkvm_gadgets::traits::utilities::boolean::Boolean;
use std::iter;

View File

@ -14,7 +14,7 @@
// 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 snarkvm_errors::gadgets::SynthesisError;
use snarkvm_r1cs::SynthesisError;
#[derive(Debug, Error)]
pub enum SignedIntegerError {

View File

@ -26,16 +26,12 @@ use crate::{
Int8,
};
use snarkvm_models::{
curves::{fp_parameters::FpParameters, PrimeField},
gadgets::{
r1cs::{Assignment, ConstraintSystem, LinearCombination},
utilities::{
alloc::AllocGadget,
boolean::{AllocatedBit, Boolean},
},
},
use snarkvm_fields::{fp_parameters::FpParameters, PrimeField};
use snarkvm_gadgets::traits::utilities::{
alloc::AllocGadget,
boolean::{AllocatedBit, Boolean},
};
use snarkvm_r1cs::{Assignment, ConstraintSystem, LinearCombination};
macro_rules! add_int_impl {
($($gadget: ident)*) => ($(

View File

@ -25,18 +25,14 @@ use crate::{
Int64,
Int8,
};
use snarkvm_models::{
curves::PrimeField,
gadgets::{
r1cs::ConstraintSystem,
utilities::{
alloc::AllocGadget,
boolean::{AllocatedBit, Boolean},
eq::EvaluateEqGadget,
select::CondSelectGadget,
},
},
use snarkvm_fields::PrimeField;
use snarkvm_gadgets::traits::utilities::{
alloc::AllocGadget,
boolean::{AllocatedBit, Boolean},
eq::EvaluateEqGadget,
select::CondSelectGadget,
};
use snarkvm_r1cs::ConstraintSystem;
macro_rules! div_int_impl {
($($gadget:ident),*) => ($(

View File

@ -25,17 +25,13 @@ use crate::{
Int64,
Int8,
};
use snarkvm_models::{
curves::{FpParameters, PrimeField},
gadgets::{
r1cs::{Assignment, ConstraintSystem, LinearCombination},
utilities::{
alloc::AllocGadget,
boolean::{AllocatedBit, Boolean},
select::CondSelectGadget,
},
},
use snarkvm_fields::{FpParameters, PrimeField};
use snarkvm_gadgets::traits::utilities::{
alloc::AllocGadget,
boolean::{AllocatedBit, Boolean},
select::CondSelectGadget,
};
use snarkvm_r1cs::{Assignment, ConstraintSystem, LinearCombination};
use std::iter;

View File

@ -16,7 +16,8 @@
use crate::{arithmetic::Neg, errors::SignedIntegerError, signed_integer::*};
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
macro_rules! neg_int_impl {
($($gadget: ident)*) => ($(

View File

@ -25,13 +25,9 @@ use crate::{
Int8,
};
use snarkvm_models::{
curves::PrimeField,
gadgets::{
r1cs::ConstraintSystem,
utilities::{alloc::AllocGadget, boolean::Boolean, select::CondSelectGadget},
},
};
use snarkvm_fields::PrimeField;
use snarkvm_gadgets::traits::utilities::{alloc::AllocGadget, boolean::Boolean, select::CondSelectGadget};
use snarkvm_r1cs::ConstraintSystem;
macro_rules! pow_int_impl {
($($gadget:ty)*) => ($(

View File

@ -23,7 +23,8 @@ use crate::{
Int64,
Int8,
};
use snarkvm_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
use snarkvm_fields::PrimeField;
use snarkvm_r1cs::ConstraintSystem;
macro_rules! sub_int_impl {
($($gadget: ident)*) => ($(

View File

@ -14,7 +14,7 @@
// 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 snarkvm_models::gadgets::utilities::boolean::Boolean;
use snarkvm_gadgets::traits::utilities::boolean::Boolean;
use std::fmt::Debug;

Some files were not shown because too many files have changed in this diff Show More