Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
special_public_inputs.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: Complete, 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
13
14namespace bb {
15
20class DefaultIO {
21 public:
24
26 static constexpr bool HasIPA = false;
27
29
33 void reconstruct_from_public(const std::vector<FF>& public_inputs)
34 {
35 BB_ASSERT_GTE(public_inputs.size(),
37 "Public inputs too small for DefaultIO reconstruction. Got " +
38 std::to_string(public_inputs.size()) + " but need at least " +
40 // Assumes that the app-io public inputs are at the end of the public_inputs vector
41 uint32_t index = static_cast<uint32_t>(public_inputs.size() - PUBLIC_INPUTS_SIZE);
43 }
44
48 template <typename Builder> static void add_default(Builder& builder)
49 {
51 }
52};
53
58 public:
61 using TableCommitments = std::array<G1, MegaCircuitBuilder::NUM_WIRES>;
62
65
66 static constexpr size_t PUBLIC_INPUTS_SIZE =
68 static constexpr bool HasIPA = false;
69
73
77 void reconstruct_from_public(const std::vector<FF>& public_inputs)
78 {
79 BB_ASSERT_GTE(public_inputs.size(),
81 "Public inputs too small for HidingKernelIO reconstruction. Got " +
82 std::to_string(public_inputs.size()) + " but need at least " +
84 // Assumes that the hiding-kernel-io public inputs are at the end of the public_inputs vector
85 uint32_t index = static_cast<uint32_t>(public_inputs.size() - PUBLIC_INPUTS_SIZE);
86
90 index += G1::PUBLIC_INPUTS_SIZE;
91 for (auto& commitment : ecc_op_tables) {
92 commitment = PublicPoint::reconstruct(public_inputs, { index });
93 index += G1::PUBLIC_INPUTS_SIZE;
94 }
95 }
96
100 template <typename Builder> static void add_default(Builder& builder)
101 {
103 }
104};
105
109class RollupIO {
110 public:
113
116
117 static constexpr size_t PUBLIC_INPUTS_SIZE = ROLLUP_PUBLIC_INPUTS_SIZE;
118 static constexpr bool HasIPA = true;
119
122
126 void reconstruct_from_public(const std::vector<FF>& public_inputs)
127 {
128 BB_ASSERT_GTE(public_inputs.size(),
130 "Public inputs too small for RollupIO reconstruction. Got " +
131 std::to_string(public_inputs.size()) + " but need at least " +
133 // Assumes that the rollup-io public inputs are at the end of the public_inputs vector
134 uint32_t index = static_cast<uint32_t>(public_inputs.size() - PUBLIC_INPUTS_SIZE);
135
139 }
140
144 template <typename Builder> static void add_default(Builder& builder)
145 {
147 }
148};
149
150} // namespace bb
#define BB_ASSERT_GTE(left, right,...)
Definition assert.hpp:128
Manages the data that is propagated on the public inputs of an application/function circuit.
PairingPoints< curve::BN254 > pairing_inputs
static constexpr size_t PUBLIC_INPUTS_SIZE
static void add_default(Builder &builder)
Add default IO values to a circuit builder (for native tests)
void reconstruct_from_public(const std::vector< FF > &public_inputs)
Reconstructs the IO components from a public inputs array.
static constexpr bool HasIPA
Manages the data that is propagated on the public inputs of of a hiding kernel circuit.
static constexpr size_t PUBLIC_INPUTS_SIZE
PairingPoints< curve::BN254 > pairing_inputs
std::array< G1, MegaCircuitBuilder::NUM_WIRES > TableCommitments
void reconstruct_from_public(const std::vector< FF > &public_inputs)
Reconstructs the IO components from a public inputs array.
static constexpr bool HasIPA
TableCommitments ecc_op_tables
static void add_default(Builder &builder)
Add default IO values to a circuit builder (for native tests)
curve::BN254::AffineElement G1
An object storing two EC points that represent the inputs to a pairing check.
A wrapper class for deserializing objects from the public inputs of a circuit.
static ComponentType reconstruct(const std::vector< bb::fr > &public_inputs, const Key &key)
The data that is propagated on the public inputs of a rollup circuit.
void reconstruct_from_public(const std::vector< FF > &public_inputs)
Reconstructs the IO components from a public inputs array.
static void add_default(Builder &builder)
Add default IO values to a circuit builder (for native tests)
PairingPoints< curve::BN254 > pairing_inputs
static constexpr bool HasIPA
static constexpr size_t PUBLIC_INPUTS_SIZE
typename Group::affine_element AffineElement
Definition bn254.hpp:22
bb::fr ScalarField
Definition bn254.hpp:18
static void add_default(Builder &builder)
Add default public inputs when they are not present.
static void add_default(Builder &builder)
Add default public inputs when they are not present.
static void add_default(Builder &builder)
Add default public inputs when they are not present.
AluTraceBuilder builder
Definition alu.test.cpp:124
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
std::string to_string(bb::avm2::ValueTag tag)