mirror of
https://github.com/arnaucube/ark-r1cs-std.git
synced 2026-01-23 12:13:48 +01:00
Add ToConstraintFieldGadget (#278)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use algebra::{BitIteratorBE, Field};
|
||||
use algebra::{BitIteratorBE, Field, PrimeField};
|
||||
|
||||
use crate::{prelude::*, Assignment, Vec};
|
||||
use crate::{fields::fp::FpVar, prelude::*, Assignment, ToConstraintFieldGadget, Vec};
|
||||
use core::borrow::Borrow;
|
||||
use r1cs_core::{lc, ConstraintSystemRef, LinearCombination, Namespace, SynthesisError, Variable};
|
||||
|
||||
@@ -597,6 +597,14 @@ impl<F: Field> ToBytesGadget<F> for Boolean<F> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<F: PrimeField> ToConstraintFieldGadget<F> for Boolean<F> {
|
||||
#[tracing::instrument(target = "r1cs")]
|
||||
fn to_constraint_field(&self) -> Result<Vec<FpVar<F>>, SynthesisError> {
|
||||
let var = From::from(self.clone());
|
||||
Ok(vec![var])
|
||||
}
|
||||
}
|
||||
|
||||
impl<F: Field> CondSelectGadget<F> for Boolean<F> {
|
||||
#[tracing::instrument(target = "r1cs")]
|
||||
fn conditionally_select(
|
||||
|
||||
Reference in New Issue
Block a user