Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
emit_notehash_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 emit_notehashImpl<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/emit_notehash");
18
19 const auto constants_MAX_NOTE_HASHES_PER_TX = FF(64);
20 const auto execution_REMAINING_NOTE_HASH_WRITES =
21 (constants_MAX_NOTE_HASHES_PER_TX - in.get(C::execution_prev_num_note_hashes_emitted));
22
23 {
24 using Accumulator = typename std::tuple_element_t<0, ContainerOverSubrelations>;
25 auto tmp = in.get(C::execution_sel_reached_max_note_hashes) *
26 (FF(1) - in.get(C::execution_sel_reached_max_note_hashes));
27 tmp *= scaling_factor;
28 std::get<0>(evals) += typename Accumulator::View(tmp);
29 }
30 { // MAX_NOTE_HASHES_REACHED
31 using Accumulator = typename std::tuple_element_t<1, ContainerOverSubrelations>;
32 auto tmp =
33 in.get(C::execution_sel_execute_emit_notehash) *
34 ((execution_REMAINING_NOTE_HASH_WRITES * (in.get(C::execution_sel_reached_max_note_hashes) *
35 (FF(1) - in.get(C::execution_remaining_note_hashes_inv)) +
36 in.get(C::execution_remaining_note_hashes_inv)) -
37 FF(1)) +
38 in.get(C::execution_sel_reached_max_note_hashes));
39 tmp *= scaling_factor;
40 std::get<1>(evals) += typename Accumulator::View(tmp);
41 }
42 { // OPCODE_ERROR_IF_MAX_NOTE_HASHES_REACHED_OR_STATIC
43 using Accumulator = typename std::tuple_element_t<2, ContainerOverSubrelations>;
44 auto tmp =
45 in.get(C::execution_sel_execute_emit_notehash) *
46 ((FF(1) - in.get(C::execution_sel_reached_max_note_hashes)) * (FF(1) - in.get(C::execution_is_static)) -
47 (FF(1) - in.get(C::execution_sel_opcode_error)));
48 tmp *= scaling_factor;
49 std::get<2>(evals) += typename Accumulator::View(tmp);
50 }
51 {
52 using Accumulator = typename std::tuple_element_t<3, ContainerOverSubrelations>;
53 auto tmp = in.get(C::execution_sel_execute_emit_notehash) *
54 ((FF(1) - in.get(C::execution_sel_opcode_error)) - in.get(C::execution_sel_write_note_hash));
55 tmp *= scaling_factor;
56 std::get<3>(evals) += typename Accumulator::View(tmp);
57 }
58 { // EMIT_NOTEHASH_TREE_ROOT_NOT_CHANGED
59 using Accumulator = typename std::tuple_element_t<4, ContainerOverSubrelations>;
60 auto tmp = in.get(C::execution_sel_execute_emit_notehash) * in.get(C::execution_sel_opcode_error) *
61 (in.get(C::execution_prev_note_hash_tree_root) - in.get(C::execution_note_hash_tree_root));
62 tmp *= scaling_factor;
63 std::get<4>(evals) += typename Accumulator::View(tmp);
64 }
65 { // EMIT_NOTEHASH_TREE_SIZE_INCREASE
66 using Accumulator = typename std::tuple_element_t<5, ContainerOverSubrelations>;
67 auto tmp = in.get(C::execution_sel_execute_emit_notehash) *
68 ((in.get(C::execution_prev_note_hash_tree_size) + in.get(C::execution_sel_write_note_hash)) -
69 in.get(C::execution_note_hash_tree_size));
70 tmp *= scaling_factor;
71 std::get<5>(evals) += typename Accumulator::View(tmp);
72 }
73 { // EMIT_NOTEHASH_NUM_NOTE_HASHES_EMITTED_INCREASE
74 using Accumulator = typename std::tuple_element_t<6, ContainerOverSubrelations>;
75 auto tmp = in.get(C::execution_sel_execute_emit_notehash) *
76 ((in.get(C::execution_prev_num_note_hashes_emitted) + in.get(C::execution_sel_write_note_hash)) -
77 in.get(C::execution_num_note_hashes_emitted));
78 tmp *= scaling_factor;
79 std::get<6>(evals) += typename Accumulator::View(tmp);
80 }
81}
82
83} // 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.