Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
public_inputs_type.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: Completed, auditors: [Sergei], commit: }
3// external_1: { status: not started, auditors: [], commit: }
4// external_2: { status: not started, auditors: [], commit: }
5// =====================
6
7#pragma once
8
10#include <cstdint>
11
12namespace bb {
13
21// Number of bb::fr elements used to represent an element of bb::fr in the public inputs
22static constexpr std::size_t FR_PUBLIC_INPUTS_SIZE = 1;
23
24// Number of bb::fr elements used to represent a bigfield element in the public inputs
25static constexpr std::size_t BIGFIELD_PUBLIC_INPUTS_SIZE = 2;
26
27// Number of bb::fr elements used to represent a goblin bigfield element in the public inputs
28static constexpr std::size_t GOBLIN_FIELD_PUBLIC_INPUTS_SIZE = 2;
29
30// Number of bb::fr elements used to represent a biggroup element in the public inputs
31static constexpr std::size_t BIGGROUP_PUBLIC_INPUTS_SIZE = 2 * BIGFIELD_PUBLIC_INPUTS_SIZE;
32
33// Number of bb::fr elements used to represent a goblin biggroup element in the public inputs
34static constexpr std::size_t GOBLIN_GROUP_PUBLIC_INPUTS_SIZE = 2 * GOBLIN_FIELD_PUBLIC_INPUTS_SIZE;
35
36static_assert(BIGGROUP_PUBLIC_INPUTS_SIZE == GOBLIN_GROUP_PUBLIC_INPUTS_SIZE,
37 "BIGGROUP_PUBLIC_INPUTS_SIZE is different from GOBLIN_GROUP_PUBLIC_INPUTS_SIZE, but PAIRING_POINTS_SIZE "
38 "assumes they are the same. Update PAIRING_POINTS_SIZE and any constants depending on it accordingly.");
39
46static constexpr std::size_t PAIRING_POINTS_SIZE = 2 * GOBLIN_GROUP_PUBLIC_INPUTS_SIZE;
47
48// Number of bb::fr elements used to represent an opening claim (C, (r, p(r))) over Grumpkin
49// Formula: challenge (fq) + evaluation (fq) + commitment (2 fr coordinates)
50static constexpr std::size_t GRUMPKIN_OPENING_CLAIM_SIZE =
51 /*challenge*/ BIGFIELD_PUBLIC_INPUTS_SIZE + /*evaluation*/ BIGFIELD_PUBLIC_INPUTS_SIZE +
52 /*commitment*/ (2 * FR_PUBLIC_INPUTS_SIZE);
53
54// Invalid public input size, used in OpeningClaim<Curve> when Curve is not Grumpkin
55static constexpr std::size_t INVALID_PUBLIC_INPUTS_SIZE = 0;
56
57// Number of bb::fr elements used to represent the public inputs of an INIT/INNER/RESET/TAIL kernel
58// verifying num_apps application circuits in its accumulation group.
60{
61 return /*pairing_inputs*/ PAIRING_POINTS_SIZE +
62 /*kernel_return_data*/ GOBLIN_GROUP_PUBLIC_INPUTS_SIZE +
63 /*app_return_data[num_apps]*/ (num_apps * GOBLIN_GROUP_PUBLIC_INPUTS_SIZE) +
64 /*ecc_op_hash*/ FR_PUBLIC_INPUTS_SIZE +
65 /*output_hn_accum_hash*/ FR_PUBLIC_INPUTS_SIZE;
66}
67
68// Number of bb::fr elements used to represent the default public inputs, i.e., the pairing points
69static constexpr std::size_t DEFAULT_PUBLIC_INPUTS_SIZE = PAIRING_POINTS_SIZE;
70
71// Number of bb::fr elements used to represent the public inputs of the HIDING kernel
72static constexpr std::size_t HIDING_KERNEL_PUBLIC_INPUTS_SIZE =
73 /*pairing_inputs*/ PAIRING_POINTS_SIZE +
74 /*kernel_return_data*/ GOBLIN_GROUP_PUBLIC_INPUTS_SIZE +
75 /*table_commitments*/ (NUM_WIRES * GOBLIN_GROUP_PUBLIC_INPUTS_SIZE);
76
77// Number of bb::fr elements used to represent the public inputs of a ROLLUP circuit
78static constexpr std::size_t ROLLUP_PUBLIC_INPUTS_SIZE =
79 /*pairing_inputs*/ PAIRING_POINTS_SIZE + /*ipa_claim*/ GRUMPKIN_OPENING_CLAIM_SIZE;
80
81// Number of bb::fr elements used to represent the public inputs of the inner circuit in the GoblinAvmRecursiveVerifier
82static constexpr std::size_t GOBLIN_AVM_PUBLIC_INPUTS_SIZE = FR_PUBLIC_INPUTS_SIZE + PAIRING_POINTS_SIZE;
83
84} // namespace bb
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
constexpr std::size_t kernel_public_inputs_size(std::size_t num_apps)
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13