Skip to content

Commit f742abd

Browse files
windericaPratyush
andauthored
Add ToConstraintFieldGadget bounds to CurveVar and FieldVar (#144)
* Add `ToConstraintFieldGadget` bounds to `CurveVar` and `FieldVar` * Update changelog --------- Co-authored-by: Pratyush Mishra <[email protected]>
1 parent 8be4bfb commit f742abd

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
- Add `UInt::rotate_{left,right}_in_place`.
2424
- Add `{Boolean,UInt}::not_in_place`.
2525
- Add `UInt::{from_bytes_le, from_bytes_be, to_bytes_be}`.
26+
- [\#144](https://github.com/arkworks-rs/r1cs-std/pull/144)
27+
- Add `ToConstraintFieldGadget` bounds to `CurveVar` and `FieldVar`
2628

2729
### Improvements
2830

src/fields/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use core::{
55
ops::{Add, AddAssign, Mul, MulAssign, Sub, SubAssign},
66
};
77

8-
use crate::convert::{ToBitsGadget, ToBytesGadget};
8+
use crate::convert::{ToBitsGadget, ToBytesGadget, ToConstraintFieldGadget};
99
use crate::prelude::*;
1010

1111
/// This module contains a generic implementation of cubic extension field
@@ -76,6 +76,7 @@ pub trait FieldVar<F: Field, ConstraintF: PrimeField>:
7676
+ AllocVar<F, ConstraintF>
7777
+ ToBytesGadget<ConstraintF>
7878
+ CondSelectGadget<ConstraintF>
79+
+ ToConstraintFieldGadget<ConstraintF>
7980
+ for<'a> FieldOpsBounds<'a, F, Self>
8081
+ for<'a> AddAssign<&'a Self>
8182
+ for<'a> SubAssign<&'a Self>

src/groups/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::{
2-
convert::{ToBitsGadget, ToBytesGadget},
2+
convert::{ToBitsGadget, ToBytesGadget, ToConstraintFieldGadget},
33
fields::emulated_fp::EmulatedFpVar,
44
prelude::*,
55
};
@@ -41,6 +41,7 @@ pub trait CurveVar<C: CurveGroup, ConstraintF: PrimeField>:
4141
+ CondSelectGadget<ConstraintF>
4242
+ AllocVar<C, ConstraintF>
4343
+ AllocVar<C::Affine, ConstraintF>
44+
+ ToConstraintFieldGadget<ConstraintF>
4445
+ for<'a> GroupOpsBounds<'a, C, Self>
4546
+ for<'a> AddAssign<&'a Self>
4647
+ for<'a> SubAssign<&'a Self>

0 commit comments

Comments
 (0)