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.
2
3#include <array>
4
5#include "barretenberg/aztec/aztec_constants.hpp"
8
9namespace bb::avm2::tracegen {
10
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
46static_assert(PRECOMPUTED_TRACE_SIZE >= AVM_PUBLIC_INPUTS_COLUMNS_MAX_LENGTH);
47
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
void process_public_inputs(TraceContainer &trace, const PublicInputs &public_inputs)
Populate the public inputs trace columns from the given public inputs.
void process_public_inputs_aux_precomputed(TraceContainer &trace)
Populate the auxiliary precomputed selector for the public inputs subtrace.
TestTraceContainer trace
constexpr uint32_t PRECOMPUTED_TRACE_SIZE
constexpr std::array< std::size_t, AVM_NUM_PUBLIC_INPUT_COLUMNS > AVM_PUBLIC_INPUTS_COLUMN_LENGTHS
Definition constants.hpp:19
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
std::vector< std::vector< FF > > to_columns() const
Serialization to columns.
Definition avm_io.cpp:142