pub struct BatchVerifier<S: PedersenSuite> { /* private fields */ }Expand description
Batch verifier for Pedersen VRF proofs.
Collects multiple proofs and verifies them together via a single multi-scalar multiplication.
The same subgroup membership assumptions as Verifier apply to all
points fed into the batch (I/O pairs and proof points).
Implementations§
Source§impl<S: PedersenSuite> BatchVerifier<S>
impl<S: PedersenSuite> BatchVerifier<S>
Sourcepub fn prepare(
ios: impl AsRef<[VrfIo<S>]>,
ad: impl AsRef<[u8]>,
proof: &Proof<S>,
) -> BatchItem<S>
pub fn prepare( ios: impl AsRef<[VrfIo<S>]>, ad: impl AsRef<[u8]>, proof: &Proof<S>, ) -> BatchItem<S>
Prepare a proof for batch verification.
Computes the challenge and packages all data needed for deferred verification. This is cheap (one hash, no scalar multiplications) and can be done in parallel.
Sourcepub fn push_prepared(&mut self, entry: BatchItem<S>)
pub fn push_prepared(&mut self, entry: BatchItem<S>)
Push a previously prepared entry into the batch.
Sourcepub fn push(
&mut self,
ios: impl AsRef<[VrfIo<S>]>,
ad: impl AsRef<[u8]>,
proof: &Proof<S>,
)
pub fn push( &mut self, ios: impl AsRef<[VrfIo<S>]>, ad: impl AsRef<[u8]>, proof: &Proof<S>, )
Prepare and push a proof in one step.
Sourcepub fn verify(&self) -> Result<(), Error>
pub fn verify(&self) -> Result<(), Error>
Batch-verify multiple Pedersen proofs using a single multi-scalar multiplication.
For each proof i, two equations are checked with independent random scalars t_i (eq1) and u_i (eq2): Eq1: O_ic_i + Ok_i == I_is_i Eq2: Yb_ic_i + R_i == Gs_i + B*sb_i
The random linear combination yields a (5N + 2)-point MSM.
Returns Ok(()) if all proofs verify, Err(VerificationFailure) otherwise.
Trait Implementations§
Source§impl<S: PedersenSuite> Default for BatchVerifier<S>
impl<S: PedersenSuite> Default for BatchVerifier<S>
Auto Trait Implementations§
impl<S> Freeze for BatchVerifier<S>
impl<S> RefUnwindSafe for BatchVerifier<S>where
<<S as Suite>::Affine as AffineRepr>::ScalarField: RefUnwindSafe,
<S as Suite>::Affine: RefUnwindSafe,
impl<S> Send for BatchVerifier<S>
impl<S> Sync for BatchVerifier<S>
impl<S> Unpin for BatchVerifier<S>
impl<S> UnsafeUnpin for BatchVerifier<S>
impl<S> UnwindSafe for BatchVerifier<S>where
<<S as Suite>::Affine as AffineRepr>::ScalarField: UnwindSafe,
<S as Suite>::Affine: 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> 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