r1cs-std works with no-std (#92)

This commit is contained in:
Marek Kotewicz
2020-02-05 22:55:38 +01:00
committed by GitHub
parent a77972bf9a
commit 9621bd34a4
21 changed files with 104 additions and 74 deletions

View File

@@ -1,8 +1,8 @@
use algebra::{BitIterator, Field, FpParameters, PrimeField};
use crate::{prelude::*, Assignment};
use crate::{prelude::*, Assignment, Vec};
use core::borrow::Borrow;
use r1cs_core::{ConstraintSystem, ConstraintVar, LinearCombination, SynthesisError, Variable};
use std::borrow::Borrow;
/// Represents a variable in the constraint system which is guaranteed
/// to be either zero or one.
@@ -835,10 +835,10 @@ mod test {
use super::{AllocatedBit, Boolean};
use crate::{prelude::*, test_constraint_system::TestConstraintSystem};
use algebra::{fields::bls12_381::Fr, BitIterator, Field, One, PrimeField, UniformRand, Zero};
use core::str::FromStr;
use r1cs_core::ConstraintSystem;
use rand::SeedableRng;
use rand_xorshift::XorShiftRng;
use std::str::FromStr;
#[test]
fn test_boolean_to_byte() {

View File

@@ -1,4 +1,7 @@
use crate::bits::{boolean::Boolean, uint8::UInt8};
use crate::{
bits::{boolean::Boolean, uint8::UInt8},
Vec,
};
use algebra::Field;
use r1cs_core::{ConstraintSystem, SynthesisError};

View File

@@ -5,7 +5,7 @@ use r1cs_core::{ConstraintSystem, LinearCombination, SynthesisError};
use crate::{
boolean::{AllocatedBit, Boolean},
prelude::*,
Assignment,
Assignment, Vec,
};
/// Represents an interpretation of 32 `Boolean` objects as an
@@ -343,7 +343,7 @@ impl<ConstraintF: Field> ConditionalEqGadget<ConstraintF> for UInt32 {
#[cfg(test)]
mod test {
use super::UInt32;
use crate::{bits::boolean::Boolean, test_constraint_system::TestConstraintSystem};
use crate::{bits::boolean::Boolean, test_constraint_system::TestConstraintSystem, Vec};
use algebra::{fields::bls12_381::Fr, One, Zero};
use r1cs_core::ConstraintSystem;
use rand::{Rng, SeedableRng};

View File

@@ -2,8 +2,8 @@ use algebra::{Field, FpParameters, PrimeField, ToConstraintField};
use r1cs_core::{ConstraintSystem, SynthesisError};
use crate::{boolean::AllocatedBit, fields::fp::FpGadget, prelude::*, Assignment};
use std::borrow::Borrow;
use crate::{boolean::AllocatedBit, fields::fp::FpGadget, prelude::*, Assignment, Vec};
use core::borrow::Borrow;
/// Represents an interpretation of 8 `Boolean` objects as an
/// unsigned integer.
@@ -297,7 +297,7 @@ impl<ConstraintF: Field> AllocGadget<u8, ConstraintF> for UInt8 {
#[cfg(test)]
mod test {
use super::UInt8;
use crate::{prelude::*, test_constraint_system::TestConstraintSystem};
use crate::{prelude::*, test_constraint_system::TestConstraintSystem, Vec};
use algebra::fields::bls12_381::Fr;
use r1cs_core::ConstraintSystem;
use rand::{Rng, SeedableRng};