Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
public_inputs_trace.cpp
Go to the documentation of this file.
1
#include "
barretenberg/vm2/tracegen/public_inputs_trace.hpp
"
2
3
#include <array>
4
5
#include "barretenberg/aztec/aztec_constants.hpp"
6
#include "
barretenberg/vm2/common/constants.hpp
"
7
#include "
barretenberg/vm2/tracegen/precomputed_trace.hpp
"
8
9
namespace
bb::avm2::tracegen
{
10
20
void
PublicInputsTraceBuilder::process_public_inputs
(
TraceContainer
& trace,
const
PublicInputs
& public_inputs)
21
{
22
using
C
=
Column
;
23
24
auto
cols = public_inputs.
to_columns
();
25
26
// Each public input column has its own length (cols is jagged). Write only the used rows of each
27
// committed column; the remaining trace rows default to zero, which is what the public input
28
// consistency check (hashing + MLE) in the verifier expects.
29
constexpr
std::array<C, AVM_NUM_PUBLIC_INPUT_COLUMNS>
public_input_columns = {
30
C::public_inputs_cols_0_,
31
C::public_inputs_cols_1_,
32
C::public_inputs_cols_2_,
33
C::public_inputs_cols_3_,
34
};
35
36
for
(
size_t
i = 0; i < AVM_NUM_PUBLIC_INPUT_COLUMNS; i++) {
37
trace
.reserve_column(public_input_columns[i],
AVM_PUBLIC_INPUTS_COLUMN_LENGTHS
[i]);
38
for
(uint32_t row = 0; row <
AVM_PUBLIC_INPUTS_COLUMN_LENGTHS
[i]; row++) {
39
trace
.set(public_input_columns[i], row, cols[i][row]);
40
}
41
}
42
}
43
46
static_assert
(
PRECOMPUTED_TRACE_SIZE
>= AVM_PUBLIC_INPUTS_COLUMNS_MAX_LENGTH);
47
56
void
PublicInputsTraceBuilder::process_public_inputs_aux_precomputed
(
TraceContainer
& trace)
57
{
58
using
C
=
Column
;
59
60
// sel is precomputed to be 1 for rows [0, AVM_PUBLIC_INPUTS_COLUMNS_MAX_LENGTH)
61
trace
.reserve_column(C::public_inputs_sel, AVM_PUBLIC_INPUTS_COLUMNS_MAX_LENGTH);
62
for
(uint32_t row = 0; row < AVM_PUBLIC_INPUTS_COLUMNS_MAX_LENGTH; row++) {
63
trace
.set(C::public_inputs_sel, row, 1);
64
}
65
}
66
67
}
// namespace bb::avm2::tracegen
bb::avm2::tracegen::PublicInputsTraceBuilder::process_public_inputs
void process_public_inputs(TraceContainer &trace, const PublicInputs &public_inputs)
Populate the public inputs trace columns from the given public inputs.
Definition
public_inputs_trace.cpp:20
bb::avm2::tracegen::PublicInputsTraceBuilder::process_public_inputs_aux_precomputed
void process_public_inputs_aux_precomputed(TraceContainer &trace)
Populate the auxiliary precomputed selector for the public inputs subtrace.
Definition
public_inputs_trace.cpp:56
bb::avm2::tracegen::TraceContainer
Definition
trace_container.hpp:48
trace
TestTraceContainer trace
Definition
data_copy.test.cpp:63
bb::avm2::tracegen
Definition
full_row.hpp:10
bb::avm2::tracegen::PRECOMPUTED_TRACE_SIZE
constexpr uint32_t PRECOMPUTED_TRACE_SIZE
Definition
precomputed_trace.hpp:9
bb::avm2::AVM_PUBLIC_INPUTS_COLUMN_LENGTHS
constexpr std::array< std::size_t, AVM_NUM_PUBLIC_INPUT_COLUMNS > AVM_PUBLIC_INPUTS_COLUMN_LENGTHS
Definition
constants.hpp:19
bb::avm2::Column
Column
Definition
columns.hpp:32
std::get
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition
tuple.hpp:13
precomputed_trace.hpp
public_inputs_trace.hpp
bb::avm2::PublicInputs
Definition
avm_io.hpp:27
bb::avm2::PublicInputs::to_columns
std::vector< std::vector< FF > > to_columns() const
Serialization to columns.
Definition
avm_io.cpp:142
constants.hpp
src
barretenberg
vm2
tracegen
public_inputs_trace.cpp
Generated by
1.9.8