pub struct Setup<G> { /* private fields */ }Expand description
A setup decides on what group elements we use to commit to vectors and their product.
A setup for an inner product argument for c = <a_i, b_i> needs generators
to commit to a_i, which we call G_i, generators for b_i, which we call
H_i, and a generator for the product, c, which we call Q, or “the product generator”.
We can support inner products of different sizes, as long as we have enough generators.
To construct this type, see Self::new.
Implementations§
Source§impl<G> Setup<G>
impl<G> Setup<G>
Sourcepub fn new(
product_generator: G,
g_and_h: impl IntoIterator<Item = (G, G)>,
) -> Self
pub fn new( product_generator: G, g_and_h: impl IntoIterator<Item = (G, G)>, ) -> Self
Create a new Setup, given specific choices of the generator.
You MUST ensure that all of the values provided to this function are unique.
Sourcepub const fn product_generator(&self) -> &G
pub const fn product_generator(&self) -> &G
The product generator Q.
Sourcepub const fn supports(&self, lg_len: u8) -> bool
pub const fn supports(&self, lg_len: u8) -> bool
Check if this setup supports claims of a given length.
Sourcepub fn eval<F: Field>(
&self,
f: impl FnOnce(&Setup<Synthetic<F, G>>) -> Option<Synthetic<F, G>>,
strategy: &impl Strategy,
) -> Option<G>where
G: Space<F>,
pub fn eval<F: Field>(
&self,
f: impl FnOnce(&Setup<Synthetic<F, G>>) -> Option<Synthetic<F, G>>,
strategy: &impl Strategy,
) -> Option<G>where
G: Space<F>,
Build a virtual setup, call f to obtain a verification equation,
and evaluate it against the concrete generators in self.
Returns None when f returns None (malformed proof).
Otherwise returns the evaluated group element, which should be
zero for a valid proof.
Trait Implementations§
Source§impl<G: EncodeSize> EncodeSize for Setup<G>
impl<G: EncodeSize> EncodeSize for Setup<G>
Source§fn encode_size(&self) -> usize
fn encode_size(&self) -> usize
Source§fn encode_inline_size(&self) -> usize
fn encode_inline_size(&self) -> usize
BufsMut::push
during Write::write_bufs. Used to size the working buffer for inline
writes. Override alongside Write::write_bufs for types where large
Bytes fields go via push; failing to do so will over-allocate.Source§impl<G: Read> Read for Setup<G>
impl<G: Read> Read for Setup<G>
Source§impl<G: Write> Write for Setup<G>
impl<G: Write> Write for Setup<G>
Source§fn write_bufs(&self, buf: &mut impl BufsMut)
fn write_bufs(&self, buf: &mut impl BufsMut)
BufsMut, allowing existing Bytes chunks to be
appended via BufsMut::push instead of written inline. Must encode
to the same format as Write::write. Defaults to Write::write.impl<G> StructuralPartialEq for Setup<G>
Auto Trait Implementations§
impl<G> Freeze for Setup<G>where
G: Freeze,
impl<G> RefUnwindSafe for Setup<G>where
G: RefUnwindSafe,
impl<G> Send for Setup<G>where
G: Send,
impl<G> Sync for Setup<G>where
G: Sync,
impl<G> Unpin for Setup<G>where
G: Unpin,
impl<G> UnsafeUnpin for Setup<G>where
G: UnsafeUnpin,
impl<G> UnwindSafe for Setup<G>where
G: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Encode for Twhere
T: Write + EncodeSize,
impl<T> Encode for Twhere
T: Write + EncodeSize,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more