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_DOM_SEP__SILOED_NULLIFIER = FF(57496191);
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_DOM_SEP__SILOED_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_sel)) *
72 (static_cast<View>(in.get(C::nullifier_check_const_three)) - FF(3));
73 std::get<7>(evals) += (tmp * scaling_factor);
74 }
75 {
76 using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View;
77 auto tmp = (static_cast<View>(in.get(C::nullifier_check_should_insert)) -
78 static_cast<View>(in.get(C::nullifier_check_write)) *
79 (FF(1) - static_cast<View>(in.get(C::nullifier_check_exists))));
80 std::get<8>(evals) += (tmp * scaling_factor);
81 }
82 {
83 using View = typename std::tuple_element_t<9, ContainerOverSubrelations>::View;
84 auto tmp = static_cast<View>(in.get(C::nullifier_check_write)) *
85 static_cast<View>(in.get(C::nullifier_check_exists)) *
86 (static_cast<View>(in.get(C::nullifier_check_root)) -
87 static_cast<View>(in.get(C::nullifier_check_write_root)));
88 std::get<9>(evals) += (tmp * scaling_factor);
89 }
90 {
91 using View = typename std::tuple_element_t<10, ContainerOverSubrelations>::View;
92 auto tmp = static_cast<View>(in.get(C::nullifier_check_should_insert)) *
93 (static_cast<View>(in.get(C::nullifier_check_tree_size_before_write)) -
94 static_cast<View>(in.get(C::nullifier_check_updated_low_leaf_next_index)));
95 std::get<10>(evals) += (tmp * scaling_factor);
96 }
97 {
98 using View = typename std::tuple_element_t<11, ContainerOverSubrelations>::View;
99 auto tmp = static_cast<View>(in.get(C::nullifier_check_should_insert)) *
100 (static_cast<View>(in.get(C::nullifier_check_siloed_nullifier)) -
101 static_cast<View>(in.get(C::nullifier_check_updated_low_leaf_next_nullifier)));
102 std::get<11>(evals) += (tmp * scaling_factor);
103 }
104 {
105 using View = typename std::tuple_element_t<12, ContainerOverSubrelations>::View;
106 auto tmp = static_cast<View>(in.get(C::nullifier_check_sel)) *
107 (static_cast<View>(in.get(C::nullifier_check_tree_height)) - CView(constants_NULLIFIER_TREE_HEIGHT));
108 std::get<12>(evals) += (tmp * scaling_factor);
109 }
110 { // EXISTS_CHECK
111 using View = typename std::tuple_element_t<13, ContainerOverSubrelations>::View;
112 auto tmp =
113 static_cast<View>(in.get(C::nullifier_check_sel)) *
114 ((CView(nullifier_check_NULLIFIER_LOW_LEAF_NULLIFIER_DIFF) *
115 (static_cast<View>(in.get(C::nullifier_check_exists)) *
116 (FF(1) - static_cast<View>(in.get(C::nullifier_check_nullifier_low_leaf_nullifier_diff_inv))) +
117 static_cast<View>(in.get(C::nullifier_check_nullifier_low_leaf_nullifier_diff_inv))) -
118 FF(1)) +
119 static_cast<View>(in.get(C::nullifier_check_exists)));
120 std::get<13>(evals) += (tmp * scaling_factor);
121 }
122 {
123 using View = typename std::tuple_element_t<14, ContainerOverSubrelations>::View;
124 auto tmp = static_cast<View>(in.get(C::nullifier_check_sel)) *
125 ((FF(1) - static_cast<View>(in.get(C::nullifier_check_exists))) -
126 static_cast<View>(in.get(C::nullifier_check_leaf_not_exists)));
127 std::get<14>(evals) += (tmp * scaling_factor);
128 }
129 {
130 using View = typename std::tuple_element_t<15, ContainerOverSubrelations>::View;
131 auto tmp = static_cast<View>(in.get(C::nullifier_check_next_nullifier_is_nonzero)) *
132 (FF(1) - static_cast<View>(in.get(C::nullifier_check_next_nullifier_is_nonzero)));
133 std::get<15>(evals) += (tmp * scaling_factor);
134 }
135 { // NEXT_NULLIFIER_IS_ZERO_CHECK
136 using View = typename std::tuple_element_t<16, ContainerOverSubrelations>::View;
137 auto tmp = static_cast<View>(in.get(C::nullifier_check_leaf_not_exists)) *
138 ((static_cast<View>(in.get(C::nullifier_check_low_leaf_next_nullifier)) *
139 (CView(nullifier_check_NEXT_NULLIFIER_IS_ZERO) *
140 (FF(1) - static_cast<View>(in.get(C::nullifier_check_next_nullifier_inv))) +
141 static_cast<View>(in.get(C::nullifier_check_next_nullifier_inv))) -
142 FF(1)) +
143 CView(nullifier_check_NEXT_NULLIFIER_IS_ZERO));
144 std::get<16>(evals) += (tmp * scaling_factor);
145 }
146 {
147 using View = typename std::tuple_element_t<17, ContainerOverSubrelations>::View;
148 auto tmp = (static_cast<View>(in.get(C::nullifier_check_should_insert)) *
149 (FF(1) - static_cast<View>(in.get(C::nullifier_check_discard))) -
150 static_cast<View>(in.get(C::nullifier_check_should_write_to_public_inputs)));
151 std::get<17>(evals) += (tmp * scaling_factor);
152 }
153 {
154 using View = typename std::tuple_element_t<18, ContainerOverSubrelations>::View;
155 auto tmp = static_cast<View>(in.get(C::nullifier_check_should_write_to_public_inputs)) *
156 ((CView(constants_AVM_PUBLIC_INPUTS_AVM_ACCUMULATED_DATA_NULLIFIERS_ROW_IDX) +
157 static_cast<View>(in.get(C::nullifier_check_nullifier_index))) -
158 static_cast<View>(in.get(C::nullifier_check_public_inputs_index)));
159 std::get<18>(evals) += (tmp * scaling_factor);
160 }
161}
162
163} // 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.