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_HEIGHT = FF(5);
20 const auto constants_AVM_RETRIEVED_BYTECODES_TREE_INITIAL_SIZE = FF(1);
21 const auto bc_retrieval_REMAINING_BYTECODES = ((constants_MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS +
22 constants_AVM_RETRIEVED_BYTECODES_TREE_INITIAL_SIZE) -
23 in.get(C::bc_retrieval_prev_retrieved_bytecodes_tree_size));
24 const auto bc_retrieval_TOO_MANY_BYTECODES =
25 in.get(C::bc_retrieval_no_remaining_bytecodes) * in.get(C::bc_retrieval_is_new_class);
26 const auto bc_retrieval_INSTANCE_NOT_FOUND = (FF(1) - in.get(C::bc_retrieval_instance_exists));
28 {
29 using View = typename std::tuple_element_t<0, ContainerOverSubrelations>::View;
30 auto tmp =
31 static_cast<View>(in.get(C::bc_retrieval_sel)) * (FF(1) - static_cast<View>(in.get(C::bc_retrieval_sel)));
32 std::get<0>(evals) += (tmp * scaling_factor);
33 }
34 {
35 using View = typename std::tuple_element_t<1, ContainerOverSubrelations>::View;
36 auto tmp = static_cast<View>(in.get(C::bc_retrieval_no_remaining_bytecodes)) *
37 (FF(1) - static_cast<View>(in.get(C::bc_retrieval_no_remaining_bytecodes)));
38 std::get<1>(evals) += (tmp * scaling_factor);
39 }
40 { // NO_REMAINING_BYTECODES
41 using View = typename std::tuple_element_t<2, ContainerOverSubrelations>::View;
42 auto tmp = static_cast<View>(in.get(C::bc_retrieval_sel)) *
43 ((CView(bc_retrieval_REMAINING_BYTECODES) *
44 (static_cast<View>(in.get(C::bc_retrieval_no_remaining_bytecodes)) *
45 (FF(1) - static_cast<View>(in.get(C::bc_retrieval_remaining_bytecodes_inv))) +
46 static_cast<View>(in.get(C::bc_retrieval_remaining_bytecodes_inv))) -
47 FF(1)) +
48 static_cast<View>(in.get(C::bc_retrieval_no_remaining_bytecodes)));
49 std::get<2>(evals) += (tmp * scaling_factor);
50 }
51 { // NEW_CLASS_IS_ZERO_IF_INSTANCE_DOES_NOT_EXIST
52 using View = typename std::tuple_element_t<3, ContainerOverSubrelations>::View;
53 auto tmp = CView(bc_retrieval_INSTANCE_NOT_FOUND) * static_cast<View>(in.get(C::bc_retrieval_is_new_class));
54 std::get<3>(evals) += (tmp * scaling_factor);
55 }
56 { // ERROR_CHECK
57 using View = typename std::tuple_element_t<4, ContainerOverSubrelations>::View;
58 auto tmp = static_cast<View>(in.get(C::bc_retrieval_sel)) *
59 ((CView(bc_retrieval_INSTANCE_NOT_FOUND) + CView(bc_retrieval_TOO_MANY_BYTECODES)) -
60 static_cast<View>(in.get(C::bc_retrieval_error)));
61 std::get<4>(evals) += (tmp * scaling_factor);
62 }
63 { // BYTECODE_ID_IS_ZERO_IF_ERROR
64 using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View;
65 auto tmp =
66 static_cast<View>(in.get(C::bc_retrieval_error)) * static_cast<View>(in.get(C::bc_retrieval_bytecode_id));
67 std::get<5>(evals) += (tmp * scaling_factor);
68 }
69 { // RETRIEVED_BYTECODES_TREE_ROOT_NOT_CHANGED_IF_ERROR
70 using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View;
71 auto tmp = static_cast<View>(in.get(C::bc_retrieval_error)) *
72 (static_cast<View>(in.get(C::bc_retrieval_next_retrieved_bytecodes_tree_root)) -
73 static_cast<View>(in.get(C::bc_retrieval_prev_retrieved_bytecodes_tree_root)));
74 std::get<6>(evals) += (tmp * scaling_factor);
75 }
76 { // RETRIEVED_BYTECODES_TREE_SIZE_NOT_CHANGED_IF_ERROR
77 using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View;
78 auto tmp = static_cast<View>(in.get(C::bc_retrieval_error)) *
79 (static_cast<View>(in.get(C::bc_retrieval_next_retrieved_bytecodes_tree_size)) -
80 static_cast<View>(in.get(C::bc_retrieval_prev_retrieved_bytecodes_tree_size)));
81 std::get<7>(evals) += (tmp * scaling_factor);
82 }
83 {
84 using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View;
85 auto tmp = (static_cast<View>(in.get(C::bc_retrieval_should_retrieve)) -
86 static_cast<View>(in.get(C::bc_retrieval_sel)) *
87 (FF(1) - static_cast<View>(in.get(C::bc_retrieval_error))));
88 std::get<8>(evals) += (tmp * scaling_factor);
89 }
90 {
91 using View = typename std::tuple_element_t<9, ContainerOverSubrelations>::View;
92 auto tmp = static_cast<View>(in.get(C::bc_retrieval_sel)) *
93 (static_cast<View>(in.get(C::bc_retrieval_retrieved_bytecodes_tree_height)) -
94 CView(constants_AVM_RETRIEVED_BYTECODES_TREE_HEIGHT));
95 std::get<9>(evals) += (tmp * scaling_factor);
96 }
97}
98
99} // namespace bb::avm2
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &, const FF &scaling_factor)
AvmFlavorSettings::FF FF
Definition field.hpp:10
ColumnAndShifts
Definition columns.hpp:34
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.