Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
mega_zk_flavor.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: not started, auditors: [], date: YYYY-MM-DD }
3// external_1: { status: not started, auditors: [], date: YYYY-MM-DD }
4// external_2: { status: not started, auditors: [], date: YYYY-MM-DD }
5// =====================
6
7#pragma once
8
11
12namespace bb {
13
19 public:
20 // MegaZK is only used in production to prove the Hiding Kernel
21 static constexpr size_t VIRTUAL_LOG_N = HIDING_KERNEL_LOG_N;
22
23 // Indicates that this flavor runs with ZK Sumcheck.
24 static constexpr bool HasZK = true;
25
26 // The number of entities added for ZK (gemini_masking_poly)
27 static constexpr size_t NUM_MASKING_POLYNOMIALS = 1;
28
29 // The degree has to be increased because the relation is multiplied by the Row Disabling Polynomial
32 "LIBRA_UNIVARIATES_LENGTH must be equal to MegaZKFlavor::BATCHED_RELATION_PARTIAL_LENGTH");
33
34 // Override AllEntities to use ZK version (includes gemini_masking_poly via MaskingEntities)
35 template <typename DataType> using AllEntities = MegaFlavor::AllEntities_<DataType, HasZK>;
36
37 // NUM_WITNESS_ENTITIES includes gemini_masking_poly
39 // NUM_ALL_ENTITIES includes gemini_masking_poly
41 // NUM_UNSHIFTED_ENTITIES includes gemini_masking_poly
43
44 // Size of the final PCS MSM for ZK = non-ZK size + NUM_LIBRA_COMMITMENTS (3)
45 static constexpr size_t FINAL_PCS_MSM_SIZE(size_t log_n = MegaFlavor::VIRTUAL_LOG_N)
46 {
47 return NUM_UNSHIFTED_ENTITIES + log_n + 2 + NUM_LIBRA_COMMITMENTS;
48 }
49
50 // Override OINK_PROOF_LENGTH to include gemini_masking_poly commitment (sent via commit_to_masking_poly)
51 static constexpr size_t OINK_PROOF_LENGTH_WITHOUT_PUB_INPUTS =
52 /* 1. NUM_WITNESS_ENTITIES commitments (includes gemini_masking_poly) */ (NUM_WITNESS_ENTITIES * num_frs_comm);
53
58
59 // Override ProverUnivariates and ExtendedEdges to include gemini_masking_poly
62
63 // Proof length formula
64 static constexpr size_t PROOF_LENGTH_WITHOUT_PUB_INPUTS(size_t virtual_log_n = VIRTUAL_LOG_N)
65 {
66 return /* 1. NUM_WITNESS_ENTITIES commitments */ (NUM_WITNESS_ENTITIES * num_frs_comm) +
67 /* 2. Libra concatenation commitment*/ (num_frs_comm) +
68 /* 3. Libra sum */ (num_frs_fr) +
69 /* 4. virtual_log_n sumcheck univariates */
71 /* 5. NUM_ALL_ENTITIES sumcheck evaluations*/ (NUM_ALL_ENTITIES * num_frs_fr) +
72 /* 6. Libra claimed evaluation */ (num_frs_fr) +
73 /* 7. Libra grand sum commitment */ (num_frs_comm) +
74 /* 8. Libra quotient commitment */ (num_frs_comm) +
75 /* 9. virtual_log_n - 1 Gemini Fold commitments */
76 ((virtual_log_n - 1) * num_frs_comm) +
77 /* 10. virtual_log_n Gemini a evaluations */
78 (virtual_log_n * num_frs_fr) +
79 /* 11. NUM_SMALL_IPA_EVALUATIONS libra evals */ (NUM_SMALL_IPA_EVALUATIONS * num_frs_fr) +
80 /* 12. Shplonk Q commitment */ (num_frs_comm) +
81 /* 13. KZG W commitment */ (num_frs_comm);
82 }
83
85};
86
87} // namespace bb
Common transcript class for both parties. Stores the data for the current round, as well as the manif...
A base class labelling all entities (for instance, all of the polynomials used by the prover during s...
A field element for each entity of the flavor. These entities represent the prover polynomials evalua...
A container for storing the partially evaluated multivariates produced by sumcheck.
A container for the prover polynomials handles.
static constexpr size_t num_frs_fr
static constexpr size_t NUM_ALL_ENTITIES
static constexpr size_t NUM_WITNESS_ENTITIES
static constexpr size_t VIRTUAL_LOG_N
static constexpr size_t NUM_UNSHIFTED_ENTITIES
static constexpr size_t BATCHED_RELATION_PARTIAL_LENGTH
static constexpr size_t num_frs_comm
Child class of MegaFlavor that runs with ZK Sumcheck. See more in Sumcheck Outline.
static constexpr size_t NUM_UNSHIFTED_ENTITIES
static constexpr bool HasZK
static constexpr size_t NUM_MASKING_POLYNOMIALS
static constexpr size_t OINK_PROOF_LENGTH_WITHOUT_PUB_INPUTS
static constexpr size_t FINAL_PCS_MSM_SIZE(size_t log_n=MegaFlavor::VIRTUAL_LOG_N)
static constexpr size_t NUM_WITNESS_ENTITIES
static constexpr size_t PROOF_LENGTH_WITHOUT_PUB_INPUTS(size_t virtual_log_n=VIRTUAL_LOG_N)
static constexpr size_t NUM_ALL_ENTITIES
static constexpr size_t BATCHED_RELATION_PARTIAL_LENGTH
static constexpr size_t VIRTUAL_LOG_N
static constexpr uint32_t LIBRA_UNIVARIATES_LENGTH
Definition bn254.hpp:46
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
BaseTranscript< FrCodec, bb::crypto::Poseidon2< bb::crypto::Poseidon2Bn254ScalarFieldParams > > NativeTranscript