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 = HIDING_KERNEL_PUBLIC_INPUTS_SIZE;
67 static constexpr bool HasIPA = false;
68
72
76 void reconstruct_from_public(const std::vector<FF>& public_inputs)
77 {
78 BB_ASSERT_GTE(public_inputs.size(),
80 "Public inputs too small for HidingKernelIO reconstruction. Got " +
81 std::to_string(public_inputs.size()) + " but need at least " +
83 // Assumes that the hiding-kernel-io public inputs are at the end of the public_inputs vector
84 uint32_t index = static_cast<uint32_t>(public_inputs.size() - PUBLIC_INPUTS_SIZE);
85
89 index += G1::PUBLIC_INPUTS_SIZE;
90 for (auto& commitment : ecc_op_tables) {
91 commitment = PublicPoint::reconstruct(public_inputs, { index });
92 index += G1::PUBLIC_INPUTS_SIZE;
93 }
94 }
95
99 template <typename Builder> static void add_default(Builder& builder)
100 {
102 }
103};
104
108class RollupIO {
109 public:
112
115
116 static constexpr size_t PUBLIC_INPUTS_SIZE = ROLLUP_PUBLIC_INPUTS_SIZE;
117 static constexpr bool HasIPA = true;
118
121
125 void reconstruct_from_public(const std::vector<FF>& public_inputs)
126 {
127 BB_ASSERT_GTE(public_inputs.size(),
129 "Public inputs too small for RollupIO reconstruction. Got " +
130 std::to_string(public_inputs.size()) + " but need at least " +
132 // Assumes that the rollup-io public inputs are at the end of the public_inputs vector
133 uint32_t index = static_cast<uint32_t>(public_inputs.size() - PUBLIC_INPUTS_SIZE);
134
138 }
139
143 template <typename Builder> static void add_default(Builder& builder)
144 {
146 }
147};
148
149} // 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)