Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::ECCVMProver Class Reference

#include <eccvm_prover.hpp>

Public Types

using Flavor = ECCVMFlavor
 
using FF = Flavor::FF
 
using BF = Flavor::BF
 
using Commitment = Flavor::Commitment
 
using PCS = Flavor::PCS
 
using CommitmentKey = Flavor::CommitmentKey
 
using ProvingKey = Flavor::ProvingKey
 
using Polynomial = Flavor::Polynomial
 
using CommitmentLabels = Flavor::CommitmentLabels
 
using Transcript = Flavor::Transcript
 
using TranslationEvaluations = bb::TranslationEvaluations_< FF >
 
using CircuitBuilder = Flavor::CircuitBuilder
 
using ZKData = ZKSumcheckData< Flavor >
 
using SmallSubgroupIPA = SmallSubgroupIPAProver< Flavor >
 
using OpeningClaim = ProverOpeningClaim< Flavor::Curve >
 

Public Member Functions

 ECCVMProver (CircuitBuilder &builder, const std::shared_ptr< Transcript > &transcript, const std::shared_ptr< Transcript > &ipa_transcript=std::make_shared< Transcript >())
 
BB_PROFILE void execute_preamble_round ()
 Fiat-Shamir the VK.
 
BB_PROFILE void execute_wire_commitments_round ()
 Compute commitments to the first three wires.
 
BB_PROFILE void execute_log_derivative_commitments_round ()
 Compute sorted witness-table accumulator.
 
BB_PROFILE void execute_grand_product_computation_round ()
 Compute permutation and lookup grand product polynomials and commitments.
 
BB_PROFILE void execute_relation_check_rounds ()
 Run Sumcheck resulting in u = (u_1,...,u_d) challenges and all evaluations at u being calculated.
 
BB_PROFILE void execute_pcs_rounds ()
 Produce a univariate opening claim for the sumcheck multivariate evalutions and a batched univariate claim for the transcript polynomials (for the Translator consistency check). Reduce the two opening claims to a single one via Shplonk and produce an opening proof with the univariate PCS of choice (IPA when operating on Grumpkin).
 
BB_PROFILE void execute_transcript_consistency_univariate_opening_round ()
 
ECCVMProof export_proof ()
 
ECCVMProof construct_proof ()
 
void compute_translation_opening_claims ()
 To link the ECCVM Transcript wires op, Px, Py, z1, and z2 to the accumulator computed by the translator, we verify their evaluations as univariates. For efficiency reasons, we batch these evaluations.
 
void commit_to_witness_polynomial (Polynomial &polynomial, const std::string &label, CommitmentKey::CommitType commit_type=CommitmentKey::CommitType::Default, const std::vector< std::pair< size_t, size_t > > &active_ranges={})
 Utility to mask and commit to a witness polynomial and send the commitment to verifier.
 

Public Attributes

std::shared_ptr< Transcripttranscript
 
std::shared_ptr< Transcriptipa_transcript
 
size_t unmasked_witness_size
 
std::array< OpeningClaim, NUM_OPENING_CLAIMSopening_claims
 
TranslationEvaluations translation_evaluations
 
std::vector< FFpublic_inputs
 
bb::RelationParameters< FFrelation_parameters
 
std::shared_ptr< ProvingKeykey
 
CommitmentLabels commitment_labels
 
ZKData zk_sumcheck_data
 
FF evaluation_challenge_x
 
FF batching_challenge_v
 
SumcheckOutput< Flavorsumcheck_output
 

Static Public Attributes

static constexpr size_t NUM_OPENING_CLAIMS = ECCVMFlavor::NUM_TRANSLATION_OPENING_CLAIMS + 1
 

Detailed Description

Definition at line 22 of file eccvm_prover.hpp.

Member Typedef Documentation

◆ BF

Definition at line 26 of file eccvm_prover.hpp.

◆ CircuitBuilder

◆ Commitment

◆ CommitmentKey

◆ CommitmentLabels

◆ FF

Definition at line 25 of file eccvm_prover.hpp.

◆ Flavor

Definition at line 24 of file eccvm_prover.hpp.

◆ OpeningClaim

◆ PCS

Definition at line 28 of file eccvm_prover.hpp.

◆ Polynomial

◆ ProvingKey

◆ SmallSubgroupIPA

◆ Transcript

◆ TranslationEvaluations

◆ ZKData

Definition at line 36 of file eccvm_prover.hpp.

Constructor & Destructor Documentation

◆ ECCVMProver()

bb::ECCVMProver::ECCVMProver ( CircuitBuilder builder,
const std::shared_ptr< Transcript > &  transcript,
const std::shared_ptr< Transcript > &  ipa_transcript = std::make_shared<Transcript>() 
)
explicit

Definition at line 21 of file eccvm_prover.cpp.

Member Function Documentation

◆ commit_to_witness_polynomial()

void bb::ECCVMProver::commit_to_witness_polynomial ( Polynomial polynomial,
const std::string &  label,
CommitmentKey::CommitType  commit_type = CommitmentKey::CommitType::Default,
const std::vector< std::pair< size_t, size_t > > &  active_ranges = {} 
)

Utility to mask and commit to a witness polynomial and send the commitment to verifier.

Parameters
polynomial
label

Definition at line 342 of file eccvm_prover.cpp.

◆ compute_translation_opening_claims()

void bb::ECCVMProver::compute_translation_opening_claims ( )

To link the ECCVM Transcript wires op, Px, Py, z1, and z2 to the accumulator computed by the translator, we verify their evaluations as univariates. For efficiency reasons, we batch these evaluations.

As a sub-protocol of ECCVM, we are batch opening the op, Px, Py, z1, and z2 wires as univariates (as opposed to their openings as multilinears performed after Sumcheck). We often refer to these polynomials as translation_polynomials \( T_i \) for \( i=0, \ldots, 4\). Below, the evaluation_challenge_x is denoted by \( x \) and batching_challenge_v is denoted by \(v\).

The batched translation evaluation

\begin{align} \sum_{i=0}^4 T_i(x) \cdot v^i \end{align}

is used by the TranslatorVerifier to bind the ECCOpQueues over BN254 and Grumpkin. Namely, we check that the field element \( A = \text{accumulated_result} \) accumulated from the Ultra ECCOpQueue by TranslatorProver satisfies

\begin{align} x\cdot A = \sum_{i=0}^4 T_i(x) \cdot v^i, \end{align}

where \( x \) is an artifact of our implementation of shiftable polynomials.

This check gets trickier when the witness wires in ECCVM are masked. Namely, we randomize the last \( \text{NUM_DISABLED_ROWS_IN_SUMCHECK} \) coefficients of \( T_i \). Let \( N = \text{circuit_size} - \text{NUM_DISABLED_ROWS_IN_SUMCHECK}\). Denote

\begin{align} \widetilde{T}_i(X) = T_i(X) + X^N \cdot m_i(X). \end{align}

Informally speaking, to preserve ZK, the ECCVMVerifier must never obtain the commitments to \( T_i \) or the evaluations \( T_i(x) \) of the unmasked wires.

With masking, the identity above becomes

\begin{align} x\cdot A = \sum_i (\widetilde{T}_i - X^N \cdot m_i(X)) v^i =\sum_i \widetilde{T}_i v^i - X^N \cdot \sum_i m_i(X) v^i \end{align}

The prover could send the evals of \( \widetilde{T}_i \) without revealing witness information. Moreover, the prover could prove the evaluation \( x^N \cdot \sum m_i(x) v^i \) using SmallSubgroupIPA argument. Namely, before obtaining \( x \) and \( v \), the prover sends a commitment to the polynomial \( \widetilde{M} = M + Z_H \cdot R\), where the coefficients of \( M \) are given by the concatenation

\begin{align} M = (m_0||m_1||m_2||m_3||m_4 || \vec{0}) \end{align}

in the Lagrange basis over the small multiplicative subgroup \( H \), where \( Z_H \) is the vanishing polynomial \( X^{|H|} -1 \) and \( R(X) \) is a random polynomial of degree \( 2 \). SmallSubgroupIPAProver allows us to prove the inner product of \( M \) against the challenge_polynomial

\begin{align} ( 1, x , x^2 , x^3, v , v\cdot x ,\ldots, ... , v^4, v^4 x , v^4 x^2 , v^4 x^3, \vec{0} )\end{align}

without revealing any other witness information apart from the claimed inner product.

Returns
Ppopulate opening_claims.

Definition at line 266 of file eccvm_prover.cpp.

◆ construct_proof()

ECCVMProof bb::ECCVMProver::construct_proof ( )

Definition at line 208 of file eccvm_prover.cpp.

◆ execute_grand_product_computation_round()

void bb::ECCVMProver::execute_grand_product_computation_round ( )

Compute permutation and lookup grand product polynomials and commitments.

Definition at line 117 of file eccvm_prover.cpp.

◆ execute_log_derivative_commitments_round()

void bb::ECCVMProver::execute_log_derivative_commitments_round ( )

Compute sorted witness-table accumulator.

Definition at line 90 of file eccvm_prover.cpp.

◆ execute_pcs_rounds()

void bb::ECCVMProver::execute_pcs_rounds ( )

Produce a univariate opening claim for the sumcheck multivariate evalutions and a batched univariate claim for the transcript polynomials (for the Translator consistency check). Reduce the two opening claims to a single one via Shplonk and produce an opening proof with the univariate PCS of choice (IPA when operating on Grumpkin).

Definition at line 161 of file eccvm_prover.cpp.

◆ execute_preamble_round()

void bb::ECCVMProver::execute_preamble_round ( )

Fiat-Shamir the VK.

Definition at line 42 of file eccvm_prover.cpp.

◆ execute_relation_check_rounds()

void bb::ECCVMProver::execute_relation_check_rounds ( )

Run Sumcheck resulting in u = (u_1,...,u_d) challenges and all evaluations at u being calculated.

Definition at line 128 of file eccvm_prover.cpp.

◆ execute_transcript_consistency_univariate_opening_round()

BB_PROFILE void bb::ECCVMProver::execute_transcript_consistency_univariate_opening_round ( )

◆ execute_wire_commitments_round()

void bb::ECCVMProver::execute_wire_commitments_round ( )

Compute commitments to the first three wires.

Definition at line 57 of file eccvm_prover.cpp.

◆ export_proof()

ECCVMProof bb::ECCVMProver::export_proof ( )

Definition at line 203 of file eccvm_prover.cpp.

Member Data Documentation

◆ batching_challenge_v

FF bb::ECCVMProver::batching_challenge_v

Definition at line 82 of file eccvm_prover.hpp.

◆ commitment_labels

CommitmentLabels bb::ECCVMProver::commitment_labels

Definition at line 78 of file eccvm_prover.hpp.

◆ evaluation_challenge_x

FF bb::ECCVMProver::evaluation_challenge_x

Definition at line 81 of file eccvm_prover.hpp.

◆ ipa_transcript

std::shared_ptr<Transcript> bb::ECCVMProver::ipa_transcript

Definition at line 61 of file eccvm_prover.hpp.

◆ key

std::shared_ptr<ProvingKey> bb::ECCVMProver::key

Definition at line 76 of file eccvm_prover.hpp.

◆ NUM_OPENING_CLAIMS

constexpr size_t bb::ECCVMProver::NUM_OPENING_CLAIMS = ECCVMFlavor::NUM_TRANSLATION_OPENING_CLAIMS + 1
staticconstexpr

Definition at line 67 of file eccvm_prover.hpp.

◆ opening_claims

std::array<OpeningClaim, NUM_OPENING_CLAIMS> bb::ECCVMProver::opening_claims

Definition at line 68 of file eccvm_prover.hpp.

◆ public_inputs

std::vector<FF> bb::ECCVMProver::public_inputs

Definition at line 72 of file eccvm_prover.hpp.

◆ relation_parameters

bb::RelationParameters<FF> bb::ECCVMProver::relation_parameters

Definition at line 74 of file eccvm_prover.hpp.

◆ sumcheck_output

SumcheckOutput<Flavor> bb::ECCVMProver::sumcheck_output

Definition at line 84 of file eccvm_prover.hpp.

◆ transcript

std::shared_ptr<Transcript> bb::ECCVMProver::transcript

Definition at line 60 of file eccvm_prover.hpp.

◆ translation_evaluations

TranslationEvaluations bb::ECCVMProver::translation_evaluations

Definition at line 70 of file eccvm_prover.hpp.

◆ unmasked_witness_size

size_t bb::ECCVMProver::unmasked_witness_size

Definition at line 63 of file eccvm_prover.hpp.

◆ zk_sumcheck_data

ZKData bb::ECCVMProver::zk_sumcheck_data

Definition at line 79 of file eccvm_prover.hpp.


The documentation for this class was generated from the following files: