Struct snarkvm_algorithms::snark::marlin::ahp::ahp::AHPForR1CS
source · pub struct AHPForR1CS<F: Field, MM: MarlinMode> { /* private fields */ }
Expand description
The algebraic holographic proof defined in CHMMVW19. Currently, this AHP only supports inputs of size one less than a power of 2 (i.e., of the form 2^n - 1).
Implementations§
source§impl<F: PrimeField, MM: MarlinMode> AHPForR1CS<F, MM>
impl<F: PrimeField, MM: MarlinMode> AHPForR1CS<F, MM>
sourcepub const LC_WITH_ZERO_EVAL: [&'static str; 2] = _
pub const LC_WITH_ZERO_EVAL: [&'static str; 2] = _
The linear combinations that are statically known to evaluate to zero. These correspond to the virtual commitments as noted in the Aleo marlin protocol docs
pub fn zk_bound() -> Option<usize>
sourcepub fn num_formatted_public_inputs_is_admissible(
num_inputs: usize
) -> Result<(), AHPError>
pub fn num_formatted_public_inputs_is_admissible( num_inputs: usize ) -> Result<(), AHPError>
Check that the (formatted) public input is of the form 2^n for some integer n.
sourcepub fn formatted_public_input_is_admissible(input: &[F]) -> Result<(), AHPError>
pub fn formatted_public_input_is_admissible(input: &[F]) -> Result<(), AHPError>
Check that the (formatted) public input is of the form 2^n for some integer n.
sourcepub fn max_degree(
num_constraints: usize,
num_variables: usize,
num_non_zero: usize
) -> Result<usize, AHPError>
pub fn max_degree( num_constraints: usize, num_variables: usize, num_non_zero: usize ) -> Result<usize, AHPError>
The maximum degree of polynomials produced by the indexer and prover of this protocol. The number of the variables must include the “one” variable. That is, it must be with respect to the number of formatted public inputs.
sourcepub fn get_degree_bounds(info: &CircuitInfo) -> [usize; 4]
pub fn get_degree_bounds(info: &CircuitInfo) -> [usize; 4]
Get all the strict degree bounds enforced in the AHP.
pub fn fft_precomputation( constraint_domain_size: usize, non_zero_a_domain_size: usize, non_zero_b_domain_size: usize, non_zero_c_domain_size: usize ) -> Option<(FFTPrecomputation<F>, IFFTPrecomputation<F>)>
sourcepub fn construct_linear_combinations<E: EvaluationsProvider<F>>(
public_inputs: &BTreeMap<CircuitId, Vec<Vec<F>>>,
evals: &E,
prover_third_message: &ThirdMessage<F>,
state: &State<F, MM>
) -> Result<BTreeMap<String, LinearCombination<F>>, AHPError>
pub fn construct_linear_combinations<E: EvaluationsProvider<F>>( public_inputs: &BTreeMap<CircuitId, Vec<Vec<F>>>, evals: &E, prover_third_message: &ThirdMessage<F>, state: &State<F, MM> ) -> Result<BTreeMap<String, LinearCombination<F>>, AHPError>
Construct the linear combinations that are checked by the AHP. Public input should be unformatted. We construct the linear combinations as per section 5 of our protocol documentation. We can distinguish between: (1) simple comitments: ${\cm{g_A}, \cm{g_B}, \cm{g_C}}$ and ${\cm{\hat{z}{B,i,j}}}{i \in {[\mathcal{D}]}}$, $\cm{g_1}$ (2) virtual commitments for the lincheck_sumcheck and matrix_sumcheck. These are linear combinations of the simple commitments
source§impl<F: PrimeField, MM: MarlinMode> AHPForR1CS<F, MM>
impl<F: PrimeField, MM: MarlinMode> AHPForR1CS<F, MM>
sourcepub fn index<C: ConstraintSynthesizer<F>>(c: &C) -> Result<Circuit<F, MM>>
pub fn index<C: ConstraintSynthesizer<F>>(c: &C) -> Result<Circuit<F, MM>>
Generate the index for this constraint system.
pub fn index_polynomial_info<'a>( circuit_ids: impl Iterator<Item = &'a CircuitId> + 'a ) -> BTreeMap<PolynomialLabel, PolynomialInfo>
pub fn index_polynomial_labels<'a>( matrices: &'a [&str], ids: impl Iterator<Item = &'a CircuitId> + 'a ) -> impl Iterator<Item = PolynomialLabel> + 'a
pub fn evaluate_index_polynomials<C: ConstraintSynthesizer<F>>( c: &C, id: &CircuitId, point: F ) -> Result<impl Iterator<Item = F>, AHPError>
source§impl<F: PrimeField, MM: MarlinMode> AHPForR1CS<F, MM>
impl<F: PrimeField, MM: MarlinMode> AHPForR1CS<F, MM>
sourcepub fn num_first_round_oracles(total_batch_size: usize) -> usize
pub fn num_first_round_oracles(total_batch_size: usize) -> usize
Output the number of oracles sent by the prover in the first round.
sourcepub fn first_round_polynomial_info<'a>(
circuits: impl Iterator<Item = (&'a CircuitId, &'a usize)>
) -> BTreeMap<PolynomialLabel, PolynomialInfo>
pub fn first_round_polynomial_info<'a>( circuits: impl Iterator<Item = (&'a CircuitId, &'a usize)> ) -> BTreeMap<PolynomialLabel, PolynomialInfo>
Output the degree bounds of oracles in the first round.
source§impl<F: PrimeField, MM: MarlinMode> AHPForR1CS<F, MM>
impl<F: PrimeField, MM: MarlinMode> AHPForR1CS<F, MM>
sourcepub fn num_fourth_round_oracles() -> usize
pub fn num_fourth_round_oracles() -> usize
Output the number of oracles sent by the prover in the third round.
sourcepub fn prover_fourth_round<R: RngCore>(
verifier_message: ThirdMessage<F>,
state: State<'_, F, MM>,
_r: &mut R
) -> Result<FourthOracles<F>, AHPError>
pub fn prover_fourth_round<R: RngCore>( verifier_message: ThirdMessage<F>, state: State<'_, F, MM>, _r: &mut R ) -> Result<FourthOracles<F>, AHPError>
Output the fourth round message and the next state.
sourcepub fn fourth_round_polynomial_info(
) -> BTreeMap<PolynomialLabel, PolynomialInfo>
pub fn fourth_round_polynomial_info( ) -> BTreeMap<PolynomialLabel, PolynomialInfo>
Output the degree bounds of oracles in the third round.
source§impl<F: PrimeField, MM: MarlinMode> AHPForR1CS<F, MM>
impl<F: PrimeField, MM: MarlinMode> AHPForR1CS<F, MM>
sourcepub fn num_second_round_oracles() -> usize
pub fn num_second_round_oracles() -> usize
Output the number of oracles sent by the prover in the second round.
sourcepub fn second_round_polynomial_info(
constraint_domain_size: usize
) -> BTreeMap<PolynomialLabel, PolynomialInfo>
pub fn second_round_polynomial_info( constraint_domain_size: usize ) -> BTreeMap<PolynomialLabel, PolynomialInfo>
Output the degree bounds of oracles in the first round.
sourcepub fn prover_second_round<'a, R: RngCore>(
verifier_message: &FirstMessage<F>,
state: State<'a, F, MM>,
_r: &mut R
) -> (SecondOracles<F>, State<'a, F, MM>)
pub fn prover_second_round<'a, R: RngCore>( verifier_message: &FirstMessage<F>, state: State<'a, F, MM>, _r: &mut R ) -> (SecondOracles<F>, State<'a, F, MM>)
Output the second round message and the next state.
source§impl<F: PrimeField, MM: MarlinMode> AHPForR1CS<F, MM>
impl<F: PrimeField, MM: MarlinMode> AHPForR1CS<F, MM>
sourcepub fn num_third_round_oracles(circuits: usize) -> usize
pub fn num_third_round_oracles(circuits: usize) -> usize
Output the number of oracles sent by the prover in the third round.
sourcepub fn third_round_polynomial_info<'a>(
circuits: impl Iterator<Item = (CircuitId, &'a CircuitInfo)>
) -> BTreeMap<PolynomialLabel, PolynomialInfo>
pub fn third_round_polynomial_info<'a>( circuits: impl Iterator<Item = (CircuitId, &'a CircuitInfo)> ) -> BTreeMap<PolynomialLabel, PolynomialInfo>
Output the degree bounds of oracles in the third round.
source§impl<F: PrimeField, MM: MarlinMode> AHPForR1CS<F, MM>
impl<F: PrimeField, MM: MarlinMode> AHPForR1CS<F, MM>
sourcepub fn init_prover<'a, C: ConstraintSynthesizer<F>>(
circuits_to_constraints: &BTreeMap<&'a Circuit<F, MM>, &[C]>
) -> Result<State<'a, F, MM>, AHPError>
pub fn init_prover<'a, C: ConstraintSynthesizer<F>>( circuits_to_constraints: &BTreeMap<&'a Circuit<F, MM>, &[C]> ) -> Result<State<'a, F, MM>, AHPError>
Initialize the AHP prover.
source§impl<TargetField: PrimeField, MM: MarlinMode> AHPForR1CS<TargetField, MM>
impl<TargetField: PrimeField, MM: MarlinMode> AHPForR1CS<TargetField, MM>
sourcepub fn verifier_first_round<BaseField: PrimeField, R: AlgebraicSponge<BaseField, 2>>(
batch_sizes: &BTreeMap<CircuitId, usize>,
circuit_infos: &BTreeMap<CircuitId, &CircuitInfo>,
max_constraint_domain: EvaluationDomain<TargetField>,
largest_non_zero_domain: EvaluationDomain<TargetField>,
fs_rng: &mut R
) -> Result<(FirstMessage<TargetField>, State<TargetField, MM>), AHPError>
pub fn verifier_first_round<BaseField: PrimeField, R: AlgebraicSponge<BaseField, 2>>( batch_sizes: &BTreeMap<CircuitId, usize>, circuit_infos: &BTreeMap<CircuitId, &CircuitInfo>, max_constraint_domain: EvaluationDomain<TargetField>, largest_non_zero_domain: EvaluationDomain<TargetField>, fs_rng: &mut R ) -> Result<(FirstMessage<TargetField>, State<TargetField, MM>), AHPError>
Output the first message and next round state.
sourcepub fn verifier_second_round<BaseField: PrimeField, R: AlgebraicSponge<BaseField, 2>>(
state: State<TargetField, MM>,
fs_rng: &mut R
) -> Result<(SecondMessage<TargetField>, State<TargetField, MM>), AHPError>
pub fn verifier_second_round<BaseField: PrimeField, R: AlgebraicSponge<BaseField, 2>>( state: State<TargetField, MM>, fs_rng: &mut R ) -> Result<(SecondMessage<TargetField>, State<TargetField, MM>), AHPError>
Output the second message and next round state.
sourcepub fn verifier_third_round<BaseField: PrimeField, R: AlgebraicSponge<BaseField, 2>>(
state: State<TargetField, MM>,
fs_rng: &mut R
) -> Result<(ThirdMessage<TargetField>, State<TargetField, MM>), AHPError>
pub fn verifier_third_round<BaseField: PrimeField, R: AlgebraicSponge<BaseField, 2>>( state: State<TargetField, MM>, fs_rng: &mut R ) -> Result<(ThirdMessage<TargetField>, State<TargetField, MM>), AHPError>
Output the third message and next round state.
sourcepub fn verifier_fourth_round<BaseField: PrimeField, R: AlgebraicSponge<BaseField, 2>>(
state: State<TargetField, MM>,
fs_rng: &mut R
) -> Result<State<TargetField, MM>, AHPError>
pub fn verifier_fourth_round<BaseField: PrimeField, R: AlgebraicSponge<BaseField, 2>>( state: State<TargetField, MM>, fs_rng: &mut R ) -> Result<State<TargetField, MM>, AHPError>
Output the next round state.
sourcepub fn verifier_query_set(
state: State<TargetField, MM>
) -> (QuerySet<TargetField>, State<TargetField, MM>)
pub fn verifier_query_set( state: State<TargetField, MM> ) -> (QuerySet<TargetField>, State<TargetField, MM>)
Output the query state and next round state.