pub struct BatchVerifier<S: ThinVrfSuite> { /* private fields */ }Expand description
Batch verifier for Thin 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 (public keys, I/O pairs, and proof points).
Implementations§
Source§impl<S: ThinVrfSuite> BatchVerifier<S>
impl<S: ThinVrfSuite> BatchVerifier<S>
Sourcepub fn prepare(
public: &Public<S>,
ios: impl AsRef<[VrfIo<S>]>,
ad: impl AsRef<[u8]>,
proof: &Proof<S>,
) -> BatchItem<S>
pub fn prepare( public: &Public<S>, ios: impl AsRef<[VrfIo<S>]>, ad: impl AsRef<[u8]>, proof: &Proof<S>, ) -> BatchItem<S>
Prepare a proof for batch verification.
Computes delinearization scalars and challenge via hashing only (no EC
ops). Stores the raw points and z scalars for the expanded verification
equation in Self::verify.
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,
public: &Public<S>,
ios: impl AsRef<[VrfIo<S>]>,
ad: impl AsRef<[u8]>,
proof: &Proof<S>,
)
pub fn push( &mut self, public: &Public<S>, 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 all collected proofs using a single multi-scalar multiplication.
For each proof j, the expanded verification equation is: R_j + c_jz0_jpk_j + sum_i(c_jz_ijO_ij) - s_jz0_jG - sum_i(s_jz_ijI_ij) == 0
With random weights w_j, G is accumulated as a shared base, yielding a
(sum_j(2 + 2*M_j) + 1)-point MSM (where M_j is the number of VRF
pairs in proof j).
Returns Ok(()) if all proofs verify, Err(VerificationFailure) otherwise.
Trait Implementations§
Source§impl<S: ThinVrfSuite> Default for BatchVerifier<S>
impl<S: ThinVrfSuite> 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