mirror of
https://github.com/arnaucube/ark-r1cs-std.git
synced 2026-01-12 08:51:35 +01:00
Adds alloc_constant to AllocGadget (#189)
* adds alloc constant to AllocGadget * fmt * fmt * more alloc constant impls * fmt * even more impls * fixes type * fixes alloc_constant in gm17 * uses alloc_constant from field gadget in group gadgets * fmt * handle most comments
This commit is contained in:
@@ -96,6 +96,21 @@ where
|
||||
GG: GroupGadget<G, ConstraintF>,
|
||||
D: Digest,
|
||||
{
|
||||
fn alloc_constant<T, CS: ConstraintSystem<ConstraintF>>(
|
||||
cs: CS,
|
||||
val: T,
|
||||
) -> Result<Self, SynthesisError>
|
||||
where
|
||||
T: Borrow<SchnorrSigParameters<G, D>>,
|
||||
{
|
||||
let generator = GG::alloc_constant(cs, val.borrow().generator)?;
|
||||
Ok(Self {
|
||||
generator,
|
||||
_engine: PhantomData,
|
||||
_group: PhantomData,
|
||||
})
|
||||
}
|
||||
|
||||
fn alloc<F, T, CS: ConstraintSystem<ConstraintF>>(cs: CS, f: F) -> Result<Self, SynthesisError>
|
||||
where
|
||||
F: FnOnce() -> Result<T, SynthesisError>,
|
||||
@@ -133,6 +148,21 @@ where
|
||||
ConstraintF: Field,
|
||||
GG: GroupGadget<G, ConstraintF>,
|
||||
{
|
||||
fn alloc_constant<T, CS: ConstraintSystem<ConstraintF>>(
|
||||
cs: CS,
|
||||
val: T,
|
||||
) -> Result<Self, SynthesisError>
|
||||
where
|
||||
T: Borrow<SchnorrPublicKey<G>>,
|
||||
{
|
||||
let pub_key = GG::alloc_constant(cs, val.borrow())?;
|
||||
Ok(Self {
|
||||
pub_key,
|
||||
_engine: PhantomData,
|
||||
_group: PhantomData,
|
||||
})
|
||||
}
|
||||
|
||||
fn alloc<F, T, CS: ConstraintSystem<ConstraintF>>(cs: CS, f: F) -> Result<Self, SynthesisError>
|
||||
where
|
||||
F: FnOnce() -> Result<T, SynthesisError>,
|
||||
|
||||
Reference in New Issue
Block a user