Skip to content

Commit

Permalink
Add ToConstraintFieldGadget bounds to CurveVar and FieldVar (#144)
Browse files Browse the repository at this point in the history
* Add `ToConstraintFieldGadget` bounds to `CurveVar` and `FieldVar`

* Update changelog

---------

Co-authored-by: Pratyush Mishra <[email protected]>
  • Loading branch information
winderica and Pratyush authored Oct 17, 2024
1 parent 8be4bfb commit f742abd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
- Add `UInt::rotate_{left,right}_in_place`.
- Add `{Boolean,UInt}::not_in_place`.
- Add `UInt::{from_bytes_le, from_bytes_be, to_bytes_be}`.
- [\#144](https://github.com/arkworks-rs/r1cs-std/pull/144)
- Add `ToConstraintFieldGadget` bounds to `CurveVar` and `FieldVar`

### Improvements

Expand Down
3 changes: 2 additions & 1 deletion src/fields/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use core::{
ops::{Add, AddAssign, Mul, MulAssign, Sub, SubAssign},
};

use crate::convert::{ToBitsGadget, ToBytesGadget};
use crate::convert::{ToBitsGadget, ToBytesGadget, ToConstraintFieldGadget};
use crate::prelude::*;

/// This module contains a generic implementation of cubic extension field
Expand Down Expand Up @@ -76,6 +76,7 @@ pub trait FieldVar<F: Field, ConstraintF: PrimeField>:
+ AllocVar<F, ConstraintF>
+ ToBytesGadget<ConstraintF>
+ CondSelectGadget<ConstraintF>
+ ToConstraintFieldGadget<ConstraintF>
+ for<'a> FieldOpsBounds<'a, F, Self>
+ for<'a> AddAssign<&'a Self>
+ for<'a> SubAssign<&'a Self>
Expand Down
3 changes: 2 additions & 1 deletion src/groups/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{
convert::{ToBitsGadget, ToBytesGadget},
convert::{ToBitsGadget, ToBytesGadget, ToConstraintFieldGadget},
fields::emulated_fp::EmulatedFpVar,
prelude::*,
};
Expand Down Expand Up @@ -41,6 +41,7 @@ pub trait CurveVar<C: CurveGroup, ConstraintF: PrimeField>:
+ CondSelectGadget<ConstraintF>
+ AllocVar<C, ConstraintF>
+ AllocVar<C::Affine, ConstraintF>
+ ToConstraintFieldGadget<ConstraintF>
+ for<'a> GroupOpsBounds<'a, C, Self>
+ for<'a> AddAssign<&'a Self>
+ for<'a> SubAssign<&'a Self>
Expand Down

0 comments on commit f742abd

Please sign in to comment.