Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
mega_execution_trace.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: Complete, auditors: [Luke, Raju], commit: }
3// external_1: { status: not started, auditors: [], commit: }
4// external_2: { status: not started, auditors: [], commit: }
5// =====================
6
7#pragma once
8
16#include <cstdint>
17
18namespace bb {
19
20using MegaTraceBlock = ExecutionTraceBlock<fr, /*NUM_WIRES_ */ 4>;
21
37 MegaTraceBlock ecc_op{}; // Must remain first; no gate selector.
40 MegaTraceBlock pub_inputs{}; // No gate selector.
50
51 static constexpr size_t NUM_BLOCKS = 11;
52
54 {
55 return { "ecc_op",
56 "busread",
57 "lookup",
58 "pub_inputs",
59 "arithmetic",
60 "delta_range",
61 "elliptic",
62 "memory",
63 "nnf",
64 "poseidon2_external",
65 "poseidon2_quad_internal" };
66 }
67
82
97
98 auto get_gate_blocks() const
99 {
100 // Order must match get_gate_selectors() in MegaFlavor: poseidon2_external appears twice
101 // (regular + initial) and poseidon2_quad_internal appears three times (interior /
102 // terminal / entry).
104 &busread,
105 &lookup,
106 &arithmetic,
108 &elliptic,
109 &memory,
110 &nnf,
111 &poseidon2_external, // q_poseidon2_external
112 &poseidon2_external, // q_poseidon2_external_initial
113 &poseidon2_quad_internal, // q_poseidon2_quad_internal
114 &poseidon2_quad_internal, // q_poseidon2_quad_internal_terminal
115 &poseidon2_quad_internal, // q_poseidon2_transition_entry
116 });
117 }
118
119 bool operator==(const MegaTraceBlockData& other) const = default;
120};
121
123 public:
124 static constexpr size_t NUM_WIRES = MegaTraceBlock::NUM_WIRES;
125
126 using FF = fr;
127
129
130 void compute_offsets(size_t trace_offset)
131 {
132 uint32_t offset = static_cast<uint32_t>(trace_offset + NUM_ZERO_ROWS);
133 for (auto& block : this->get()) {
134 block.trace_offset_ = offset;
135 offset += static_cast<uint32_t>(block.size());
136 }
137 }
138
139 void summarize() const
140 {
141 info("Gate blocks summary:");
142 info("goblin ecc op :\t", this->ecc_op.size());
143 info("busread :\t", this->busread.size());
144 info("lookups :\t", this->lookup.size());
145 info("pub inputs :\t", this->pub_inputs.size(), " (populated in decider pk constructor)");
146 info("arithmetic :\t", this->arithmetic.size());
147 info("delta range :\t", this->delta_range.size());
148 info("elliptic :\t", this->elliptic.size());
149 info("memory :\t", this->memory.size());
150 info("nnf :\t", this->nnf.size());
151 info("poseidon ext :\t", this->poseidon2_external.size());
152 info("poseidon quad :\t", this->poseidon2_quad_internal.size());
153 info("");
154 info("Total size: ", get_total_size());
155 }
156
157 // Get cumulative size of all blocks
159 {
160 size_t total_size(0);
161 for (const auto& block : this->get()) {
162 total_size += block.size();
163 }
164 return total_size;
165 }
166
167 size_t get_total_size() const
168 {
169 size_t total_size = 1; // start at 1 because the 0th row is unused for selectors for Honk
170 for (const auto& block : this->get()) {
171 total_size += block.size();
172 }
173 return total_size;
174 }
175
176 bool operator==(const MegaExecutionTraceBlocks& other) const = default;
177};
178
179} // namespace bb
bool operator==(const MegaExecutionTraceBlocks &other) const =default
void compute_offsets(size_t trace_offset)
A template class for a reference array. Behaves as if std::array<T&, N> was possible.
Definition ref_array.hpp:22
#define info(...)
Definition log.hpp:93
ssize_t offset
Definition engine.cpp:62
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
field< Bn254FrParams > fr
Definition fr.hpp:155
@ Poseidon2QuadIntTerminal
@ Poseidon2TransitionEntry
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
A container indexed by the types of the blocks in the execution trace.
static constexpr size_t NUM_BLOCKS
bool operator==(const MegaTraceBlockData &other) const =default
std::vector< std::string_view > get_labels() const