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 const auto bc_retrieval_INSTANCE_NOT_FOUND = (FF(1) - in.get(C::bc_retrieval_instance_exists));
26
27 {
28 using View = typename std::tuple_element_t<0, ContainerOverSubrelations>::View;
29 auto tmp =
30 static_cast<View>(in.get(C::bc_retrieval_sel)) * (FF(1) - static_cast<View>(in.get(C::bc_retrieval_sel)));
31 std::get<0>(evals) += (tmp * scaling_factor);
32 }
33 {
34 using View = typename std::tuple_element_t<1, ContainerOverSubrelations>::View;
35 auto tmp = static_cast<View>(in.get(C::bc_retrieval_no_remaining_bytecodes)) *
36 (FF(1) - static_cast<View>(in.get(C::bc_retrieval_no_remaining_bytecodes)));
37 std::get<1>(evals) += (tmp * scaling_factor);
38 }
39 { // NO_REMAINING_BYTECODES
40 using View = typename std::tuple_element_t<2, ContainerOverSubrelations>::View;
41 auto tmp = static_cast<View>(in.get(C::bc_retrieval_sel)) *
42 ((CView(bc_retrieval_REMAINING_BYTECODES) *
43 (static_cast<View>(in.get(C::bc_retrieval_no_remaining_bytecodes)) *
44 (FF(1) - static_cast<View>(in.get(C::bc_retrieval_remaining_bytecodes_inv))) +
45 static_cast<View>(in.get(C::bc_retrieval_remaining_bytecodes_inv))) -
46 FF(1)) +
47 static_cast<View>(in.get(C::bc_retrieval_no_remaining_bytecodes)));
48 std::get<2>(evals) += (tmp * scaling_factor);
49 }
50 { // NEW_CLASS_IS_ZERO_IF_INSTANCE_DOES_NOT_EXIST
51 using View = typename std::tuple_element_t<3, ContainerOverSubrelations>::View;
52 auto tmp = CView(bc_retrieval_INSTANCE_NOT_FOUND) * static_cast<View>(in.get(C::bc_retrieval_is_new_class));
53 std::get<3>(evals) += (tmp * scaling_factor);
54 }
55 { // ERROR_CHECK
56 using View = typename std::tuple_element_t<4, ContainerOverSubrelations>::View;
57 auto tmp = static_cast<View>(in.get(C::bc_retrieval_sel)) *
58 ((CView(bc_retrieval_INSTANCE_NOT_FOUND) + CView(bc_retrieval_TOO_MANY_BYTECODES)) -
59 static_cast<View>(in.get(C::bc_retrieval_error)));
60 std::get<4>(evals) += (tmp * scaling_factor);
61 }
62 { // BYTECODE_ID_IS_ZERO_IF_ERROR
63 using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View;
64 auto tmp =
65 static_cast<View>(in.get(C::bc_retrieval_error)) * static_cast<View>(in.get(C::bc_retrieval_bytecode_id));
66 std::get<5>(evals) += (tmp * scaling_factor);
67 }
68 { // RETRIEVED_BYTECODES_TREE_ROOT_NOT_CHANGED_IF_ERROR
69 using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View;
70 auto tmp = static_cast<View>(in.get(C::bc_retrieval_error)) *
71 (static_cast<View>(in.get(C::bc_retrieval_next_retrieved_bytecodes_tree_root)) -
72 static_cast<View>(in.get(C::bc_retrieval_prev_retrieved_bytecodes_tree_root)));
73 std::get<6>(evals) += (tmp * scaling_factor);
74 }
75 { // RETRIEVED_BYTECODES_TREE_SIZE_NOT_CHANGED_IF_ERROR
76 using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View;
77 auto tmp = static_cast<View>(in.get(C::bc_retrieval_error)) *
78 (static_cast<View>(in.get(C::bc_retrieval_next_retrieved_bytecodes_tree_size)) -
79 static_cast<View>(in.get(C::bc_retrieval_prev_retrieved_bytecodes_tree_size)));
80 std::get<7>(evals) += (tmp * scaling_factor);
81 }
82 {
83 using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View;
84 auto tmp = (static_cast<View>(in.get(C::bc_retrieval_should_retrieve)) -
85 static_cast<View>(in.get(C::bc_retrieval_sel)) *
86 (FF(1) - static_cast<View>(in.get(C::bc_retrieval_error))));
87 std::get<8>(evals) += (tmp * scaling_factor);
88 }
89}
90
91} // 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.