47 using Point = Flavor::Curve::AffineElement;
157 :
std::runtime_error(
std::string(
"Client IVC Proof deserialization error: ") + msg)
194 auto mega_elements =
mega->to_field_elements();
195 elements.insert(elements.end(), mega_elements.begin(), mega_elements.end());
197 auto eccvm_elements =
eccvm->to_field_elements();
198 elements.insert(elements.end(), eccvm_elements.begin(), eccvm_elements.end());
200 auto translator_elements =
translator->to_field_elements();
201 elements.insert(elements.end(), translator_elements.begin(), translator_elements.end());
216 size_t mega_read =
mega->from_field_elements(elements.subspan(read_idx));
217 read_idx += mega_read;
220 size_t eccvm_read =
eccvm->from_field_elements(elements.subspan(read_idx));
221 read_idx += eccvm_read;
224 size_t translator_read =
translator->from_field_elements(elements.subspan(read_idx));
225 read_idx += translator_read;
246 for (
size_t idx = 0; idx <
challenge.size(); idx++) {
250 transcript.add_to_independent_hash_buffer(domain_separator +
"batched_evaluation_unshifted",
252 transcript.add_to_independent_hash_buffer(domain_separator +
"batched_evaluation_shifted",
254 transcript.add_to_independent_hash_buffer(domain_separator +
"batched_commitment_unshifted",
256 transcript.add_to_independent_hash_buffer(domain_separator +
"batched_commitment_shifted",
277 for (
auto element : native_accumulator.
challenge) {
292 for (
size_t idx = 0; idx <
challenge.size(); idx++) {
296 transcript.add_to_independent_hash_buffer(domain_separator +
"batched_evaluation_unshifted",
298 transcript.add_to_independent_hash_buffer(domain_separator +
"batched_evaluation_shifted",
300 transcript.add_to_independent_hash_buffer(domain_separator +
"batched_commitment_unshifted",
302 transcript.add_to_independent_hash_buffer(domain_separator +
"batched_commitment_shifted",
312 value.challenge.emplace_back(element.get_value());
338 const std::shared_ptr<Transcript>&
transcript)
342 for (
size_t idx = 0; idx < labels.size(); idx++) {
347 challenges =
transcript->template get_challenges<FF>(labels);
363 std::vector<Commitment> points;
364 std::vector<FF> scalars;
366 for (
auto [commitment, scalar] :
zip_view(commitments, challenges)) {
367 if (commitment.is_point_at_infinity()) {
368 info(
"Commitment at index ", idx,
" is zero");
370 points.emplace_back(commitment);
371 scalars.emplace_back(scalar);
374 return batch_mul_native(points, scalars);
378 auto unshifted_challenges =
380 auto shifted_challenges =
387 auto batched_unshifted = PolynomialBatcher::compute_batched<Flavor::NUM_UNSHIFTED_ENTITIES>(
389 auto batched_shifted = PolynomialBatcher::compute_batched<Flavor::NUM_SHIFTED_ENTITIES>(
397 unshifted_evaluations, unshifted_challenges);
399 shifted_evaluations, shifted_challenges);
405 unshifted_commitments, unshifted_challenges);
407 shifted_commitments, shifted_challenges);
411 .batched_evaluations = { batched_unshifted_evaluation, batched_shifted_evaluation },
412 .batched_polynomials = { batched_unshifted, batched_shifted },
413 .batched_commitments = { batched_unshifted_commitment, batched_shifted_commitment },
419 const std::shared_ptr<Transcript>&
transcript)
423 for (
size_t idx = 0; idx < labels.size(); idx++) {
428 challenges =
transcript->template get_challenges<FF>(labels);
444 std::vector<Commitment> points;
445 std::vector<FF> scalars;
446 for (
auto [commitment, scalar] :
zip_view(commitments, challenges)) {
447 points.emplace_back(commitment);
448 scalars.emplace_back(scalar);
450 return batch_mul_native(points, scalars);
455 verifier_instance->witness_commitments);
458 auto unshifted_challenges =
460 auto shifted_challenges =
468 unshifted_evaluations, unshifted_challenges);
470 shifted_evaluations, shifted_challenges);
473 auto unshifted_commitments = verifier_commitments.
get_unshifted();
476 unshifted_commitments, unshifted_challenges);
478 shifted_commitments, shifted_challenges);
482 .batched_evaluations = { batched_unshifted_evaluation, batched_shifted_evaluation },
483 .batched_commitments = { batched_unshifted_commitment, batched_shifted_commitment }
501 for (
size_t idx = 0; idx < labels.size(); idx++) {
506 challenges =
transcript->template get_challenges<StdlibFF>(labels);
523 std::vector<StdlibFF> scalars;
524 for (
auto [commitment, scalar] :
zip_view(commitments, challenges)) {
525 if (commitment.is_point_at_infinity().get_value()) {
528 if (scalar.is_zero().get_value()) {
531 points.emplace_back(commitment);
532 scalars.emplace_back(scalar);
534 return RecursiveCommitment::batch_mul(points, scalars);
539 verifier_instance->witness_commitments);
542 auto unshifted_challenges =
544 auto shifted_challenges =
552 unshifted_evaluations, unshifted_challenges);
554 shifted_evaluations, shifted_challenges);
557 auto unshifted_verifier_commitments = verifier_commitments.
get_unshifted();
560 unshifted_verifier_commitments, unshifted_challenges);
562 shifted_witness_commitments, shifted_challenges);
565 { batched_unshifted_evaluation, batched_shifted_evaluation },
566 { batched_unshifted_commitment, batched_shifted_commitment });
636 const std::vector<std::shared_ptr<RecursiveVKAndHash>>& input_keys = {});
638 [[nodiscard(
"Pairing points should be accumulated")]]
std::
642 const StdlibVerifierInputs& verifier_inputs,
680 const std::shared_ptr<Transcript>& verifier_transcript);
684 const std::shared_ptr<Transcript>&
transcript);
687 const std::shared_ptr<VerifierInstance>& verifier_instance,
688 const std::shared_ptr<Transcript>&
transcript,
693 const std::shared_ptr<Transcript>&
transcript);
697 const std::shared_ptr<Transcript>&
transcript);
725 size_t num_frs = SumcheckClientIVC::VerificationKey::calc_num_data_types();
729 for (
auto& element : field_elements) {
734 vk.from_field_elements(field_elements);
742 auto field_elements =
vk.to_field_elements();
743 for (
const auto& element : field_elements) {
Common transcript class for both parties. Stores the data for the current round, as well as the manif...
CommitmentKey object over a pairing group 𝔾₁.
The verification key is responsible for storing the commitments to the precomputed (non-witnessk) pol...
static constexpr size_t PROOF_LENGTH_WITHOUT_PUB_INPUTS
Class responsible for computation of the batched multilinear polynomials required by the Gemini proto...
static constexpr size_t PUBLIC_INPUTS_SIZE
Base class interface for IVC schemes.
A field element for each entity of the flavor. These entities represent the prover polynomials evalua...
A container for the prover polynomials handles.
The verification key is responsible for storing the commitments to the precomputed (non-witness) poly...
Container for all witness polynomials used/constructed by the prover.
static constexpr size_t NUM_SHIFTED_ENTITIES
static constexpr size_t VIRTUAL_LOG_N
Curve::AffineElement Commitment
static constexpr size_t NUM_UNSHIFTED_ENTITIES
VerifierCommitments_< Commitment, VerificationKey > VerifierCommitments
A field element for each entity of the flavor. These entities represent the prover polynomials evalua...
The verification key is responsible for storing the commitments to the precomputed (non-witnessk) pol...
The recursive counterpart to the "native" Mega flavor.
StdlibTranscript< CircuitBuilder > Transcript
typename Curve::Element Commitment
typename Curve::ScalarField FF
VKAndHash_< FF, VerificationKey > VKAndHash
MegaFlavor::WitnessEntities< Commitment > WitnessCommitments
A container for the witness commitments.
static constexpr size_t PROOF_LENGTH_WITHOUT_PUB_INPUTS(size_t virtual_log_n=MegaFlavor::VIRTUAL_LOG_N)
static size_t calc_num_data_types()
Calculate the number of field elements needed for serialization.
Verifier class for all the presumcheck rounds, which are shared between the folding verifier and ultr...
A ProverInstance is normally constructed from a finalized circuit and it contains all the information...
A template class for a reference array. Behaves as if std::array<T&, N> was possible.
DeserializationError(const std::string &msg)
The IVC scheme used by the aztec client for private function execution.
VerificationKey get_vk() const
MegaCircuitBuilder ClientCircuit
std::deque< VerifierInputs > VerificationQueue
static VerifierAccumulator execute_first_sumcheck_native_verification(const std::shared_ptr< VerifierInstance > &verifier_instance, const std::shared_ptr< Transcript > &transcript, const HonkProof &proof)
MegaFlavor::CommitmentKey bn254_commitment_key
std::shared_ptr< Transcript > prover_accumulation_transcript
Proof prove()
Construct a proof for the IVC, which, if verified, fully establishes its correctness.
static void hide_op_queue_accumulation_result(ClientCircuit &circuit)
Add a valid operation with random data to the op queue to prevent information leakage in Translator p...
stdlib::recursion::PairingPoints< ClientCircuit > PairingPoints
stdlib::Proof< ClientCircuit > StdlibProof
void instantiate_stdlib_verification_queue(ClientCircuit &circuit, const std::vector< std::shared_ptr< RecursiveVKAndHash > > &input_keys={})
Instantiate a stdlib verification queue for use in the kernel completion logic.
std::shared_ptr< Transcript > transcript
QUEUE_TYPE get_queue_type() const
Get queue type for the proof of a circuit about to be accumulated based on num circuits accumulated s...
VerifierAccumulator recursive_verifier_native_accum
static RecursiveVerifierAccumulator perform_folding_recursive_verification(ClientCircuit &circuit, const std::optional< RecursiveVerifierAccumulator > &verifier_accumulator, const std::shared_ptr< RecursiveVerifierInstance > &verifier_instance, const std::shared_ptr< RecursiveTranscript > &transcript, const StdlibProof &proof, std::optional< StdlibFF > &prev_accum_hash, bool is_kernel)
static bool verify(const Proof &proof, const VerificationKey &vk)
Goblin & get_goblin() override
std::array< RecursiveFlavor::Commitment, ClientCircuit::NUM_WIRES > TableCommitments
VerifierAccumulator native_verifier_accum
size_t num_circuits_accumulated
RecursiveFlavor::Commitment RecursiveCommitment
VerificationQueue verification_queue
const Goblin & get_goblin() const override
void update_native_verifier_accumulator(const VerifierInputs &queue_entry, const std::shared_ptr< Transcript > &verifier_transcript)
Runs either Oink or PG native verifier to update the native verifier accumulator.
RecursiveFlavor::FF StdlibFF
Flavor::Curve::AffineElement Point
ProverAccumulator prover_accumulator
HonkProof construct_sumcheck_proof(const std::shared_ptr< ProverInstance > &prover_instance, const std::shared_ptr< MegaVerificationKey > &honk_vk, const std::shared_ptr< Transcript > &transcript)
HonkProof construct_honk_proof_for_hiding_kernel(ClientCircuit &circuit, const std::shared_ptr< MegaVerificationKey > &verification_key)
Construct a zero-knowledge proof for the hiding circuit, which recursively verifies the last folding,...
static ProverAccumulator execute_first_sumcheck(const std::shared_ptr< ProverInstance > &prover_instance, const std::shared_ptr< MegaVerificationKey > &honk_vk, const std::shared_ptr< Transcript > &transcript)
size_t get_num_circuits() const
std::tuple< std::optional< RecursiveVerifierAccumulator >, PairingPoints, TableCommitments > perform_recursive_verification_and_databus_consistency_checks(ClientCircuit &circuit, const StdlibVerifierInputs &verifier_inputs, const std::optional< RecursiveVerifierAccumulator > &input_verifier_accumulator, const TableCommitments &T_prev_commitments, const std::shared_ptr< RecursiveTranscript > &accumulation_recursive_transcript)
Populate the provided circuit with constraints for (1) recursive verification of the provided accumul...
HonkProof construct_folding_proof(const std::shared_ptr< ProverInstance > &prover_instance, const std::shared_ptr< MegaVerificationKey > &honk_vk, const std::shared_ptr< Transcript > &transcript)
Flavor::Commitment Commitment
HonkProof construct_pcs_proof(const std::shared_ptr< Transcript > &transcript)
Internal method for constructing a decider proof.
StdlibVerificationQueue stdlib_verification_queue
void accumulate(ClientCircuit &circuit, const std::shared_ptr< MegaVerificationKey > &precomputed_vk) override
Perform prover work for accumulation (e.g. PG folding, merge proving)
static void hide_op_queue_content_in_tail(ClientCircuit &circuit)
Adds three random ops to the tail kernel.
std::deque< StdlibVerifierInputs > StdlibVerificationQueue
void complete_kernel_circuit_logic(ClientCircuit &circuit)
Append logic to complete a kernel circuit.
static RecursiveVerifierAccumulator execute_first_sumcheck_recursive_verification(ClientCircuit &circuit, const std::shared_ptr< RecursiveVerifierInstance > &verifier_instance, const std::shared_ptr< RecursiveTranscript > &transcript, const StdlibProof &proof)
std::vector< FF > FoldProof
static void hide_op_queue_content_in_hiding(ClientCircuit &circuit)
Adds two random ops to the hiding kernel.
The verification key is responsible for storing the commitments to the precomputed (non-witnessk) pol...
static constexpr size_t PROOF_LENGTH_WITHOUT_PUB_INPUTS
The VerifierInstance encapsulates all the necessary information for a Mega Honk Verifier to verify a ...
Manages the data that is propagated on the public inputs of an application/function circuit.
Manages the data that is propagated on the public inputs of a hiding kernel circuit.
Manages the data that is propagated on the public inputs of a kernel circuit.
The stdlib counterpart of VerifierInstance, used in recursive folding verification.
uint8_t buffer[RANDOM_BUFFER_SIZE]
UltraKeccakFlavor::VerificationKey VerificationKey
DefaultIO< MegaCircuitBuilder > AppIO
The data that is propagated on the public inputs of an application/function circuit.
Entry point for Barretenberg command-line interface.
std::vector< fr > HonkProof
void write(std::vector< uint8_t > &buf, ClientIVC::VerificationKey const &vk)
void read(uint8_t const *&it, ClientIVC::VerificationKey &vk)
BaseTranscript< FrCodec, bb::crypto::Poseidon2< bb::crypto::Poseidon2Bn254ScalarFieldParams > > NativeTranscript
MegaCircuitBuilder_< field< Bn254FrParams > > MegaCircuitBuilder
VerifierCommitmentKey< Curve > vk
void read(auto &it, msgpack_concepts::HasMsgPack auto &obj)
Automatically derived read for any object that defines .msgpack() (implicitly defined by MSGPACK_FIEL...
void write(auto &buf, const msgpack_concepts::HasMsgPack auto &obj)
Automatically derived write for any object that defines .msgpack() (implicitly defined by MSGPACK_FIE...
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
std::string to_string(bb::avm2::ValueTag tag)
VerifierAccumulator batch(const std::shared_ptr< VerifierInstance > &verifier_instance, const std::shared_ptr< Transcript > &transcript)
std::vector< FF > challenge
ClaimedEvaluations claimed_evaluations
ProverAccumulator batch(ProverPolynomials &polynomials, VerifierCommitments &commitments, const std::shared_ptr< Transcript > &transcript)
A full proof for the IVC scheme containing a Mega proof showing correctness of the hiding circuit (wh...
static constexpr size_t PROOF_LENGTH(size_t virtual_log_n=MegaZKFlavor::VIRTUAL_LOG_N)
The size of a ClientIVC proof with backend-added public inputs: HidingKernelIO.
MSGPACK_FIELDS(mega_proof, goblin_proof)
static Proof from_msgpack_buffer(uint8_t const *&buffer)
static Proof from_file_msgpack(const std::string &filename)
static Proof from_field_elements(const std::vector< SumcheckClientIVC::FF > &fields)
static constexpr size_t PROOF_LENGTH_WITHOUT_PUB_INPUTS(size_t virtual_log_n=MegaZKFlavor::VIRTUAL_LOG_N)
The size of a ClientIVC proof without backend-added public inputs.
static constexpr const char MSGPACK_SCHEMA_NAME[]
msgpack::sbuffer to_msgpack_buffer() const
std::vector< FF > to_field_elements() const
Serialize proof to field elements.
void to_file_msgpack(const std::string &filename) const
uint8_t * to_msgpack_heap_buffer() const
Very quirky method to convert a msgpack buffer to a "heap" buffer.
bool operator==(const Proof &other) const =default
std::array< FF, 2 > batched_evaluations
std::array< Commitment, 2 > batched_commitments
std::vector< FF > challenge
std::array< Polynomial< FF >, 2 > batched_polynomials
RecursiveVerifierAccumulator batch(const std::shared_ptr< RecursiveVerifierInstance > &verifier_instance, const std::shared_ptr< RecursiveTranscript > &transcript)
ClaimedEvaluations claimed_evaluations
std::vector< StdlibFF > challenge
VerifierAccumulator get_value()
StdlibFF hash_through_transcript(const std::string &domain_separator, RecursiveTranscript &transcript) const
RecursiveVerifierAccumulator(const std::vector< StdlibFF > &challenge, const std::array< StdlibFF, 2 > &batched_evaluations, const std::array< RecursiveCommitment, 2 > &batched_commitments)
std::vector< StdlibFF > challenge
std::array< StdlibFF, 2 > batched_evaluations
RecursiveVerifierAccumulator()=default
RecursiveVerifierAccumulator(ClientCircuit *builder, VerifierAccumulator &native_accumulator)
std::array< RecursiveCommitment, 2 > batched_commitments
std::shared_ptr< ECCVMVerificationKey > eccvm
std::vector< bb::fr > to_field_elements() const
Serialize verification key to field elements.
std::shared_ptr< MegaVerificationKey > mega
size_t from_field_elements(std::span< const bb::fr > elements)
Deserialize verification key from field elements.
static size_t calc_num_data_types()
Calculate the number of field elements needed for serialization.
std::shared_ptr< TranslatorVerificationKey > translator
FF hash_through_transcript(const std::string &domain_separator, Transcript &transcript) const
std::vector< FF > challenge
std::array< Commitment, 2 > batched_commitments
std::array< FF, 2 > batched_evaluations
An object storing two EC points that represent the inputs to a pairing check.