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
5
6namespace bb::avm2 {
7
8template <typename FF_>
9template <typename ContainerOverSubrelations, typename AllEntities>
10void nullifier_checkImpl<FF_>::accumulate(ContainerOverSubrelations& evals,
11 const AllEntities& in,
12 [[maybe_unused]] const RelationParameters<FF_>&,
13 [[maybe_unused]] const FF_& scaling_factor)
14{
15 using C = ColumnAndShifts;
16
17 PROFILE_THIS_NAME("accumulate/nullifier_check");
18
19 const auto constants_NULLIFIER_TREE_HEIGHT = FF(40);
20 const auto constants_AVM_PUBLIC_INPUTS_AVM_ACCUMULATED_DATA_NULLIFIERS_ROW_IDX = FF(439);
21 const auto constants_GENERATOR_INDEX__OUTER_NULLIFIER = FF(7);
22 const auto nullifier_check_NULLIFIER_LOW_LEAF_NULLIFIER_DIFF =
23 (in.get(C::nullifier_check_siloed_nullifier) - in.get(C::nullifier_check_low_leaf_nullifier));
24 const auto nullifier_check_NEXT_NULLIFIER_IS_ZERO = (FF(1) - in.get(C::nullifier_check_next_nullifier_is_nonzero));
25
26 {
27 using Accumulator = typename std::tuple_element_t<0, ContainerOverSubrelations>;
28 auto tmp = in.get(C::nullifier_check_sel) * (FF(1) - in.get(C::nullifier_check_sel));
29 tmp *= scaling_factor;
30 std::get<0>(evals) += typename Accumulator::View(tmp);
31 }
32 {
33 using Accumulator = typename std::tuple_element_t<1, ContainerOverSubrelations>;
34 auto tmp = in.get(C::nullifier_check_write) * (FF(1) - in.get(C::nullifier_check_write));
35 tmp *= scaling_factor;
36 std::get<1>(evals) += typename Accumulator::View(tmp);
37 }
38 {
39 using Accumulator = typename std::tuple_element_t<2, ContainerOverSubrelations>;
40 auto tmp = in.get(C::nullifier_check_write) * (FF(1) - in.get(C::nullifier_check_sel));
41 tmp *= scaling_factor;
42 std::get<2>(evals) += typename Accumulator::View(tmp);
43 }
44 {
45 using Accumulator = typename std::tuple_element_t<3, ContainerOverSubrelations>;
46 auto tmp = in.get(C::nullifier_check_exists) * (FF(1) - in.get(C::nullifier_check_exists));
47 tmp *= scaling_factor;
48 std::get<3>(evals) += typename Accumulator::View(tmp);
49 }
50 {
51 using Accumulator = typename std::tuple_element_t<4, ContainerOverSubrelations>;
52 auto tmp = in.get(C::nullifier_check_should_silo) * (FF(1) - in.get(C::nullifier_check_should_silo));
53 tmp *= scaling_factor;
54 std::get<4>(evals) += typename Accumulator::View(tmp);
55 }
56 { // PASSTHROUGH_SILOING
57 using Accumulator = typename std::tuple_element_t<5, ContainerOverSubrelations>;
58 auto tmp = (FF(1) - in.get(C::nullifier_check_should_silo)) *
59 (in.get(C::nullifier_check_nullifier) - in.get(C::nullifier_check_siloed_nullifier));
60 tmp *= scaling_factor;
61 std::get<5>(evals) += typename Accumulator::View(tmp);
62 }
63 {
64 using Accumulator = typename std::tuple_element_t<6, ContainerOverSubrelations>;
65 auto tmp = in.get(C::nullifier_check_sel) *
66 (constants_GENERATOR_INDEX__OUTER_NULLIFIER - in.get(C::nullifier_check_siloing_separator));
67 tmp *= scaling_factor;
68 std::get<6>(evals) += typename Accumulator::View(tmp);
69 }
70 {
71 using Accumulator = typename std::tuple_element_t<7, ContainerOverSubrelations>;
72 auto tmp = (in.get(C::nullifier_check_should_insert) -
73 in.get(C::nullifier_check_write) * (FF(1) - in.get(C::nullifier_check_exists)));
74 tmp *= scaling_factor;
75 std::get<7>(evals) += typename Accumulator::View(tmp);
76 }
77 {
78 using Accumulator = typename std::tuple_element_t<8, ContainerOverSubrelations>;
79 auto tmp = in.get(C::nullifier_check_write) * in.get(C::nullifier_check_exists) *
80 (in.get(C::nullifier_check_root) - in.get(C::nullifier_check_write_root));
81 tmp *= scaling_factor;
82 std::get<8>(evals) += typename Accumulator::View(tmp);
83 }
84 {
85 using Accumulator = typename std::tuple_element_t<9, ContainerOverSubrelations>;
86 auto tmp = in.get(C::nullifier_check_should_insert) * (in.get(C::nullifier_check_tree_size_before_write) -
87 in.get(C::nullifier_check_updated_low_leaf_next_index));
88 tmp *= scaling_factor;
89 std::get<9>(evals) += typename Accumulator::View(tmp);
90 }
91 {
92 using Accumulator = typename std::tuple_element_t<10, ContainerOverSubrelations>;
93 auto tmp =
94 in.get(C::nullifier_check_should_insert) *
95 (in.get(C::nullifier_check_siloed_nullifier) - in.get(C::nullifier_check_updated_low_leaf_next_nullifier));
96 tmp *= scaling_factor;
97 std::get<10>(evals) += typename Accumulator::View(tmp);
98 }
99 {
100 using Accumulator = typename std::tuple_element_t<11, ContainerOverSubrelations>;
101 auto tmp =
102 in.get(C::nullifier_check_sel) * (in.get(C::nullifier_check_tree_height) - constants_NULLIFIER_TREE_HEIGHT);
103 tmp *= scaling_factor;
104 std::get<11>(evals) += typename Accumulator::View(tmp);
105 }
106 { // EXISTS_CHECK
107 using Accumulator = typename std::tuple_element_t<12, ContainerOverSubrelations>;
108 auto tmp = in.get(C::nullifier_check_sel) *
109 ((nullifier_check_NULLIFIER_LOW_LEAF_NULLIFIER_DIFF *
110 (in.get(C::nullifier_check_exists) *
111 (FF(1) - in.get(C::nullifier_check_nullifier_low_leaf_nullifier_diff_inv)) +
112 in.get(C::nullifier_check_nullifier_low_leaf_nullifier_diff_inv)) -
113 FF(1)) +
114 in.get(C::nullifier_check_exists));
115 tmp *= scaling_factor;
116 std::get<12>(evals) += typename Accumulator::View(tmp);
117 }
118 {
119 using Accumulator = typename std::tuple_element_t<13, ContainerOverSubrelations>;
120 auto tmp = in.get(C::nullifier_check_sel) *
121 ((FF(1) - in.get(C::nullifier_check_exists)) - in.get(C::nullifier_check_leaf_not_exists));
122 tmp *= scaling_factor;
123 std::get<13>(evals) += typename Accumulator::View(tmp);
124 }
125 {
126 using Accumulator = typename std::tuple_element_t<14, ContainerOverSubrelations>;
127 auto tmp = in.get(C::nullifier_check_next_nullifier_is_nonzero) *
128 (FF(1) - in.get(C::nullifier_check_next_nullifier_is_nonzero));
129 tmp *= scaling_factor;
130 std::get<14>(evals) += typename Accumulator::View(tmp);
131 }
132 { // NEXT_NULLIFIER_IS_ZERO_CHECK
133 using Accumulator = typename std::tuple_element_t<15, ContainerOverSubrelations>;
134 auto tmp =
135 in.get(C::nullifier_check_leaf_not_exists) *
136 ((in.get(C::nullifier_check_low_leaf_next_nullifier) *
137 (nullifier_check_NEXT_NULLIFIER_IS_ZERO * (FF(1) - in.get(C::nullifier_check_next_nullifier_inv)) +
138 in.get(C::nullifier_check_next_nullifier_inv)) -
139 FF(1)) +
140 nullifier_check_NEXT_NULLIFIER_IS_ZERO);
141 tmp *= scaling_factor;
142 std::get<15>(evals) += typename Accumulator::View(tmp);
143 }
144 {
145 using Accumulator = typename std::tuple_element_t<16, ContainerOverSubrelations>;
146 auto tmp = (in.get(C::nullifier_check_should_insert) * (FF(1) - in.get(C::nullifier_check_discard)) -
147 in.get(C::nullifier_check_should_write_to_public_inputs));
148 tmp *= scaling_factor;
149 std::get<16>(evals) += typename Accumulator::View(tmp);
150 }
151 {
152 using Accumulator = typename std::tuple_element_t<17, ContainerOverSubrelations>;
153 auto tmp = in.get(C::nullifier_check_should_write_to_public_inputs) *
154 ((constants_AVM_PUBLIC_INPUTS_AVM_ACCUMULATED_DATA_NULLIFIERS_ROW_IDX +
155 in.get(C::nullifier_check_nullifier_index)) -
156 in.get(C::nullifier_check_public_inputs_index));
157 tmp *= scaling_factor;
158 std::get<17>(evals) += typename Accumulator::View(tmp);
159 }
160}
161
162} // namespace bb::avm2
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &, const FF &scaling_factor)
ColumnAndShifts
Definition columns.hpp:35
AvmFlavorSettings::FF FF
Definition field.hpp:10
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
#define PROFILE_THIS_NAME(name)
Definition op_count.hpp:16
Container for parameters used by the grand product (permutation, lookup) Honk relations.