mirror of
https://github.com/AleoHQ/leo.git
synced 2024-11-11 16:10:09 +03:00
Update gadgets traits
This commit is contained in:
parent
400e3dd440
commit
3c4b8e9f68
@ -36,8 +36,8 @@ use snarkvm_dpc::base_dpc::instantiated::Components;
|
||||
use snarkvm_dpc::SystemParameters;
|
||||
use snarkvm_errors::gadgets::SynthesisError;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSynthesizer;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSynthesizer;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
use sha2::Digest;
|
||||
use sha2::Sha256;
|
||||
|
@ -24,9 +24,9 @@ use crate::GroupType;
|
||||
use leo_asg::Expression;
|
||||
use leo_asg::Span;
|
||||
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::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>>(
|
||||
|
@ -23,9 +23,9 @@ use crate::GroupType;
|
||||
use leo_asg::ConsoleFunction;
|
||||
use leo_asg::ConsoleStatement;
|
||||
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::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>>(
|
||||
|
@ -22,7 +22,7 @@ use crate::GroupType;
|
||||
use leo_asg::FormattedString;
|
||||
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
pub fn format<CS: ConstraintSystem<F>>(
|
||||
|
@ -27,8 +27,8 @@ use leo_input::LeoInputParser;
|
||||
use leo_package::inputs::InputPairs;
|
||||
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::r1cs::TestConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
use std::path::Path;
|
||||
|
||||
pub fn generate_constraints<'a, F: PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>>(
|
||||
|
@ -22,7 +22,7 @@ use crate::GroupType;
|
||||
use leo_ast::Span;
|
||||
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
pub fn enforce_add<'a, F: PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>>(
|
||||
cs: &mut CS,
|
||||
|
@ -22,7 +22,7 @@ use crate::GroupType;
|
||||
use leo_ast::Span;
|
||||
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
pub fn enforce_div<'a, F: PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>>(
|
||||
cs: &mut CS,
|
||||
|
@ -22,7 +22,7 @@ use crate::GroupType;
|
||||
use leo_ast::Span;
|
||||
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
pub fn enforce_mul<'a, F: PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>>(
|
||||
cs: &mut CS,
|
||||
|
@ -22,7 +22,7 @@ use crate::GroupType;
|
||||
use leo_ast::Span;
|
||||
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
pub fn enforce_negate<'a, F: PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>>(
|
||||
cs: &mut CS,
|
||||
|
@ -22,7 +22,7 @@ use crate::GroupType;
|
||||
use leo_ast::Span;
|
||||
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
pub fn enforce_pow<'a, F: PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>>(
|
||||
cs: &mut CS,
|
||||
|
@ -22,7 +22,7 @@ use crate::GroupType;
|
||||
use leo_ast::Span;
|
||||
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
pub fn enforce_sub<'a, F: PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>>(
|
||||
cs: &mut CS,
|
||||
|
@ -24,7 +24,7 @@ use leo_asg::Expression;
|
||||
use leo_asg::Span;
|
||||
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
|
@ -24,7 +24,7 @@ use leo_asg::Expression;
|
||||
use leo_asg::Span;
|
||||
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
pub(crate) fn enforce_index<CS: ConstraintSystem<F>>(
|
||||
|
@ -23,7 +23,7 @@ use crate::GroupType;
|
||||
use leo_asg::Expression;
|
||||
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
type ConstrainedValuePair<'a, T, U> = (ConstrainedValue<'a, T, U>, ConstrainedValue<'a, T, U>);
|
||||
|
||||
|
@ -24,7 +24,7 @@ use leo_asg::CircuitAccessExpression;
|
||||
use leo_asg::Node;
|
||||
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
|
@ -26,7 +26,7 @@ use leo_asg::CircuitMember;
|
||||
use leo_asg::Span;
|
||||
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
pub fn enforce_circuit<CS: ConstraintSystem<F>>(
|
||||
|
@ -23,9 +23,9 @@ use crate::GroupType;
|
||||
use leo_asg::Expression;
|
||||
use leo_asg::Span;
|
||||
|
||||
use snarkvm_gadgets::traits::select::CondSelectGadget;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::select::CondSelectGadget;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
/// Enforce ternary conditional expression
|
||||
|
@ -32,9 +32,9 @@ use leo_asg::ConstValue;
|
||||
use leo_asg::Expression;
|
||||
use leo_asg::Node;
|
||||
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::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>>(
|
||||
|
@ -26,7 +26,7 @@ use leo_asg::Expression;
|
||||
use leo_asg::Function;
|
||||
use leo_asg::Span;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
/// Call a default core circuit function with arguments
|
||||
|
@ -27,7 +27,7 @@ use leo_asg::Function;
|
||||
use leo_asg::Span;
|
||||
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
|
@ -21,8 +21,8 @@ use crate::value::ConstrainedValue;
|
||||
use crate::GroupType;
|
||||
use leo_asg::Span;
|
||||
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
pub fn enforce_and<'a, F: PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>>(
|
||||
|
@ -21,9 +21,9 @@ use crate::value::ConstrainedValue;
|
||||
use crate::GroupType;
|
||||
use leo_asg::Span;
|
||||
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
pub fn enforce_or<'a, F: PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>>(
|
||||
cs: &mut CS,
|
||||
|
@ -22,10 +22,10 @@ use crate::value::ConstrainedValue;
|
||||
use crate::GroupType;
|
||||
use leo_asg::Span;
|
||||
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_gadgets::traits::eq::EvaluateEqGadget;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_models::gadgets::utilities::eq::EvaluateEqGadget;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
pub fn evaluate_eq<'a, F: PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>>(
|
||||
cs: &mut CS,
|
||||
|
@ -23,7 +23,7 @@ use leo_asg::Span;
|
||||
use leo_gadgets::bits::ComparatorGadget;
|
||||
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
pub fn evaluate_ge<'a, F: PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>>(
|
||||
cs: &mut CS,
|
||||
|
@ -23,7 +23,7 @@ use leo_asg::Span;
|
||||
use leo_gadgets::bits::ComparatorGadget;
|
||||
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
pub fn evaluate_gt<'a, F: PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>>(
|
||||
cs: &mut CS,
|
||||
|
@ -23,7 +23,7 @@ use leo_asg::Span;
|
||||
use leo_gadgets::bits::ComparatorGadget;
|
||||
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
pub fn evaluate_le<'a, F: PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>>(
|
||||
cs: &mut CS,
|
||||
|
@ -24,7 +24,7 @@ use leo_asg::Expression;
|
||||
use leo_asg::Span;
|
||||
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
|
@ -25,7 +25,7 @@ use crate::GroupType;
|
||||
use leo_asg::Expression;
|
||||
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
/// Enforce tuple expressions
|
||||
|
@ -26,9 +26,9 @@ use leo_asg::Function;
|
||||
use leo_asg::FunctionQualifier;
|
||||
use std::cell::Cell;
|
||||
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::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>>(
|
||||
|
@ -26,7 +26,7 @@ use leo_ast::InputValue;
|
||||
use leo_ast::Span;
|
||||
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
pub fn allocate_array<CS: ConstraintSystem<F>>(
|
||||
|
@ -27,7 +27,7 @@ use leo_ast::Input;
|
||||
use leo_ast::Span;
|
||||
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
pub const RECORD_VARIABLE_NAME: &str = "record";
|
||||
pub const REGISTERS_VARIABLE_NAME: &str = "registers";
|
||||
|
@ -30,7 +30,7 @@ use leo_asg::Type;
|
||||
use leo_ast::InputValue;
|
||||
use leo_ast::Span;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
pub fn allocate_main_function_input<CS: ConstraintSystem<F>>(
|
||||
|
@ -26,7 +26,7 @@ use leo_ast::InputValue;
|
||||
use leo_ast::Span;
|
||||
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
pub fn allocate_tuple<CS: ConstraintSystem<F>>(
|
||||
|
@ -28,7 +28,7 @@ use leo_ast::Input;
|
||||
use std::cell::Cell;
|
||||
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
pub fn enforce_main_function<CS: ConstraintSystem<F>>(
|
||||
|
@ -31,7 +31,7 @@ use leo_asg::TupleAccessExpression;
|
||||
use leo_asg::Variable;
|
||||
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
fn prepare_mut_access<CS: ConstraintSystem<F>>(
|
||||
|
@ -25,10 +25,10 @@ use crate::GroupType;
|
||||
use leo_asg::Span;
|
||||
use leo_asg::Type;
|
||||
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_gadgets::traits::select::CondSelectGadget;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_models::gadgets::utilities::select::CondSelectGadget;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
///
|
||||
|
@ -22,11 +22,11 @@ use crate::Integer;
|
||||
use leo_asg::Function;
|
||||
use leo_asg::Span;
|
||||
use snarkvm_gadgets::algorithms::prf::Blake2sGadget;
|
||||
use snarkvm_gadgets::traits::uint::UInt8;
|
||||
use snarkvm_gadgets::traits::ToBytesGadget;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::algorithms::PRFGadget;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::uint::UInt8;
|
||||
use snarkvm_models::gadgets::utilities::ToBytesGadget;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
pub struct Blake2s;
|
||||
|
||||
|
@ -23,7 +23,7 @@ use crate::GroupType;
|
||||
use leo_asg::Function;
|
||||
use leo_asg::Span;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
pub trait CoreCircuit<'a, F: PrimeField, G: GroupType<F>>: Send + Sync {
|
||||
fn call_function<CS: ConstraintSystem<F>>(
|
||||
|
@ -25,10 +25,10 @@ use leo_asg::AssignOperation;
|
||||
use leo_asg::AssignStatement;
|
||||
use leo_asg::Span;
|
||||
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_gadgets::traits::select::CondSelectGadget;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_models::gadgets::utilities::select::CondSelectGadget;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
|
@ -26,7 +26,7 @@ use leo_asg::Identifier;
|
||||
use leo_asg::Span;
|
||||
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
pub(crate) enum ResolvedAssigneeAccess {
|
||||
ArrayRange(Option<usize>, Option<usize>),
|
||||
|
@ -22,9 +22,9 @@ use crate::IndicatorAndConstrainedValue;
|
||||
use crate::StatementResult;
|
||||
use leo_asg::BlockStatement;
|
||||
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::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
|
||||
|
@ -24,9 +24,9 @@ use crate::IndicatorAndConstrainedValue;
|
||||
use crate::StatementResult;
|
||||
use leo_asg::ConditionalStatement;
|
||||
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
fn indicator_to_string(indicator: &Boolean) -> String {
|
||||
indicator
|
||||
|
@ -25,7 +25,7 @@ use leo_asg::Span;
|
||||
use leo_asg::Variable;
|
||||
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
fn enforce_multiple_definition(
|
||||
|
@ -24,10 +24,10 @@ use crate::Integer;
|
||||
use crate::StatementResult;
|
||||
use leo_asg::IterationStatement;
|
||||
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_gadgets::traits::uint::UInt32;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_models::gadgets::utilities::uint::UInt32;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
|
@ -23,7 +23,7 @@ use crate::GroupType;
|
||||
use leo_asg::ReturnStatement;
|
||||
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
pub fn enforce_return_statement<CS: ConstraintSystem<F>>(
|
||||
|
@ -22,9 +22,9 @@ use crate::value::ConstrainedValue;
|
||||
use crate::GroupType;
|
||||
use leo_asg::Statement;
|
||||
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::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>);
|
||||
|
@ -22,18 +22,18 @@ use leo_ast::Span;
|
||||
|
||||
use snarkvm_dpc::base_dpc::instantiated::Components;
|
||||
use snarkvm_errors::gadgets::SynthesisError;
|
||||
use snarkvm_gadgets::traits::alloc::AllocGadget;
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_gadgets::traits::eq::ConditionalEqGadget;
|
||||
use snarkvm_gadgets::traits::eq::EqGadget;
|
||||
use snarkvm_gadgets::traits::eq::EvaluateEqGadget;
|
||||
use snarkvm_gadgets::traits::select::CondSelectGadget;
|
||||
use snarkvm_gadgets::traits::uint::UInt;
|
||||
use snarkvm_gadgets::traits::uint::UInt8;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::Assignment;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::alloc::AllocGadget;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_models::gadgets::utilities::eq::ConditionalEqGadget;
|
||||
use snarkvm_models::gadgets::utilities::eq::EqGadget;
|
||||
use snarkvm_models::gadgets::utilities::eq::EvaluateEqGadget;
|
||||
use snarkvm_models::gadgets::utilities::select::CondSelectGadget;
|
||||
use snarkvm_models::gadgets::utilities::uint::UInt;
|
||||
use snarkvm_models::gadgets::utilities::uint::UInt8;
|
||||
use snarkvm_objects::account::AccountAddress;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
use snarkvm_utilities::ToBytes;
|
||||
use std::borrow::Borrow;
|
||||
use std::str::FromStr;
|
||||
@ -207,7 +207,11 @@ impl<F: PrimeField> ConditionalEqGadget<F> for Address {
|
||||
}
|
||||
|
||||
fn cond_select_helper(first: &Address, second: &Address, cond: bool) -> Address {
|
||||
if cond { first.clone() } else { second.clone() }
|
||||
if cond {
|
||||
first.clone()
|
||||
} else {
|
||||
second.clone()
|
||||
}
|
||||
}
|
||||
|
||||
impl<F: PrimeField> CondSelectGadget<F> for Address {
|
||||
|
@ -23,9 +23,9 @@ use leo_ast::InputValue;
|
||||
use leo_ast::Span;
|
||||
|
||||
use snarkvm_errors::gadgets::SynthesisError;
|
||||
use snarkvm_gadgets::traits::alloc::AllocGadget;
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::utilities::alloc::AllocGadget;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
pub(crate) fn allocate_bool<F: PrimeField, CS: ConstraintSystem<F>>(
|
||||
|
@ -21,20 +21,20 @@ use crate::number_string_typing;
|
||||
use leo_ast::Span;
|
||||
|
||||
use snarkvm_errors::gadgets::SynthesisError;
|
||||
use snarkvm_gadgets::traits::alloc::AllocGadget;
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_gadgets::traits::eq::ConditionalEqGadget;
|
||||
use snarkvm_gadgets::traits::eq::EqGadget;
|
||||
use snarkvm_gadgets::traits::eq::EvaluateEqGadget;
|
||||
use snarkvm_gadgets::traits::select::CondSelectGadget;
|
||||
use snarkvm_gadgets::traits::uint::UInt8;
|
||||
use snarkvm_gadgets::traits::ToBitsGadget;
|
||||
use snarkvm_gadgets::traits::ToBytesGadget;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::curves::AllocatedFp;
|
||||
use snarkvm_models::gadgets::curves::FieldGadget;
|
||||
use snarkvm_models::gadgets::curves::FpGadget;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::alloc::AllocGadget;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_models::gadgets::utilities::eq::ConditionalEqGadget;
|
||||
use snarkvm_models::gadgets::utilities::eq::EqGadget;
|
||||
use snarkvm_models::gadgets::utilities::eq::EvaluateEqGadget;
|
||||
use snarkvm_models::gadgets::utilities::select::CondSelectGadget;
|
||||
use snarkvm_models::gadgets::utilities::uint::UInt8;
|
||||
use snarkvm_models::gadgets::utilities::ToBitsGadget;
|
||||
use snarkvm_models::gadgets::utilities::ToBytesGadget;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
use std::borrow::Borrow;
|
||||
use std::cmp::Ordering;
|
||||
@ -293,7 +293,11 @@ impl<F: PrimeField> CondSelectGadget<F> for FieldType<F> {
|
||||
second: &Self,
|
||||
) -> Result<Self, SynthesisError> {
|
||||
if let Boolean::Constant(cond) = *cond {
|
||||
if cond { Ok(first.clone()) } else { Ok(second.clone()) }
|
||||
if cond {
|
||||
Ok(first.clone())
|
||||
} else {
|
||||
Ok(second.clone())
|
||||
}
|
||||
} else {
|
||||
let first_gadget = first.allocated(&mut cs)?;
|
||||
let second_gadget = second.allocated(&mut cs)?;
|
||||
|
@ -25,9 +25,9 @@ use leo_ast::InputValue;
|
||||
use leo_ast::Span;
|
||||
|
||||
use snarkvm_errors::gadgets::SynthesisError;
|
||||
use snarkvm_gadgets::traits::alloc::AllocGadget;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::alloc::AllocGadget;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
pub(crate) fn allocate_field<F: PrimeField, CS: ConstraintSystem<F>>(
|
||||
cs: &mut CS,
|
||||
|
@ -21,15 +21,15 @@ use leo_asg::GroupValue;
|
||||
use leo_asg::Span;
|
||||
|
||||
use snarkvm_fields::Field;
|
||||
use snarkvm_gadgets::traits::alloc::AllocGadget;
|
||||
use snarkvm_gadgets::traits::eq::ConditionalEqGadget;
|
||||
use snarkvm_gadgets::traits::eq::EqGadget;
|
||||
use snarkvm_gadgets::traits::eq::EvaluateEqGadget;
|
||||
use snarkvm_gadgets::traits::select::CondSelectGadget;
|
||||
use snarkvm_gadgets::traits::ToBitsGadget;
|
||||
use snarkvm_gadgets::traits::ToBytesGadget;
|
||||
use snarkvm_models::curves::One;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::alloc::AllocGadget;
|
||||
use snarkvm_models::gadgets::utilities::eq::ConditionalEqGadget;
|
||||
use snarkvm_models::gadgets::utilities::eq::EqGadget;
|
||||
use snarkvm_models::gadgets::utilities::eq::EvaluateEqGadget;
|
||||
use snarkvm_models::gadgets::utilities::select::CondSelectGadget;
|
||||
use snarkvm_models::gadgets::utilities::ToBitsGadget;
|
||||
use snarkvm_models::gadgets::utilities::ToBytesGadget;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
use std::fmt::Debug;
|
||||
use std::fmt::Display;
|
||||
|
||||
|
@ -27,6 +27,15 @@ use snarkvm_curves::edwards_bls12::Fq;
|
||||
use snarkvm_curves::templates::twisted_edwards_extended::GroupAffine;
|
||||
use snarkvm_errors::gadgets::SynthesisError;
|
||||
use snarkvm_gadgets::curves::edwards_bls12::EdwardsBlsGadget;
|
||||
use snarkvm_gadgets::traits::alloc::AllocGadget;
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_gadgets::traits::eq::ConditionalEqGadget;
|
||||
use snarkvm_gadgets::traits::eq::EqGadget;
|
||||
use snarkvm_gadgets::traits::eq::EvaluateEqGadget;
|
||||
use snarkvm_gadgets::traits::select::CondSelectGadget;
|
||||
use snarkvm_gadgets::traits::uint::UInt8;
|
||||
use snarkvm_gadgets::traits::ToBitsGadget;
|
||||
use snarkvm_gadgets::traits::ToBytesGadget;
|
||||
use snarkvm_models::curves::AffineCurve;
|
||||
use snarkvm_models::curves::Fp256;
|
||||
use snarkvm_models::curves::One;
|
||||
@ -36,16 +45,7 @@ use snarkvm_models::gadgets::curves::AllocatedFp;
|
||||
use snarkvm_models::gadgets::curves::FieldGadget;
|
||||
use snarkvm_models::gadgets::curves::FpGadget;
|
||||
use snarkvm_models::gadgets::curves::GroupGadget;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::alloc::AllocGadget;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_models::gadgets::utilities::eq::ConditionalEqGadget;
|
||||
use snarkvm_models::gadgets::utilities::eq::EqGadget;
|
||||
use snarkvm_models::gadgets::utilities::eq::EvaluateEqGadget;
|
||||
use snarkvm_models::gadgets::utilities::select::CondSelectGadget;
|
||||
use snarkvm_models::gadgets::utilities::uint::UInt8;
|
||||
use snarkvm_models::gadgets::utilities::ToBitsGadget;
|
||||
use snarkvm_models::gadgets::utilities::ToBytesGadget;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
use std::borrow::Borrow;
|
||||
use std::ops::Mul;
|
||||
use std::ops::Neg;
|
||||
@ -488,7 +488,11 @@ impl CondSelectGadget<Fq> for EdwardsGroupType {
|
||||
second: &Self,
|
||||
) -> Result<Self, SynthesisError> {
|
||||
if let Boolean::Constant(cond) = *cond {
|
||||
if cond { Ok(first.clone()) } else { Ok(second.clone()) }
|
||||
if cond {
|
||||
Ok(first.clone())
|
||||
} else {
|
||||
Ok(second.clone())
|
||||
}
|
||||
} else {
|
||||
let first_gadget = first.allocated(cs.ns(|| "first"))?;
|
||||
let second_gadget = second.allocated(cs.ns(|| "second"))?;
|
||||
|
@ -28,15 +28,15 @@ use leo_gadgets::signed_integer::*;
|
||||
|
||||
use snarkvm_errors::gadgets::SynthesisError;
|
||||
use snarkvm_fields::Field;
|
||||
use snarkvm_gadgets::traits::alloc::AllocGadget;
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_gadgets::traits::eq::ConditionalEqGadget;
|
||||
use snarkvm_gadgets::traits::eq::EqGadget;
|
||||
use snarkvm_gadgets::traits::eq::EvaluateEqGadget;
|
||||
use snarkvm_gadgets::traits::select::CondSelectGadget;
|
||||
use snarkvm_gadgets::traits::uint::*;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::alloc::AllocGadget;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_models::gadgets::utilities::eq::ConditionalEqGadget;
|
||||
use snarkvm_models::gadgets::utilities::eq::EqGadget;
|
||||
use snarkvm_models::gadgets::utilities::eq::EvaluateEqGadget;
|
||||
use snarkvm_models::gadgets::utilities::select::CondSelectGadget;
|
||||
use snarkvm_models::gadgets::utilities::uint::*;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
use std::fmt;
|
||||
|
||||
/// An integer type enum wrapping the integer value.
|
||||
|
@ -16,12 +16,12 @@
|
||||
|
||||
use leo_gadgets::signed_integer::*;
|
||||
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_models::gadgets::utilities::uint::UInt128;
|
||||
use snarkvm_models::gadgets::utilities::uint::UInt16;
|
||||
use snarkvm_models::gadgets::utilities::uint::UInt32;
|
||||
use snarkvm_models::gadgets::utilities::uint::UInt64;
|
||||
use snarkvm_models::gadgets::utilities::uint::UInt8;
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_gadgets::traits::uint::UInt128;
|
||||
use snarkvm_gadgets::traits::uint::UInt16;
|
||||
use snarkvm_gadgets::traits::uint::UInt32;
|
||||
use snarkvm_gadgets::traits::uint::UInt64;
|
||||
use snarkvm_gadgets::traits::uint::UInt8;
|
||||
use std::fmt::Debug;
|
||||
|
||||
pub trait IntegerTrait: Sized + Clone + Debug {
|
||||
|
@ -27,11 +27,11 @@ use leo_asg::Span;
|
||||
use leo_asg::Type;
|
||||
|
||||
use snarkvm_errors::gadgets::SynthesisError;
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_gadgets::traits::eq::ConditionalEqGadget;
|
||||
use snarkvm_gadgets::traits::select::CondSelectGadget;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_models::gadgets::utilities::eq::ConditionalEqGadget;
|
||||
use snarkvm_models::gadgets::utilities::select::CondSelectGadget;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
|
@ -21,10 +21,10 @@ use leo_gadgets::Int32;
|
||||
use leo_gadgets::Int64;
|
||||
use leo_gadgets::Int8;
|
||||
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_gadgets::traits::alloc::AllocGadget;
|
||||
use snarkvm_models::gadgets::r1cs::Fr;
|
||||
use snarkvm_models::gadgets::r1cs::TestConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::alloc::AllocGadget;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
use rand::Rng;
|
||||
use rand::SeedableRng;
|
||||
|
@ -16,14 +16,14 @@
|
||||
|
||||
use snarkvm_errors::gadgets::SynthesisError;
|
||||
use snarkvm_fields::Field;
|
||||
use snarkvm_gadgets::traits::uint::UInt;
|
||||
use snarkvm_gadgets::traits::uint::UInt128;
|
||||
use snarkvm_gadgets::traits::uint::UInt16;
|
||||
use snarkvm_gadgets::traits::uint::UInt32;
|
||||
use snarkvm_gadgets::traits::uint::UInt64;
|
||||
use snarkvm_gadgets::traits::uint::UInt8;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::uint::UInt;
|
||||
use snarkvm_models::gadgets::utilities::uint::UInt128;
|
||||
use snarkvm_models::gadgets::utilities::uint::UInt16;
|
||||
use snarkvm_models::gadgets::utilities::uint::UInt32;
|
||||
use snarkvm_models::gadgets::utilities::uint::UInt64;
|
||||
use snarkvm_models::gadgets::utilities::uint::UInt8;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
/// Returns addition of `self` + `other` in the constraint system.
|
||||
pub trait Add<F: Field, Rhs = Self>
|
||||
|
@ -15,7 +15,7 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use snarkvm_fields::Field;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
/// Returns division of `self` / `other` in the constraint system.
|
||||
pub trait Div<F: Field, Rhs = Self>
|
||||
|
@ -15,7 +15,7 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use snarkvm_fields::Field;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
/// Returns multiplication of `self` * `other` in the constraint system.
|
||||
pub trait Mul<F: Field, Rhs = Self>
|
||||
|
@ -18,8 +18,8 @@ use crate::bits::RippleCarryAdder;
|
||||
|
||||
use snarkvm_errors::gadgets::SynthesisError;
|
||||
use snarkvm_fields::Field;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
use std::iter;
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use snarkvm_fields::Field;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
/// Returns exponentiation of `self` ** `other` in the constraint system.
|
||||
pub trait Pow<F: Field, Rhs = Self>
|
||||
|
@ -16,8 +16,8 @@
|
||||
|
||||
use snarkvm_errors::gadgets::SynthesisError;
|
||||
use snarkvm_fields::Field;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
/// Single bit binary adder with carry bit
|
||||
/// https://en.wikipedia.org/wiki/Adder_(electronics)#Full_adder
|
||||
|
@ -16,14 +16,14 @@
|
||||
|
||||
use snarkvm_errors::gadgets::SynthesisError;
|
||||
use snarkvm_fields::Field;
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_gadgets::traits::select::CondSelectGadget;
|
||||
use snarkvm_gadgets::traits::uint::UInt128;
|
||||
use snarkvm_gadgets::traits::uint::UInt16;
|
||||
use snarkvm_gadgets::traits::uint::UInt32;
|
||||
use snarkvm_gadgets::traits::uint::UInt64;
|
||||
use snarkvm_gadgets::traits::uint::UInt8;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_models::gadgets::utilities::select::CondSelectGadget;
|
||||
use snarkvm_models::gadgets::utilities::uint::UInt128;
|
||||
use snarkvm_models::gadgets::utilities::uint::UInt16;
|
||||
use snarkvm_models::gadgets::utilities::uint::UInt32;
|
||||
use snarkvm_models::gadgets::utilities::uint::UInt64;
|
||||
use snarkvm_models::gadgets::utilities::uint::UInt8;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
pub trait EvaluateLtGadget<F: Field> {
|
||||
|
@ -19,9 +19,9 @@ use crate::signed_integer::*;
|
||||
|
||||
use snarkvm_errors::gadgets::SynthesisError;
|
||||
use snarkvm_fields::Field;
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
/// Returns the bitwise sum of a n-bit number with carry bit
|
||||
pub trait RippleCarryAdder<F: Field, Rhs = Self>
|
||||
|
@ -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::boolean::Boolean;
|
||||
|
||||
use std::iter;
|
||||
|
||||
|
@ -24,14 +24,14 @@ use crate::Int32;
|
||||
use crate::Int64;
|
||||
use crate::Int8;
|
||||
|
||||
use snarkvm_gadgets::traits::alloc::AllocGadget;
|
||||
use snarkvm_gadgets::traits::boolean::AllocatedBit;
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_models::curves::fp_parameters::FpParameters;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::Assignment;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::r1cs::LinearCombination;
|
||||
use snarkvm_models::gadgets::utilities::alloc::AllocGadget;
|
||||
use snarkvm_models::gadgets::utilities::boolean::AllocatedBit;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
macro_rules! add_int_impl {
|
||||
($($gadget: ident)*) => ($(
|
||||
|
@ -26,13 +26,13 @@ use crate::Int16;
|
||||
use crate::Int32;
|
||||
use crate::Int64;
|
||||
use crate::Int8;
|
||||
use snarkvm_gadgets::traits::alloc::AllocGadget;
|
||||
use snarkvm_gadgets::traits::boolean::AllocatedBit;
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_gadgets::traits::eq::EvaluateEqGadget;
|
||||
use snarkvm_gadgets::traits::select::CondSelectGadget;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::alloc::AllocGadget;
|
||||
use snarkvm_models::gadgets::utilities::boolean::AllocatedBit;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_models::gadgets::utilities::eq::EvaluateEqGadget;
|
||||
use snarkvm_models::gadgets::utilities::select::CondSelectGadget;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
macro_rules! div_int_impl {
|
||||
($($gadget:ident),*) => ($(
|
||||
|
@ -24,15 +24,15 @@ use crate::Int16;
|
||||
use crate::Int32;
|
||||
use crate::Int64;
|
||||
use crate::Int8;
|
||||
use snarkvm_gadgets::traits::alloc::AllocGadget;
|
||||
use snarkvm_gadgets::traits::boolean::AllocatedBit;
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_gadgets::traits::select::CondSelectGadget;
|
||||
use snarkvm_models::curves::FpParameters;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::Assignment;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::r1cs::LinearCombination;
|
||||
use snarkvm_models::gadgets::utilities::alloc::AllocGadget;
|
||||
use snarkvm_models::gadgets::utilities::boolean::AllocatedBit;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_models::gadgets::utilities::select::CondSelectGadget;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
use std::iter;
|
||||
|
||||
|
@ -19,7 +19,7 @@ use crate::errors::SignedIntegerError;
|
||||
use crate::signed_integer::*;
|
||||
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
macro_rules! neg_int_impl {
|
||||
($($gadget: ident)*) => ($(
|
||||
|
@ -24,11 +24,11 @@ use crate::Int32;
|
||||
use crate::Int64;
|
||||
use crate::Int8;
|
||||
|
||||
use snarkvm_gadgets::traits::alloc::AllocGadget;
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_gadgets::traits::select::CondSelectGadget;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::alloc::AllocGadget;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_models::gadgets::utilities::select::CondSelectGadget;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
macro_rules! pow_int_impl {
|
||||
($($gadget:ty)*) => ($(
|
||||
|
@ -24,7 +24,7 @@ use crate::Int32;
|
||||
use crate::Int64;
|
||||
use crate::Int8;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
macro_rules! sub_int_impl {
|
||||
($($gadget: ident)*) => ($(
|
||||
|
@ -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::boolean::Boolean;
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
||||
|
@ -23,10 +23,10 @@ use crate::Int64;
|
||||
use crate::Int8;
|
||||
|
||||
use snarkvm_errors::gadgets::SynthesisError;
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_gadgets::traits::select::CondSelectGadget;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_models::gadgets::utilities::select::CondSelectGadget;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
use std::cmp::Ordering;
|
||||
|
||||
macro_rules! cmp_gadget_impl {
|
||||
|
@ -22,10 +22,10 @@ use crate::Int64;
|
||||
use crate::Int8;
|
||||
|
||||
use snarkvm_errors::gadgets::SynthesisError;
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_gadgets::traits::eq::EvaluateEqGadget;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_models::gadgets::utilities::eq::EvaluateEqGadget;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
macro_rules! eq_gadget_impl {
|
||||
($($gadget: ident)*) => ($(
|
||||
|
@ -25,10 +25,10 @@ use core::borrow::Borrow;
|
||||
use core::iter;
|
||||
use snarkvm_errors::gadgets::SynthesisError;
|
||||
use snarkvm_fields::Field;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::alloc::AllocGadget;
|
||||
use snarkvm_models::gadgets::utilities::boolean::AllocatedBit;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_gadgets::traits::alloc::AllocGadget;
|
||||
use snarkvm_gadgets::traits::boolean::AllocatedBit;
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
fn create_value<T: Borrow<bool>, I: IntoIterator<Item = Option<T>>, F: Field, CS: ConstraintSystem<F>>(
|
||||
cs: &mut CS,
|
||||
|
@ -17,10 +17,10 @@
|
||||
use crate::signed_integer::*;
|
||||
|
||||
use snarkvm_errors::gadgets::SynthesisError;
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_gadgets::traits::eq::ConditionalEqGadget;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_models::gadgets::utilities::eq::ConditionalEqGadget;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
macro_rules! cond_eq_int_impl {
|
||||
($($gadget: ident),*) => ($(
|
||||
|
@ -17,13 +17,13 @@
|
||||
use crate::signed_integer::*;
|
||||
|
||||
use snarkvm_errors::gadgets::SynthesisError;
|
||||
use snarkvm_gadgets::traits::alloc::AllocGadget;
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_gadgets::traits::eq::EqGadget;
|
||||
use snarkvm_gadgets::traits::select::CondSelectGadget;
|
||||
use snarkvm_models::curves::PrimeField;
|
||||
use snarkvm_models::gadgets::r1cs::Assignment;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::alloc::AllocGadget;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_models::gadgets::utilities::eq::EqGadget;
|
||||
use snarkvm_models::gadgets::utilities::select::CondSelectGadget;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
macro_rules! select_int_impl {
|
||||
($($gadget: ident)*) => ($(
|
||||
|
@ -17,13 +17,13 @@
|
||||
use leo_gadgets::arithmetic::*;
|
||||
use leo_gadgets::Int128;
|
||||
|
||||
use snarkvm_gadgets::traits::alloc::AllocGadget;
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_models::curves::One;
|
||||
use snarkvm_models::curves::Zero;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::r1cs::Fr;
|
||||
use snarkvm_models::gadgets::r1cs::TestConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::alloc::AllocGadget;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
use rand::Rng;
|
||||
use rand_core::SeedableRng;
|
||||
|
@ -17,13 +17,13 @@
|
||||
use leo_gadgets::arithmetic::*;
|
||||
use leo_gadgets::Int16;
|
||||
|
||||
use snarkvm_gadgets::traits::alloc::AllocGadget;
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_models::curves::One;
|
||||
use snarkvm_models::curves::Zero;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::r1cs::Fr;
|
||||
use snarkvm_models::gadgets::r1cs::TestConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::alloc::AllocGadget;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
use rand::Rng;
|
||||
use rand_core::SeedableRng;
|
||||
|
@ -17,13 +17,13 @@
|
||||
use leo_gadgets::arithmetic::*;
|
||||
use leo_gadgets::Int32;
|
||||
|
||||
use snarkvm_gadgets::traits::alloc::AllocGadget;
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_models::curves::One;
|
||||
use snarkvm_models::curves::Zero;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::r1cs::Fr;
|
||||
use snarkvm_models::gadgets::r1cs::TestConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::alloc::AllocGadget;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
use rand::Rng;
|
||||
use rand_core::SeedableRng;
|
||||
|
@ -17,12 +17,12 @@
|
||||
use leo_gadgets::arithmetic::*;
|
||||
use leo_gadgets::Int64;
|
||||
|
||||
use snarkvm_gadgets::traits::alloc::AllocGadget;
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_models::curves::One;
|
||||
use snarkvm_models::curves::Zero;
|
||||
use snarkvm_models::gadgets::r1cs::Fr;
|
||||
use snarkvm_models::gadgets::r1cs::TestConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::alloc::AllocGadget;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
use rand::Rng;
|
||||
|
@ -17,13 +17,13 @@
|
||||
use leo_gadgets::arithmetic::*;
|
||||
use leo_gadgets::Int8;
|
||||
|
||||
use snarkvm_gadgets::traits::alloc::AllocGadget;
|
||||
use snarkvm_gadgets::traits::boolean::Boolean;
|
||||
use snarkvm_models::curves::One;
|
||||
use snarkvm_models::curves::Zero;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::r1cs::Fr;
|
||||
use snarkvm_models::gadgets::r1cs::TestConstraintSystem;
|
||||
use snarkvm_models::gadgets::utilities::alloc::AllocGadget;
|
||||
use snarkvm_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
use rand::Rng;
|
||||
use rand_core::SeedableRng;
|
||||
|
@ -35,7 +35,7 @@ use leo_synthesizer::SerializedCircuit;
|
||||
use anyhow::Result;
|
||||
use snarkvm_curves::bls12_377::Bls12_377;
|
||||
use snarkvm_curves::edwards_bls12::Fq;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
use structopt::StructOpt;
|
||||
use tracing::span::Span;
|
||||
|
||||
|
@ -16,12 +16,12 @@
|
||||
|
||||
use snarkvm_errors::gadgets::SynthesisError;
|
||||
use snarkvm_fields::Field;
|
||||
use snarkvm_gadgets::traits::OptionalVec;
|
||||
use snarkvm_models::curves::PairingEngine;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::r1cs::Index;
|
||||
use snarkvm_models::gadgets::r1cs::LinearCombination;
|
||||
use snarkvm_models::gadgets::r1cs::Variable;
|
||||
use snarkvm_models::gadgets::utilities::OptionalVec;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct Namespace {
|
||||
|
@ -20,10 +20,10 @@ use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use snarkvm_curves::bls12_377::Bls12_377;
|
||||
use snarkvm_errors::curves::FieldError;
|
||||
use snarkvm_gadgets::traits::OptionalVec;
|
||||
use snarkvm_models::curves::PairingEngine;
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkvm_models::gadgets::r1cs::Index;
|
||||
use snarkvm_models::gadgets::utilities::OptionalVec;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
use crate::CircuitSynthesizer;
|
||||
use crate::SerializedField;
|
||||
|
Loading…
Reference in New Issue
Block a user