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 = 10;
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_exec_dispatch_calldata_copy,
33 ColumnAndShifts::execution_sel_opcode_error
34 };
35 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> DST_COLUMNS = {
36 ColumnAndShifts::data_copy_clk,
37 ColumnAndShifts::data_copy_src_context_id,
38 ColumnAndShifts::data_copy_dst_context_id,
39 ColumnAndShifts::data_copy_copy_size,
40 ColumnAndShifts::data_copy_offset,
41 ColumnAndShifts::data_copy_dst_addr,
42 ColumnAndShifts::data_copy_src_addr,
43 ColumnAndShifts::data_copy_src_data_size,
44 ColumnAndShifts::data_copy_sel_cd_copy,
45 ColumnAndShifts::data_copy_err
46 };
47};
48
50template <typename FF_>
53
55
57 static constexpr std::string_view NAME = "PERM_EXECUTION_DISPATCH_TO_RD_COPY";
58 static constexpr std::string_view RELATION_NAME = "execution";
59 static constexpr size_t COLUMNS_PER_SET = 10;
60 static constexpr Column SRC_SELECTOR = Column::execution_sel_exec_dispatch_returndata_copy;
61 static constexpr Column DST_SELECTOR = Column::data_copy_sel_rd_copy_start;
62 static constexpr Column INVERSES = Column::perm_execution_dispatch_to_rd_copy_inv;
63 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> SRC_COLUMNS = {
64 ColumnAndShifts::precomputed_clk,
65 ColumnAndShifts::execution_last_child_id,
66 ColumnAndShifts::execution_context_id,
67 ColumnAndShifts::execution_register_0_,
68 ColumnAndShifts::execution_register_1_,
69 ColumnAndShifts::execution_rop_2_,
70 ColumnAndShifts::execution_last_child_returndata_addr,
71 ColumnAndShifts::execution_last_child_returndata_size,
72 ColumnAndShifts::execution_sel_exec_dispatch_returndata_copy,
73 ColumnAndShifts::execution_sel_opcode_error
74 };
75 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> DST_COLUMNS = {
76 ColumnAndShifts::data_copy_clk,
77 ColumnAndShifts::data_copy_src_context_id,
78 ColumnAndShifts::data_copy_dst_context_id,
79 ColumnAndShifts::data_copy_copy_size,
80 ColumnAndShifts::data_copy_offset,
81 ColumnAndShifts::data_copy_dst_addr,
82 ColumnAndShifts::data_copy_src_addr,
83 ColumnAndShifts::data_copy_src_data_size,
84 ColumnAndShifts::data_copy_sel_rd_copy,
85 ColumnAndShifts::data_copy_err
86 };
87};
88
90template <typename FF_>
93
95
97 static constexpr std::string_view NAME = "PERM_EXECUTION_DISPATCH_TO_GET_CONTRACT_INSTANCE";
98 static constexpr std::string_view RELATION_NAME = "execution";
99 static constexpr size_t COLUMNS_PER_SET = 8;
100 static constexpr Column SRC_SELECTOR = Column::execution_sel_exec_dispatch_get_contract_instance;
101 static constexpr Column DST_SELECTOR = Column::get_contract_instance_sel;
102 static constexpr Column INVERSES = Column::perm_execution_dispatch_to_get_contract_instance_inv;
103 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> SRC_COLUMNS = {
104 ColumnAndShifts::precomputed_clk,
105 ColumnAndShifts::execution_register_0_,
106 ColumnAndShifts::execution_rop_1_,
107 ColumnAndShifts::execution_rop_2_,
108 ColumnAndShifts::execution_context_id,
109 ColumnAndShifts::execution_nullifier_tree_root,
110 ColumnAndShifts::execution_public_data_tree_root,
111 ColumnAndShifts::execution_sel_opcode_error
112 };
113 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> DST_COLUMNS = {
114 ColumnAndShifts::get_contract_instance_clk,
115 ColumnAndShifts::get_contract_instance_contract_address,
116 ColumnAndShifts::get_contract_instance_dst_offset,
117 ColumnAndShifts::get_contract_instance_member_enum,
118 ColumnAndShifts::get_contract_instance_space_id,
119 ColumnAndShifts::get_contract_instance_nullifier_tree_root,
120 ColumnAndShifts::get_contract_instance_public_data_tree_root,
121 ColumnAndShifts::get_contract_instance_sel_error
122 };
123};
124
127template <typename FF_>
130
132
134 static constexpr std::string_view NAME = "PERM_EXECUTION_DISPATCH_TO_POSEIDON2_PERM";
135 static constexpr std::string_view RELATION_NAME = "execution";
136 static constexpr size_t COLUMNS_PER_SET = 5;
137 static constexpr Column SRC_SELECTOR = Column::execution_sel_exec_dispatch_poseidon2_perm;
138 static constexpr Column DST_SELECTOR = Column::poseidon2_perm_mem_sel;
139 static constexpr Column INVERSES = Column::perm_execution_dispatch_to_poseidon2_perm_inv;
140 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> SRC_COLUMNS = {
141 ColumnAndShifts::precomputed_clk,
142 ColumnAndShifts::execution_context_id,
143 ColumnAndShifts::execution_rop_0_,
144 ColumnAndShifts::execution_rop_1_,
145 ColumnAndShifts::execution_sel_opcode_error
146 };
147 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> DST_COLUMNS = {
148 ColumnAndShifts::poseidon2_perm_mem_execution_clk,
149 ColumnAndShifts::poseidon2_perm_mem_space_id,
150 ColumnAndShifts::poseidon2_perm_mem_read_address_0_,
151 ColumnAndShifts::poseidon2_perm_mem_write_address_0_,
152 ColumnAndShifts::poseidon2_perm_mem_err
153 };
154};
155
158template <typename FF_>
161
163
165 static constexpr std::string_view NAME = "PERM_EXECUTION_DISPATCH_TO_SHA256_COMPRESSION";
166 static constexpr std::string_view RELATION_NAME = "execution";
167 static constexpr size_t COLUMNS_PER_SET = 6;
168 static constexpr Column SRC_SELECTOR = Column::execution_sel_exec_dispatch_sha256_compression;
169 static constexpr Column DST_SELECTOR = Column::sha256_start;
170 static constexpr Column INVERSES = Column::perm_execution_dispatch_to_sha256_compression_inv;
171 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> SRC_COLUMNS = {
172 ColumnAndShifts::precomputed_clk, ColumnAndShifts::execution_context_id,
173 ColumnAndShifts::execution_rop_0_, ColumnAndShifts::execution_rop_1_,
174 ColumnAndShifts::execution_rop_2_, ColumnAndShifts::execution_sel_opcode_error
175 };
176 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> DST_COLUMNS = {
177 ColumnAndShifts::sha256_execution_clk, ColumnAndShifts::sha256_space_id, ColumnAndShifts::sha256_output_addr,
178 ColumnAndShifts::sha256_state_addr, ColumnAndShifts::sha256_input_addr, ColumnAndShifts::sha256_err
179 };
180};
181
184template <typename FF_>
187
189
191 static constexpr std::string_view NAME = "PERM_EXECUTION_DISPATCH_TO_KECCAKF1600";
192 static constexpr std::string_view RELATION_NAME = "execution";
193 static constexpr size_t COLUMNS_PER_SET = 5;
194 static constexpr Column SRC_SELECTOR = Column::execution_sel_exec_dispatch_keccakf1600;
195 static constexpr Column DST_SELECTOR = Column::keccakf1600_start;
196 static constexpr Column INVERSES = Column::perm_execution_dispatch_to_keccakf1600_inv;
197 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> SRC_COLUMNS = {
198 ColumnAndShifts::precomputed_clk,
199 ColumnAndShifts::execution_rop_0_,
200 ColumnAndShifts::execution_rop_1_,
201 ColumnAndShifts::execution_context_id,
202 ColumnAndShifts::execution_sel_opcode_error
203 };
204 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> DST_COLUMNS = { ColumnAndShifts::keccakf1600_clk,
205 ColumnAndShifts::keccakf1600_dst_addr,
206 ColumnAndShifts::keccakf1600_src_addr,
207 ColumnAndShifts::keccakf1600_space_id,
208 ColumnAndShifts::keccakf1600_error };
209};
210
213template <typename FF_>
216
218
220 static constexpr std::string_view NAME = "PERM_EXECUTION_DISPATCH_TO_ECC_ADD";
221 static constexpr std::string_view RELATION_NAME = "execution";
222 static constexpr size_t COLUMNS_PER_SET = 10;
223 static constexpr Column SRC_SELECTOR = Column::execution_sel_exec_dispatch_ecc_add;
224 static constexpr Column DST_SELECTOR = Column::ecc_add_mem_sel;
225 static constexpr Column INVERSES = Column::perm_execution_dispatch_to_ecc_add_inv;
226 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> SRC_COLUMNS = {
227 ColumnAndShifts::precomputed_clk, ColumnAndShifts::execution_context_id,
228 ColumnAndShifts::execution_register_0_, ColumnAndShifts::execution_register_1_,
229 ColumnAndShifts::execution_register_2_, ColumnAndShifts::execution_register_3_,
230 ColumnAndShifts::execution_register_4_, ColumnAndShifts::execution_register_5_,
231 ColumnAndShifts::execution_rop_6_, ColumnAndShifts::execution_sel_opcode_error
232 };
233 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> DST_COLUMNS = {
234 ColumnAndShifts::ecc_add_mem_execution_clk, ColumnAndShifts::ecc_add_mem_space_id,
235 ColumnAndShifts::ecc_add_mem_p_x, ColumnAndShifts::ecc_add_mem_p_y,
236 ColumnAndShifts::ecc_add_mem_p_is_inf, ColumnAndShifts::ecc_add_mem_q_x,
237 ColumnAndShifts::ecc_add_mem_q_y, ColumnAndShifts::ecc_add_mem_q_is_inf,
238 ColumnAndShifts::ecc_add_mem_dst_addr_0_, ColumnAndShifts::ecc_add_mem_err
239 };
240};
241
243template <typename FF_>
246
248
250 static constexpr std::string_view NAME = "PERM_EXECUTION_DISPATCH_TO_TO_RADIX";
251 static constexpr std::string_view RELATION_NAME = "execution";
252 static constexpr size_t COLUMNS_PER_SET = 8;
253 static constexpr Column SRC_SELECTOR = Column::execution_sel_exec_dispatch_to_radix;
254 static constexpr Column DST_SELECTOR = Column::to_radix_mem_start;
255 static constexpr Column INVERSES = Column::perm_execution_dispatch_to_to_radix_inv;
256 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> SRC_COLUMNS = {
257 ColumnAndShifts::precomputed_clk, ColumnAndShifts::execution_context_id,
258 ColumnAndShifts::execution_register_0_, ColumnAndShifts::execution_register_1_,
259 ColumnAndShifts::execution_register_2_, ColumnAndShifts::execution_register_3_,
260 ColumnAndShifts::execution_rop_4_, ColumnAndShifts::execution_sel_opcode_error
261 };
262 static constexpr std::array<ColumnAndShifts, COLUMNS_PER_SET> DST_COLUMNS = {
263 ColumnAndShifts::to_radix_mem_execution_clk, ColumnAndShifts::to_radix_mem_space_id,
264 ColumnAndShifts::to_radix_mem_value_to_decompose, ColumnAndShifts::to_radix_mem_radix,
265 ColumnAndShifts::to_radix_mem_num_limbs, ColumnAndShifts::to_radix_mem_is_output_bits,
266 ColumnAndShifts::to_radix_mem_dst_addr, ColumnAndShifts::to_radix_mem_err
267 };
268};
269
272template <typename FF_>
275
276} // 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 > 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