diff --git a/src/polynomial/commitment.rs b/src/polynomial/commitment.rs index 06194ad9..9eee99cc 100644 --- a/src/polynomial/commitment.rs +++ b/src/polynomial/commitment.rs @@ -10,7 +10,7 @@ use crate::merkle_tree::MerkleTree; use crate::plonk_challenger::Challenger; use crate::plonk_common::reduce_with_powers; use crate::polynomial::polynomial::PolynomialCoeffs; -use crate::proof::{FriProof, Hash, OpeningSet}; +use crate::proof::{FriProof, FriProofTarget, Hash, OpeningSet}; use crate::timed; use crate::util::{log2_strict, reverse_index_bits_in_place, transpose}; @@ -272,6 +272,10 @@ impl, const D: usize> OpeningProof { } } +pub struct OpeningProofTarget { + fri_proof: FriProofTarget, +} + #[cfg(test)] mod tests { use anyhow::Result; diff --git a/src/proof.rs b/src/proof.rs index 46288808..332eb941 100644 --- a/src/proof.rs +++ b/src/proof.rs @@ -1,8 +1,10 @@ +use crate::field::extension_field::target::ExtensionTarget; use crate::field::extension_field::Extendable; use crate::field::field::Field; use crate::fri::FriConfig; +use crate::gadgets::polynomial::PolynomialCoeffsExtTarget; use crate::merkle_proofs::{MerkleProof, MerkleProofTarget}; -use crate::polynomial::commitment::{ListPolynomialCommitment, OpeningProof}; +use crate::polynomial::commitment::{ListPolynomialCommitment, OpeningProof, OpeningProofTarget}; use crate::polynomial::polynomial::PolynomialCoeffs; use crate::target::Target; use std::convert::TryInto; @@ -63,39 +65,33 @@ pub struct Proof, const D: usize> { pub plonk_zs_root: Hash, /// Merkle root of LDEs of the quotient polynomial components. pub quotient_polys_root: Hash, - /// Purported values of each polynomial at the challenge point. pub openings: OpeningSet, - /// A FRI argument for each FRI query. pub opening_proof: OpeningProof, } -pub struct ProofTarget { - /// Merkle root of LDEs of wire values. +pub struct ProofTarget { pub wires_root: HashTarget, - /// Merkle root of LDEs of Z, in the context of Plonk's permutation argument. pub plonk_zs_root: HashTarget, - /// Merkle root of LDEs of the quotient polynomial components. pub quotient_polys_root: HashTarget, - - /// Purported values of each polynomial at each challenge point. - pub openings: Vec, - - /// A FRI argument for each FRI query. - pub fri_proofs: Vec, + pub openings: Vec>, + pub opening_proof: Vec>, } /// Evaluations and Merkle proof produced by the prover in a FRI query step. -// TODO: Implement FriQueryStepTarget pub struct FriQueryStep, const D: usize> { pub evals: Vec, pub merkle_proof: MerkleProof, } +pub struct FriQueryStepTarget { + pub evals: Vec>, + pub merkle_proof: MerkleProofTarget, +} + /// Evaluations and Merkle proofs of the original set of polynomials, /// before they are combined into a composition polynomial. -// TODO: Implement FriInitialTreeProofTarget pub struct FriInitialTreeProof { pub evals_proofs: Vec<(Vec, MerkleProof)>, } @@ -107,13 +103,21 @@ impl FriInitialTreeProof { } } +pub struct FriInitialTreeProofTarget { + pub evals_proofs: Vec<(Vec, MerkleProofTarget)>, +} + /// Proof for a FRI query round. -// TODO: Implement FriQueryRoundTarget pub struct FriQueryRound, const D: usize> { pub initial_trees_proof: FriInitialTreeProof, pub steps: Vec>, } +pub struct FriQueryRoundTarget { + pub initial_trees_proof: FriInitialTreeProofTarget, + pub steps: Vec>, +} + pub struct FriProof, const D: usize> { /// A Merkle root for each reduced polynomial in the commit phase. pub commit_phase_merkle_roots: Vec>, @@ -125,16 +129,11 @@ pub struct FriProof, const D: usize> { pub pow_witness: F, } -/// Represents a single FRI query, i.e. a path through the reduction tree. -pub struct FriProofTarget { - /// A Merkle root for each reduced polynomial in the commit phase. +pub struct FriProofTarget { pub commit_phase_merkle_roots: Vec, - /// Merkle proofs for the original purported codewords, i.e. the subject of the LDT. - pub initial_merkle_proofs: Vec, - /// Merkle proofs for the reduced polynomials that were sent in the commit phase. - pub intermediate_merkle_proofs: Vec, - /// The final polynomial in coefficient form. - pub final_poly: Vec, + pub query_round_proofs: Vec>, + pub final_poly: PolynomialCoeffsExtTarget, + pub pow_witness: Target, } /// The purported values of each polynomial at a single point. @@ -175,10 +174,10 @@ impl, const D: usize> OpeningSet { } /// The purported values of each polynomial at a single point. -pub struct OpeningSetTarget { - pub constants: Vec, - pub plonk_sigmas: Vec, - pub wires: Vec, - pub plonk_zs: Vec, - pub quotient_polys: Vec, +pub struct OpeningSetTarget { + pub constants: Vec>, + pub plonk_sigmas: Vec>, + pub wires: Vec>, + pub plonk_zs: Vec>, + pub quotient_polys: Vec>, } diff --git a/src/recursive_verifier.rs b/src/recursive_verifier.rs index a9d37553..c1005a67 100644 --- a/src/recursive_verifier.rs +++ b/src/recursive_verifier.rs @@ -13,7 +13,7 @@ pub fn add_recursive_verifier, const D: usize>( inner_config: CircuitConfig, inner_circuit: VerifierCircuitTarget, inner_gates: Vec>, - inner_proof: ProofTarget, + inner_proof: ProofTarget, ) { assert!(builder.config.num_wires >= MIN_WIRES); assert!(builder.config.num_wires >= MIN_ROUTED_WIRES);