snarkvm_algorithms/srs/universal_verifier.rs
1// Copyright 2024 Aleo Network Foundation
2// This file is part of the snarkVM library.
3
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at:
7
8// http://www.apache.org/licenses/LICENSE-2.0
9
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16use crate::polycommit::kzg10;
17use snarkvm_curves::{PairingCurve, PairingEngine};
18
19use std::{collections::BTreeMap, sync::Arc};
20
21/// `UniversalVerifier` is used to check evaluation proofs for a given
22/// commitment.
23#[derive(Clone, Debug, Default, PartialEq, Eq)]
24pub struct UniversalVerifier<E: PairingEngine> {
25 /// The verification key for the underlying KZG10 scheme.
26 pub vk: kzg10::VerifierKey<E>,
27 /// Information required to enforce degree bounds. Each pair is of the form
28 /// `(degree_bound, shifting_advice)`. Each pair is in the form
29 /// `(degree_bound, \beta^{max_degree - i} H),` where `H` is the generator
30 /// of G2, and `i` is of the form `2^k - 1` for `k` in `1` to
31 /// `log_2(max_degree)`.
32 pub prepared_negative_powers_of_beta_h: Arc<BTreeMap<usize, <E::G2Affine as PairingCurve>::Prepared>>,
33}