Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
nullifier_check_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 nullifier_checkImpl<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_NULLIFIER_TREE_HEIGHT = FF(42);
19 const auto constants_AVM_PUBLIC_INPUTS_AVM_ACCUMULATED_DATA_NULLIFIERS_ROW_IDX = FF(450);
20 const auto constants_GENERATOR_INDEX__OUTER_NULLIFIER = FF(7);
21 const auto nullifier_check_NULLIFIER_LOW_LEAF_NULLIFIER_DIFF =
22 (in.get(C::nullifier_check_siloed_nullifier) - in.get(C::nullifier_check_low_leaf_nullifier));
23 const auto nullifier_check_NEXT_NULLIFIER_IS_ZERO = (FF(1) - in.get(C::nullifier_check_next_nullifier_is_nonzero));
24
25 {
26 using View = typename std::tuple_element_t<0, ContainerOverSubrelations>::View;
27 auto tmp = static_cast<View>(in.get(C::nullifier_check_sel)) *
28 (FF(1) - static_cast<View>(in.get(C::nullifier_check_sel)));
29 std::get<0>(evals) += (tmp * scaling_factor);
30 }
31 {
32 using View = typename std::tuple_element_t<1, ContainerOverSubrelations>::View;
33 auto tmp = static_cast<View>(in.get(C::nullifier_check_write)) *
34 (FF(1) - static_cast<View>(in.get(C::nullifier_check_write)));
35 std::get<1>(evals) += (tmp * scaling_factor);
36 }
37 {
38 using View = typename std::tuple_element_t<2, ContainerOverSubrelations>::View;
39 auto tmp = static_cast<View>(in.get(C::nullifier_check_write)) *
40 (FF(1) - static_cast<View>(in.get(C::nullifier_check_sel)));
41 std::get<2>(evals) += (tmp * scaling_factor);
42 }
43 {
44 using View = typename std::tuple_element_t<3, ContainerOverSubrelations>::View;
45 auto tmp = static_cast<View>(in.get(C::nullifier_check_exists)) *
46 (FF(1) - static_cast<View>(in.get(C::nullifier_check_exists)));
47 std::get<3>(evals) += (tmp * scaling_factor);
48 }
49 {
50 using View = typename std::tuple_element_t<4, ContainerOverSubrelations>::View;
51 auto tmp = static_cast<View>(in.get(C::nullifier_check_should_silo)) *
52 (FF(1) - static_cast<View>(in.get(C::nullifier_check_should_silo)));
53 std::get<4>(evals) += (tmp * scaling_factor);
54 }
55 { // PASSTHROUGH_SILOING
56 using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View;
57 auto tmp = (FF(1) - static_cast<View>(in.get(C::nullifier_check_should_silo))) *
58 (static_cast<View>(in.get(C::nullifier_check_nullifier)) -
59 static_cast<View>(in.get(C::nullifier_check_siloed_nullifier)));
60 std::get<5>(evals) += (tmp * scaling_factor);
61 }
62 {
63 using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View;
64 auto tmp = static_cast<View>(in.get(C::nullifier_check_sel)) *
65 (CView(constants_GENERATOR_INDEX__OUTER_NULLIFIER) -
66 static_cast<View>(in.get(C::nullifier_check_siloing_separator)));
67 std::get<6>(evals) += (tmp * scaling_factor);
68 }
69 {
70 using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View;
71 auto tmp = (static_cast<View>(in.get(C::nullifier_check_should_insert)) -
72 static_cast<View>(in.get(C::nullifier_check_write)) *
73 (FF(1) - static_cast<View>(in.get(C::nullifier_check_exists))));
74 std::get<7>(evals) += (tmp * scaling_factor);
75 }
76 {
77 using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View;
78 auto tmp = static_cast<View>(in.get(C::nullifier_check_write)) *
79 static_cast<View>(in.get(C::nullifier_check_exists)) *
80 (static_cast<View>(in.get(C::nullifier_check_root)) -
81 static_cast<View>(in.get(C::nullifier_check_write_root)));
82 std::get<8>(evals) += (tmp * scaling_factor);
83 }
84 {
85 using View = typename std::tuple_element_t<9, ContainerOverSubrelations>::View;
86 auto tmp = static_cast<View>(in.get(C::nullifier_check_should_insert)) *
87 (static_cast<View>(in.get(C::nullifier_check_tree_size_before_write)) -
88 static_cast<View>(in.get(C::nullifier_check_updated_low_leaf_next_index)));
89 std::get<9>(evals) += (tmp * scaling_factor);
90 }
91 {
92 using View = typename std::tuple_element_t<10, ContainerOverSubrelations>::View;
93 auto tmp = static_cast<View>(in.get(C::nullifier_check_should_insert)) *
94 (static_cast<View>(in.get(C::nullifier_check_siloed_nullifier)) -
95 static_cast<View>(in.get(C::nullifier_check_updated_low_leaf_next_nullifier)));
96 std::get<10>(evals) += (tmp * scaling_factor);
97 }
98 {
99 using View = typename std::tuple_element_t<11, ContainerOverSubrelations>::View;
100 auto tmp = static_cast<View>(in.get(C::nullifier_check_sel)) *
101 (static_cast<View>(in.get(C::nullifier_check_tree_height)) - CView(constants_NULLIFIER_TREE_HEIGHT));
102 std::get<11>(evals) += (tmp * scaling_factor);
103 }
104 { // EXISTS_CHECK
105 using View = typename std::tuple_element_t<12, ContainerOverSubrelations>::View;
106 auto tmp =
107 static_cast<View>(in.get(C::nullifier_check_sel)) *
108 ((CView(nullifier_check_NULLIFIER_LOW_LEAF_NULLIFIER_DIFF) *
109 (static_cast<View>(in.get(C::nullifier_check_exists)) *
110 (FF(1) - static_cast<View>(in.get(C::nullifier_check_nullifier_low_leaf_nullifier_diff_inv))) +
111 static_cast<View>(in.get(C::nullifier_check_nullifier_low_leaf_nullifier_diff_inv))) -
112 FF(1)) +
113 static_cast<View>(in.get(C::nullifier_check_exists)));
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::nullifier_check_sel)) *
119 ((FF(1) - static_cast<View>(in.get(C::nullifier_check_exists))) -
120 static_cast<View>(in.get(C::nullifier_check_leaf_not_exists)));
121 std::get<13>(evals) += (tmp * scaling_factor);
122 }
123 {
124 using View = typename std::tuple_element_t<14, ContainerOverSubrelations>::View;
125 auto tmp = static_cast<View>(in.get(C::nullifier_check_next_nullifier_is_nonzero)) *
126 (FF(1) - static_cast<View>(in.get(C::nullifier_check_next_nullifier_is_nonzero)));
127 std::get<14>(evals) += (tmp * scaling_factor);
128 }
129 { // NEXT_NULLIFIER_IS_ZERO_CHECK
130 using View = typename std::tuple_element_t<15, ContainerOverSubrelations>::View;
131 auto tmp = static_cast<View>(in.get(C::nullifier_check_leaf_not_exists)) *
132 ((static_cast<View>(in.get(C::nullifier_check_low_leaf_next_nullifier)) *
133 (CView(nullifier_check_NEXT_NULLIFIER_IS_ZERO) *
134 (FF(1) - static_cast<View>(in.get(C::nullifier_check_next_nullifier_inv))) +
135 static_cast<View>(in.get(C::nullifier_check_next_nullifier_inv))) -
136 FF(1)) +
137 CView(nullifier_check_NEXT_NULLIFIER_IS_ZERO));
138 std::get<15>(evals) += (tmp * scaling_factor);
139 }
140 {
141 using View = typename std::tuple_element_t<16, ContainerOverSubrelations>::View;
142 auto tmp = (static_cast<View>(in.get(C::nullifier_check_should_insert)) *
143 (FF(1) - static_cast<View>(in.get(C::nullifier_check_discard))) -
144 static_cast<View>(in.get(C::nullifier_check_should_write_to_public_inputs)));
145 std::get<16>(evals) += (tmp * scaling_factor);
146 }
147 {
148 using View = typename std::tuple_element_t<17, ContainerOverSubrelations>::View;
149 auto tmp = static_cast<View>(in.get(C::nullifier_check_should_write_to_public_inputs)) *
150 ((CView(constants_AVM_PUBLIC_INPUTS_AVM_ACCUMULATED_DATA_NULLIFIERS_ROW_IDX) +
151 static_cast<View>(in.get(C::nullifier_check_nullifier_index))) -
152 static_cast<View>(in.get(C::nullifier_check_public_inputs_index)));
153 std::get<17>(evals) += (tmp * scaling_factor);
154 }
155}
156
157} // 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.