Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bc_retrieval_impl.hpp
Go to the documentation of this file.
1// AUTOGENERATED FILE
2#pragma once
3
6
7namespace bb::avm2 {
8
9template <typename FF_>
10template <typename ContainerOverSubrelations, typename AllEntities>
11void bc_retrievalImpl<FF_>::accumulate(ContainerOverSubrelations& evals,
12 const AllEntities& in,
13 [[maybe_unused]] const RelationParameters<FF_>&,
14 [[maybe_unused]] const FF_& scaling_factor)
15{
16 using C = ColumnAndShifts;
17
18 const auto constants_MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS = FF(21);
19 const auto constants_AVM_RETRIEVED_BYTECODES_TREE_INITIAL_SIZE = FF(1);
20 const auto bc_retrieval_REMAINING_BYTECODES = ((constants_MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS +
21 constants_AVM_RETRIEVED_BYTECODES_TREE_INITIAL_SIZE) -
22 in.get(C::bc_retrieval_prev_retrieved_bytecodes_tree_size));
23 const auto bc_retrieval_TOO_MANY_BYTECODES =
24 in.get(C::bc_retrieval_no_remaining_bytecodes) * in.get(C::bc_retrieval_is_new_class);
25
26 {
27 using View = typename std::tuple_element_t<0, ContainerOverSubrelations>::View;
28 auto tmp =
29 static_cast<View>(in.get(C::bc_retrieval_sel)) * (FF(1) - static_cast<View>(in.get(C::bc_retrieval_sel)));
30 std::get<0>(evals) += (tmp * scaling_factor);
31 }
32 { // TRACE_CONTINUITY
33 using View = typename std::tuple_element_t<1, ContainerOverSubrelations>::View;
34 auto tmp = (FF(1) - static_cast<View>(in.get(C::bc_retrieval_sel))) *
35 (FF(1) - static_cast<View>(in.get(C::precomputed_first_row))) *
36 static_cast<View>(in.get(C::bc_retrieval_sel_shift));
37 std::get<1>(evals) += (tmp * scaling_factor);
38 }
39 {
40 using View = typename std::tuple_element_t<2, ContainerOverSubrelations>::View;
41 auto tmp = static_cast<View>(in.get(C::bc_retrieval_instance_exists)) *
42 (FF(1) - static_cast<View>(in.get(C::bc_retrieval_instance_exists)));
43 std::get<2>(evals) += (tmp * scaling_factor);
44 }
45 {
46 using View = typename std::tuple_element_t<3, ContainerOverSubrelations>::View;
47 auto tmp = static_cast<View>(in.get(C::bc_retrieval_no_remaining_bytecodes)) *
48 (FF(1) - static_cast<View>(in.get(C::bc_retrieval_no_remaining_bytecodes)));
49 std::get<3>(evals) += (tmp * scaling_factor);
50 }
51 { // NO_REMAINING_BYTECODES
52 using View = typename std::tuple_element_t<4, ContainerOverSubrelations>::View;
53 auto tmp = static_cast<View>(in.get(C::bc_retrieval_sel)) *
54 ((CView(bc_retrieval_REMAINING_BYTECODES) *
55 (static_cast<View>(in.get(C::bc_retrieval_no_remaining_bytecodes)) *
56 (FF(1) - static_cast<View>(in.get(C::bc_retrieval_remaining_bytecodes_inv))) +
57 static_cast<View>(in.get(C::bc_retrieval_remaining_bytecodes_inv))) -
58 FF(1)) +
59 static_cast<View>(in.get(C::bc_retrieval_no_remaining_bytecodes)));
60 std::get<4>(evals) += (tmp * scaling_factor);
61 }
62 {
63 using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View;
64 auto tmp = static_cast<View>(in.get(C::bc_retrieval_sel)) *
65 (FF(1) - static_cast<View>(in.get(C::bc_retrieval_instance_exists))) *
66 static_cast<View>(in.get(C::bc_retrieval_is_new_class));
67 std::get<5>(evals) += (tmp * scaling_factor);
68 }
69 {
70 using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View;
71 auto tmp = static_cast<View>(in.get(C::bc_retrieval_sel)) *
72 (static_cast<View>(in.get(C::bc_retrieval_instance_exists)) *
73 (FF(1) - CView(bc_retrieval_TOO_MANY_BYTECODES)) -
74 (FF(1) - static_cast<View>(in.get(C::bc_retrieval_error))));
75 std::get<6>(evals) += (tmp * scaling_factor);
76 }
77 {
78 using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View;
79 auto tmp = (static_cast<View>(in.get(C::bc_retrieval_should_retrieve)) -
80 static_cast<View>(in.get(C::bc_retrieval_sel)) *
81 (FF(1) - static_cast<View>(in.get(C::bc_retrieval_error))));
82 std::get<7>(evals) += (tmp * scaling_factor);
83 }
84 { // CURRENT_CLASS_ID_IS_ZERO_IF_INSTANCE_DOES_NOT_EXIST
85 using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View;
86 auto tmp = static_cast<View>(in.get(C::bc_retrieval_sel)) *
87 (FF(1) - static_cast<View>(in.get(C::bc_retrieval_instance_exists))) *
88 static_cast<View>(in.get(C::bc_retrieval_current_class_id));
89 std::get<8>(evals) += (tmp * scaling_factor);
90 }
91 { // ARTIFACT_HASH_IS_ZERO_IF_ERROR
92 using View = typename std::tuple_element_t<9, ContainerOverSubrelations>::View;
93 auto tmp =
94 static_cast<View>(in.get(C::bc_retrieval_error)) * static_cast<View>(in.get(C::bc_retrieval_artifact_hash));
95 std::get<9>(evals) += (tmp * scaling_factor);
96 }
97 { // PRIVATE_FUNCTION_ROOT_IS_ZERO_IF_ERROR
98 using View = typename std::tuple_element_t<10, ContainerOverSubrelations>::View;
99 auto tmp = static_cast<View>(in.get(C::bc_retrieval_error)) *
100 static_cast<View>(in.get(C::bc_retrieval_private_function_root));
101 std::get<10>(evals) += (tmp * scaling_factor);
102 }
103 { // BYTECODE_ID_IS_ZERO_IF_ERROR
104 using View = typename std::tuple_element_t<11, ContainerOverSubrelations>::View;
105 auto tmp =
106 static_cast<View>(in.get(C::bc_retrieval_error)) * static_cast<View>(in.get(C::bc_retrieval_bytecode_id));
107 std::get<11>(evals) += (tmp * scaling_factor);
108 }
109 {
110 using View = typename std::tuple_element_t<12, ContainerOverSubrelations>::View;
111 auto tmp = static_cast<View>(in.get(C::bc_retrieval_error)) *
112 (static_cast<View>(in.get(C::bc_retrieval_next_retrieved_bytecodes_tree_root)) -
113 static_cast<View>(in.get(C::bc_retrieval_prev_retrieved_bytecodes_tree_root)));
114 std::get<12>(evals) += (tmp * scaling_factor);
115 }
116 {
117 using View = typename std::tuple_element_t<13, ContainerOverSubrelations>::View;
118 auto tmp = static_cast<View>(in.get(C::bc_retrieval_error)) *
119 (static_cast<View>(in.get(C::bc_retrieval_next_retrieved_bytecodes_tree_size)) -
120 static_cast<View>(in.get(C::bc_retrieval_prev_retrieved_bytecodes_tree_size)));
121 std::get<13>(evals) += (tmp * scaling_factor);
122 }
123}
124
125} // namespace bb::avm2
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &, const FF &scaling_factor)
ColumnAndShifts
Definition columns.hpp:34
AvmFlavorSettings::FF FF
Definition field.hpp:10
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
#define CView(v)
Container for parameters used by the grand product (permutation, lookup) Honk relations.