halo2_axiom/poly/
strategy.rs

1use super::commitment::{CommitmentScheme, Verifier};
2use crate::plonk::Error;
3
4/// Guards is unfinished verification result. Implement this to construct various
5/// verification strategies such as aggregation and recursion.
6pub trait Guard<Scheme: CommitmentScheme> {
7    /// Multi scalar engine which is not evaluated yet.
8    type MSMAccumulator;
9}
10
11/// Trait representing a strategy for verifying Halo 2 proofs.
12pub trait VerificationStrategy<'params, Scheme: CommitmentScheme, V: Verifier<'params, Scheme>> {
13    /// The output type of this verification strategy after processing a proof.
14    type Output;
15
16    /// Creates new verification strategy instance
17    fn new(params: &'params Scheme::ParamsVerifier) -> Self;
18
19    /// Obtains an MSM from the verifier strategy and yields back the strategy's
20    /// output.
21    fn process(
22        self,
23        f: impl FnOnce(V::MSMAccumulator) -> Result<V::Guard, Error>,
24    ) -> Result<Self::Output, Error>;
25
26    /// Finalizes the batch and checks its validity.
27    ///
28    /// Returns `false` if *some* proof was invalid. If the caller needs to identify
29    /// specific failing proofs, it must re-process the proofs separately.
30    fn finalize(self) -> bool;
31}