Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
constants.hpp
Go to the documentation of this file.
1#pragma once
2#include <cstddef>
3#include <cstdint>
4
5namespace bb {
6
7// Arbitrarily large constant (> size of the BN254 srs) used to ensure that the evaluations on the hypercube of the
8// permutation argument polynomials (sigmas, ids) are unique, e.g. id[i][j] == id[m][n] iff (i == m && j == n)
9constexpr uint32_t PERMUTATION_ARGUMENT_VALUE_SEPARATOR = 1 << 28;
10
11// The fixed size of the Translator trace where each accumulation gate, corresponding to one UltraOp, will occupy two
12// rows.
13static constexpr uint32_t CONST_TRANSLATOR_MINI_CIRCUIT_LOG_SIZE = 13;
14
15// -1 as each op occupies two rows in Translator trace
16static constexpr uint32_t CONST_OP_QUEUE_LOG_SIZE = CONST_TRANSLATOR_MINI_CIRCUIT_LOG_SIZE - 1;
17
18// The log of the max circuit size assumed in order to achieve constant sized Honk proofs
19// TODO(https://github.com/AztecProtocol/barretenberg/issues/1046): Remove the need for const sized proofs
20static constexpr uint32_t CONST_PROOF_SIZE_LOG_N = 25;
21
22// The log of the max circuit size of circuits being folded. This size is assumed by the HN prover and verifier in order
23// to ensure a constant HN proof size and a HN recursive verifier circuit that is independent of the size of the
24// circuits being folded.
25static constexpr uint32_t CONST_FOLDING_LOG_N = 24;
26// Hiding kernel is a constant circuit that is being proven with MegaZKFlavor as a part Chonk
27static constexpr uint32_t HIDING_KERNEL_LOG_N = 17;
28// The size of the AVMRecursiveVerifier circuit arithmetized with Mega.
29static constexpr uint32_t MEGA_AVM_LOG_N = 21;
30
31static constexpr uint32_t CONST_ECCVM_LOG_N = 15;
32
33// IPA proof length: 4 * CONST_ECCVM_LOG_N (L and R commitments) + 2 (G_0) + 2 (a_0)
34// Note: Updating this requires updating noir protocol circuits (rollup-base-private,
35// rollup-base-public, rollup-block-merge, rollup-block-root, rollup-merge, rollup-root)
36static constexpr size_t IPA_PROOF_LENGTH = (4 * CONST_ECCVM_LOG_N) + 4;
37
38// The number of rows randomized to mask witness polynomials, hiding (1) witness commitments, (2) multilinear
39// evaluations of witness polynomials in Sumcheck, (3) evaluations of shifted witness polynomials in Sumcheck or
40// univariate evaluations required in ECCVM. The masking values are placed in the rows NUM_ZERO_ROWS .. TRACE_OFFSET +
41// NUM_ZERO_ROWS - 1 of the trace. (Recall that the first NUM_ZERO_ROWS are zeroed out.)
42static constexpr uint32_t NUM_MASKED_ROWS = 3;
43
44// The first NUM_MASKED_ROWS + 1 rows are disabled in Sumcheck (= TRACE_OFFSET = NUM_DISABLED_ROWS_IN_SUMCHECK). The
45// +1 accounts for shifts: the relation at row TRACE_OFFSET involves w_shift(TRACE_OFFSET) = w(TRACE_OFFSET + 1),
46// but the gate separator vanishes there, so the first row where relations are active is TRACE_OFFSET.
47static constexpr uint32_t NUM_DISABLED_ROWS_IN_SUMCHECK = NUM_MASKED_ROWS + 1;
48
49// For ZK Flavors: the number of the commitments required by Libra and SmallSubgroupIPA.
50static constexpr uint32_t NUM_LIBRA_COMMITMENTS = 3;
51
52// The SmallSubgroupIPA is a sub-protocol used in several Flavors, to prove claimed inner product, the Prover sends 4
53// extra evaluations
54static constexpr uint32_t NUM_SMALL_IPA_EVALUATIONS = 4;
55
56static constexpr uint32_t MERGE_PROOF_SIZE = 42; // used to ensure mock proofs are generated correctly
57
58// There are 5 distinguished wires in ECCVM that have to be opened as univariates to establish the connection between
59// ECCVM and Translator
60static constexpr uint32_t NUM_TRANSLATION_EVALUATIONS = 5;
61
62// The number of leading zero rows in the execution trace. Used to enable shifted polynomials.
63static constexpr size_t NUM_ZERO_ROWS = 1;
64
65static constexpr size_t CHONK_MAX_NUM_CIRCUITS = 56 + /*trailing kernels*/ 3;
66
67static constexpr size_t BATCH_MERGE_PROOF_SIZE =
68 /*num subtables*/ 1 +
69 /*shift sizes*/ CHONK_MAX_NUM_CIRCUITS +
70 /*commitments*/ (4 * (4 * (CHONK_MAX_NUM_CIRCUITS + /*zk tables, merged tables*/ 2) + /*degree check*/ 1)) +
71 /*evals*/ (4 * (CHONK_MAX_NUM_CIRCUITS + 2) + 1) +
72 /*shplonk and kzg*/ 8;
73} // namespace bb
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
constexpr uint32_t PERMUTATION_ARGUMENT_VALUE_SEPARATOR
Definition constants.hpp:9