Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
perms_execution.hpp
Go to the documentation of this file.
1// AUTOGENERATED FILE
2#pragma once
3
4#include <cstddef>
5#include <string_view>
6#include <tuple>
7
8#include "../columns.hpp"
11
12namespace bb::avm2 {
13
15
17 static constexpr std::string_view NAME = "PERM_EXECUTION_DISPATCH_TO_CD_COPY";
18 static constexpr std::string_view RELATION_NAME = "execution";
19 static constexpr size_t COLUMNS_PER_SET = 9;
20 static constexpr Column SRC_SELECTOR = Column::execution_sel_exec_dispatch_calldata_copy;
21 static constexpr Column DST_SELECTOR = Column::data_copy_sel_cd_copy_start;
22 static constexpr Column INVERSES = Column::perm_execution_dispatch_to_cd_copy_inv;
23 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> SRC_COLUMNS = {
24 ColumnAndShifts::precomputed_clk,
25 ColumnAndShifts::execution_parent_id,
26 ColumnAndShifts::execution_context_id,
27 ColumnAndShifts::execution_register_0_,
28 ColumnAndShifts::execution_register_1_,
29 ColumnAndShifts::execution_rop_2_,
30 ColumnAndShifts::execution_parent_calldata_addr,
31 ColumnAndShifts::execution_parent_calldata_size,
32 ColumnAndShifts::execution_sel_opcode_error
33 };
34 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> DST_COLUMNS = {
35 ColumnAndShifts::data_copy_clk,
36 ColumnAndShifts::data_copy_src_context_id,
37 ColumnAndShifts::data_copy_dst_context_id,
38 ColumnAndShifts::data_copy_copy_size,
39 ColumnAndShifts::data_copy_offset,
40 ColumnAndShifts::data_copy_dst_addr,
41 ColumnAndShifts::data_copy_src_addr,
42 ColumnAndShifts::data_copy_src_data_size,
43 ColumnAndShifts::data_copy_err
44 };
45};
46
48template <typename FF_>
51
53
55 static constexpr std::string_view NAME = "PERM_EXECUTION_DISPATCH_TO_RD_COPY";
56 static constexpr std::string_view RELATION_NAME = "execution";
57 static constexpr size_t COLUMNS_PER_SET = 9;
58 static constexpr Column SRC_SELECTOR = Column::execution_sel_exec_dispatch_returndata_copy;
59 static constexpr Column DST_SELECTOR = Column::data_copy_sel_rd_copy_start;
60 static constexpr Column INVERSES = Column::perm_execution_dispatch_to_rd_copy_inv;
61 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> SRC_COLUMNS = {
62 ColumnAndShifts::precomputed_clk,
63 ColumnAndShifts::execution_last_child_id,
64 ColumnAndShifts::execution_context_id,
65 ColumnAndShifts::execution_register_0_,
66 ColumnAndShifts::execution_register_1_,
67 ColumnAndShifts::execution_rop_2_,
68 ColumnAndShifts::execution_last_child_returndata_addr,
69 ColumnAndShifts::execution_last_child_returndata_size,
70 ColumnAndShifts::execution_sel_opcode_error
71 };
72 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> DST_COLUMNS = {
73 ColumnAndShifts::data_copy_clk,
74 ColumnAndShifts::data_copy_src_context_id,
75 ColumnAndShifts::data_copy_dst_context_id,
76 ColumnAndShifts::data_copy_copy_size,
77 ColumnAndShifts::data_copy_offset,
78 ColumnAndShifts::data_copy_dst_addr,
79 ColumnAndShifts::data_copy_src_addr,
80 ColumnAndShifts::data_copy_src_data_size,
81 ColumnAndShifts::data_copy_err
82 };
83};
84
86template <typename FF_>
89
91
93 static constexpr std::string_view NAME = "PERM_EXECUTION_DISPATCH_TO_GET_CONTRACT_INSTANCE";
94 static constexpr std::string_view RELATION_NAME = "execution";
95 static constexpr size_t COLUMNS_PER_SET = 8;
96 static constexpr Column SRC_SELECTOR = Column::execution_sel_exec_dispatch_get_contract_instance;
97 static constexpr Column DST_SELECTOR = Column::get_contract_instance_sel;
98 static constexpr Column INVERSES = Column::perm_execution_dispatch_to_get_contract_instance_inv;
99 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> SRC_COLUMNS = {
100 ColumnAndShifts::precomputed_clk,
101 ColumnAndShifts::execution_register_0_,
102 ColumnAndShifts::execution_rop_1_,
103 ColumnAndShifts::execution_rop_2_,
104 ColumnAndShifts::execution_context_id,
105 ColumnAndShifts::execution_nullifier_tree_root,
106 ColumnAndShifts::execution_public_data_tree_root,
107 ColumnAndShifts::execution_sel_opcode_error
108 };
109 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> DST_COLUMNS = {
110 ColumnAndShifts::get_contract_instance_clk,
111 ColumnAndShifts::get_contract_instance_contract_address,
112 ColumnAndShifts::get_contract_instance_dst_offset,
113 ColumnAndShifts::get_contract_instance_member_enum,
114 ColumnAndShifts::get_contract_instance_space_id,
115 ColumnAndShifts::get_contract_instance_nullifier_tree_root,
116 ColumnAndShifts::get_contract_instance_public_data_tree_root,
117 ColumnAndShifts::get_contract_instance_sel_error
118 };
119};
120
123template <typename FF_>
126
128
130 static constexpr std::string_view NAME = "PERM_EXECUTION_DISPATCH_TO_EMIT_UNENCRYPTED_LOG";
131 static constexpr std::string_view RELATION_NAME = "execution";
132 static constexpr size_t COLUMNS_PER_SET = 10;
133 static constexpr Column SRC_SELECTOR = Column::execution_sel_exec_dispatch_emit_unencrypted_log;
134 static constexpr Column DST_SELECTOR = Column::emit_unencrypted_log_start;
135 static constexpr Column INVERSES = Column::perm_execution_dispatch_to_emit_unencrypted_log_inv;
136 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> SRC_COLUMNS = {
137 ColumnAndShifts::precomputed_clk,
138 ColumnAndShifts::execution_context_id,
139 ColumnAndShifts::execution_rop_1_,
140 ColumnAndShifts::execution_register_0_,
141 ColumnAndShifts::execution_contract_address,
142 ColumnAndShifts::execution_prev_num_unencrypted_log_fields,
143 ColumnAndShifts::execution_num_unencrypted_log_fields,
144 ColumnAndShifts::execution_is_static,
145 ColumnAndShifts::execution_sel_opcode_error,
146 ColumnAndShifts::execution_discard
147 };
148 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> DST_COLUMNS = {
149 ColumnAndShifts::emit_unencrypted_log_execution_clk,
150 ColumnAndShifts::emit_unencrypted_log_space_id,
151 ColumnAndShifts::emit_unencrypted_log_log_address,
152 ColumnAndShifts::emit_unencrypted_log_log_size,
153 ColumnAndShifts::emit_unencrypted_log_contract_address,
154 ColumnAndShifts::emit_unencrypted_log_prev_num_unencrypted_log_fields,
155 ColumnAndShifts::emit_unencrypted_log_next_num_unencrypted_log_fields,
156 ColumnAndShifts::emit_unencrypted_log_is_static,
157 ColumnAndShifts::emit_unencrypted_log_error,
158 ColumnAndShifts::emit_unencrypted_log_discard
159 };
160};
161
164template <typename FF_>
167
169
171 static constexpr std::string_view NAME = "PERM_EXECUTION_DISPATCH_TO_POSEIDON2_PERM";
172 static constexpr std::string_view RELATION_NAME = "execution";
173 static constexpr size_t COLUMNS_PER_SET = 5;
174 static constexpr Column SRC_SELECTOR = Column::execution_sel_exec_dispatch_poseidon2_perm;
175 static constexpr Column DST_SELECTOR = Column::poseidon2_perm_mem_sel;
176 static constexpr Column INVERSES = Column::perm_execution_dispatch_to_poseidon2_perm_inv;
177 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> SRC_COLUMNS = {
178 ColumnAndShifts::precomputed_clk,
179 ColumnAndShifts::execution_context_id,
180 ColumnAndShifts::execution_rop_0_,
181 ColumnAndShifts::execution_rop_1_,
182 ColumnAndShifts::execution_sel_opcode_error
183 };
184 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> DST_COLUMNS = {
185 ColumnAndShifts::poseidon2_perm_mem_execution_clk,
186 ColumnAndShifts::poseidon2_perm_mem_space_id,
187 ColumnAndShifts::poseidon2_perm_mem_read_address_0_,
188 ColumnAndShifts::poseidon2_perm_mem_write_address_0_,
189 ColumnAndShifts::poseidon2_perm_mem_err
190 };
191};
192
195template <typename FF_>
198
200
202 static constexpr std::string_view NAME = "PERM_EXECUTION_DISPATCH_TO_SHA256_COMPRESSION";
203 static constexpr std::string_view RELATION_NAME = "execution";
204 static constexpr size_t COLUMNS_PER_SET = 6;
205 static constexpr Column SRC_SELECTOR = Column::execution_sel_exec_dispatch_sha256_compression;
206 static constexpr Column DST_SELECTOR = Column::sha256_start;
207 static constexpr Column INVERSES = Column::perm_execution_dispatch_to_sha256_compression_inv;
208 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> SRC_COLUMNS = {
209 ColumnAndShifts::precomputed_clk, ColumnAndShifts::execution_context_id,
210 ColumnAndShifts::execution_rop_0_, ColumnAndShifts::execution_rop_1_,
211 ColumnAndShifts::execution_rop_2_, ColumnAndShifts::execution_sel_opcode_error
212 };
213 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> DST_COLUMNS = {
214 ColumnAndShifts::sha256_execution_clk, ColumnAndShifts::sha256_space_id, ColumnAndShifts::sha256_output_addr,
215 ColumnAndShifts::sha256_state_addr, ColumnAndShifts::sha256_input_addr, ColumnAndShifts::sha256_err
216 };
217};
218
221template <typename FF_>
224
226
228 static constexpr std::string_view NAME = "PERM_EXECUTION_DISPATCH_TO_KECCAKF1600";
229 static constexpr std::string_view RELATION_NAME = "execution";
230 static constexpr size_t COLUMNS_PER_SET = 5;
231 static constexpr Column SRC_SELECTOR = Column::execution_sel_exec_dispatch_keccakf1600;
232 static constexpr Column DST_SELECTOR = Column::keccakf1600_start;
233 static constexpr Column INVERSES = Column::perm_execution_dispatch_to_keccakf1600_inv;
234 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> SRC_COLUMNS = {
235 ColumnAndShifts::precomputed_clk,
236 ColumnAndShifts::execution_rop_0_,
237 ColumnAndShifts::execution_rop_1_,
238 ColumnAndShifts::execution_context_id,
239 ColumnAndShifts::execution_sel_opcode_error
240 };
241 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> DST_COLUMNS = { ColumnAndShifts::keccakf1600_clk,
242 ColumnAndShifts::keccakf1600_dst_addr,
243 ColumnAndShifts::keccakf1600_src_addr,
244 ColumnAndShifts::keccakf1600_space_id,
245 ColumnAndShifts::keccakf1600_error };
246};
247
250template <typename FF_>
253
255
257 static constexpr std::string_view NAME = "PERM_EXECUTION_DISPATCH_TO_ECC_ADD";
258 static constexpr std::string_view RELATION_NAME = "execution";
259 static constexpr size_t COLUMNS_PER_SET = 10;
260 static constexpr Column SRC_SELECTOR = Column::execution_sel_exec_dispatch_ecc_add;
261 static constexpr Column DST_SELECTOR = Column::ecc_add_mem_sel;
262 static constexpr Column INVERSES = Column::perm_execution_dispatch_to_ecc_add_inv;
263 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> SRC_COLUMNS = {
264 ColumnAndShifts::precomputed_clk, ColumnAndShifts::execution_context_id,
265 ColumnAndShifts::execution_register_0_, ColumnAndShifts::execution_register_1_,
266 ColumnAndShifts::execution_register_2_, ColumnAndShifts::execution_register_3_,
267 ColumnAndShifts::execution_register_4_, ColumnAndShifts::execution_register_5_,
268 ColumnAndShifts::execution_rop_6_, ColumnAndShifts::execution_sel_opcode_error
269 };
270 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> DST_COLUMNS = {
271 ColumnAndShifts::ecc_add_mem_execution_clk, ColumnAndShifts::ecc_add_mem_space_id,
272 ColumnAndShifts::ecc_add_mem_p_x, ColumnAndShifts::ecc_add_mem_p_y,
273 ColumnAndShifts::ecc_add_mem_p_is_inf, ColumnAndShifts::ecc_add_mem_q_x,
274 ColumnAndShifts::ecc_add_mem_q_y, ColumnAndShifts::ecc_add_mem_q_is_inf,
275 ColumnAndShifts::ecc_add_mem_dst_addr_0_, ColumnAndShifts::ecc_add_mem_err
276 };
277};
278
280template <typename FF_>
283
285
287 static constexpr std::string_view NAME = "PERM_EXECUTION_DISPATCH_TO_TO_RADIX";
288 static constexpr std::string_view RELATION_NAME = "execution";
289 static constexpr size_t COLUMNS_PER_SET = 8;
290 static constexpr Column SRC_SELECTOR = Column::execution_sel_exec_dispatch_to_radix;
291 static constexpr Column DST_SELECTOR = Column::to_radix_mem_start;
292 static constexpr Column INVERSES = Column::perm_execution_dispatch_to_to_radix_inv;
293 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> SRC_COLUMNS = {
294 ColumnAndShifts::precomputed_clk, ColumnAndShifts::execution_context_id,
295 ColumnAndShifts::execution_register_0_, ColumnAndShifts::execution_register_1_,
296 ColumnAndShifts::execution_register_2_, ColumnAndShifts::execution_register_3_,
297 ColumnAndShifts::execution_rop_4_, ColumnAndShifts::execution_sel_opcode_error
298 };
299 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> DST_COLUMNS = {
300 ColumnAndShifts::to_radix_mem_execution_clk, ColumnAndShifts::to_radix_mem_space_id,
301 ColumnAndShifts::to_radix_mem_value_to_decompose, ColumnAndShifts::to_radix_mem_radix,
302 ColumnAndShifts::to_radix_mem_num_limbs, ColumnAndShifts::to_radix_mem_is_output_bits,
303 ColumnAndShifts::to_radix_mem_dst_addr, ColumnAndShifts::to_radix_mem_err
304 };
305};
306
309template <typename FF_>
312
313} // namespace bb::avm2
This file contains the template for the generic permutation that can be specialized to enforce variou...
static constexpr std::array< ColumnAndShifts, COLUMNS_PER_SET > SRC_COLUMNS
static constexpr std::array< ColumnAndShifts, COLUMNS_PER_SET > DST_COLUMNS
static constexpr std::array< ColumnAndShifts, COLUMNS_PER_SET > DST_COLUMNS
static constexpr std::array< ColumnAndShifts, COLUMNS_PER_SET > SRC_COLUMNS
static constexpr std::array< ColumnAndShifts, COLUMNS_PER_SET > DST_COLUMNS
static constexpr std::array< ColumnAndShifts, COLUMNS_PER_SET > SRC_COLUMNS
static constexpr std::array< ColumnAndShifts, COLUMNS_PER_SET > DST_COLUMNS
static constexpr std::array< ColumnAndShifts, COLUMNS_PER_SET > SRC_COLUMNS
static constexpr std::array< ColumnAndShifts, COLUMNS_PER_SET > SRC_COLUMNS
static constexpr std::array< ColumnAndShifts, COLUMNS_PER_SET > DST_COLUMNS
static constexpr std::array< ColumnAndShifts, COLUMNS_PER_SET > SRC_COLUMNS
static constexpr std::array< ColumnAndShifts, COLUMNS_PER_SET > DST_COLUMNS
static constexpr std::array< ColumnAndShifts, COLUMNS_PER_SET > SRC_COLUMNS
static constexpr std::array< ColumnAndShifts, COLUMNS_PER_SET > DST_COLUMNS
static constexpr std::array< ColumnAndShifts, COLUMNS_PER_SET > SRC_COLUMNS
static constexpr std::array< ColumnAndShifts, COLUMNS_PER_SET > DST_COLUMNS
static constexpr std::array< ColumnAndShifts, COLUMNS_PER_SET > SRC_COLUMNS
static constexpr std::array< ColumnAndShifts, COLUMNS_PER_SET > DST_COLUMNS