Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
tx.hpp
Go to the documentation of this file.
1// AUTOGENERATED FILE
2#pragma once
3
4#include <string_view>
5
10
11namespace bb::avm2 {
12
13template <typename FF_> class txImpl {
14 public:
15 using FF = FF_;
16
17 static constexpr std::array<size_t, 58> SUBRELATION_PARTIAL_LENGTHS = { 3, 4, 3, 4, 3, 3, 3, 3, 3, 4, 3, 4, 6, 6, 3,
18 5, 7, 4, 3, 6, 6, 3, 3, 4, 4, 4, 4, 2, 4, 5,
19 3, 3, 3, 4, 5, 4, 4, 4, 4, 6, 4, 3, 4, 2, 4,
20 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 };
21
22 template <typename AllEntities> inline static bool skip(const AllEntities& in)
23 {
24 using C = ColumnAndShifts;
25
26 return (in.get(C::tx_sel)).is_zero();
27 }
28
29 template <typename ContainerOverSubrelations, typename AllEntities>
30 void static accumulate(ContainerOverSubrelations& evals,
31 const AllEntities& in,
32 [[maybe_unused]] const RelationParameters<FF>&,
33 [[maybe_unused]] const FF& scaling_factor);
34};
35
36template <typename FF> class tx : public Relation<txImpl<FF>> {
37 public:
38 static constexpr const std::string_view NAME = "tx";
39
40 // Subrelation indices constants, to be used in tests.
41 static constexpr size_t SR_NO_EXTRANEOUS_ROWS = 1;
42 static constexpr size_t SR_SEL_ON_FIRST_ROW = 2;
43 static constexpr size_t SR_NO_EARLY_END = 3;
44 static constexpr size_t SR_START_WITH_SEL = 4;
45 static constexpr size_t SR_START_FOLLOWS_END = 9;
46 static constexpr size_t SR_END_PHASE_ON_REVERT = 11;
47 static constexpr size_t SR_PHASE_VALUE_CONTINUITY = 12;
48 static constexpr size_t SR_INCR_PHASE_VALUE_ON_END = 13;
49 static constexpr size_t SR_REM_COUNT_IS_ZERO = 15;
50 static constexpr size_t SR_REM_COUNT_IS_ONE = 16;
51 static constexpr size_t SR_READ_PI_LENGTH_SEL = 17;
52 static constexpr size_t SR_ONE_SHOT_REMAINING_PHASE_COUNTER_ONE = 18;
53 static constexpr size_t SR_DECR_REM_PHASE_EVENTS = 19;
54 static constexpr size_t SR_INCR_READ_PI_OFFSET = 20;
55 static constexpr size_t SR_MAX_NOTE_HASH_WRITES_REACHED = 29;
56 static constexpr size_t SR_MAX_NULLIFIER_WRITES_REACHED = 34;
57 static constexpr size_t SR_MAX_L2_L1_MSG_WRITES_REACHED = 39;
58 static constexpr size_t SR_UPDATE_NUM_L2_TO_L1_MSGS = 42;
59 static constexpr size_t SR_COMPUTE_FEE = 44;
60 static constexpr size_t SR_TEARDOWN_GETS_FEE = 45;
61 static constexpr size_t SR_FEE_ZERO_UNLESS_COLLECT_FEE_OR_TEARDOWN = 46;
62 static constexpr size_t SR_NOTE_HASH_TREE_ROOT_IMMUTABLE_IN_PADDING = 52;
63 static constexpr size_t SR_PAD_NOTE_HASH_TREE = 53;
64 static constexpr size_t SR_NOTE_HASHES_EMITTED_IMMUTABLE_IN_PADDING = 54;
65 static constexpr size_t SR_NULLIFIER_TREE_ROOT_IMMUTABLE_IN_PADDING = 55;
66 static constexpr size_t SR_PAD_NULLIFIER_TREE = 56;
67 static constexpr size_t SR_NULLIFIERS_EMITTED_IMMUTABLE_IN_PADDING = 57;
68
69 static std::string get_subrelation_label(size_t index)
70 {
71 switch (index) {
73 return "NO_EXTRANEOUS_ROWS";
75 return "SEL_ON_FIRST_ROW";
76 case SR_NO_EARLY_END:
77 return "NO_EARLY_END";
79 return "START_WITH_SEL";
81 return "START_FOLLOWS_END";
83 return "END_PHASE_ON_REVERT";
85 return "PHASE_VALUE_CONTINUITY";
87 return "INCR_PHASE_VALUE_ON_END";
89 return "REM_COUNT_IS_ZERO";
91 return "REM_COUNT_IS_ONE";
93 return "READ_PI_LENGTH_SEL";
95 return "ONE_SHOT_REMAINING_PHASE_COUNTER_ONE";
97 return "DECR_REM_PHASE_EVENTS";
99 return "INCR_READ_PI_OFFSET";
101 return "MAX_NOTE_HASH_WRITES_REACHED";
103 return "MAX_NULLIFIER_WRITES_REACHED";
105 return "MAX_L2_L1_MSG_WRITES_REACHED";
107 return "UPDATE_NUM_L2_TO_L1_MSGS";
108 case SR_COMPUTE_FEE:
109 return "COMPUTE_FEE";
111 return "TEARDOWN_GETS_FEE";
113 return "FEE_ZERO_UNLESS_COLLECT_FEE_OR_TEARDOWN";
115 return "NOTE_HASH_TREE_ROOT_IMMUTABLE_IN_PADDING";
117 return "PAD_NOTE_HASH_TREE";
119 return "NOTE_HASHES_EMITTED_IMMUTABLE_IN_PADDING";
121 return "NULLIFIER_TREE_ROOT_IMMUTABLE_IN_PADDING";
123 return "PAD_NULLIFIER_TREE";
125 return "NULLIFIERS_EMITTED_IMMUTABLE_IN_PADDING";
126 }
127 return std::to_string(index);
128 }
129};
130
131} // namespace bb::avm2
A wrapper for Relations to expose methods used by the Sumcheck prover or verifier to add the contribu...
static constexpr size_t SR_NO_EARLY_END
Definition tx.hpp:43
static constexpr size_t SR_MAX_NOTE_HASH_WRITES_REACHED
Definition tx.hpp:55
static constexpr size_t SR_SEL_ON_FIRST_ROW
Definition tx.hpp:42
static constexpr size_t SR_DECR_REM_PHASE_EVENTS
Definition tx.hpp:53
static std::string get_subrelation_label(size_t index)
Definition tx.hpp:69
static constexpr size_t SR_INCR_PHASE_VALUE_ON_END
Definition tx.hpp:48
static constexpr size_t SR_PHASE_VALUE_CONTINUITY
Definition tx.hpp:47
static constexpr size_t SR_READ_PI_LENGTH_SEL
Definition tx.hpp:51
static constexpr size_t SR_NO_EXTRANEOUS_ROWS
Definition tx.hpp:41
static constexpr size_t SR_UPDATE_NUM_L2_TO_L1_MSGS
Definition tx.hpp:58
static constexpr size_t SR_NOTE_HASHES_EMITTED_IMMUTABLE_IN_PADDING
Definition tx.hpp:64
static constexpr size_t SR_ONE_SHOT_REMAINING_PHASE_COUNTER_ONE
Definition tx.hpp:52
static constexpr size_t SR_NOTE_HASH_TREE_ROOT_IMMUTABLE_IN_PADDING
Definition tx.hpp:62
static constexpr size_t SR_START_FOLLOWS_END
Definition tx.hpp:45
static constexpr size_t SR_NULLIFIER_TREE_ROOT_IMMUTABLE_IN_PADDING
Definition tx.hpp:65
static constexpr size_t SR_MAX_NULLIFIER_WRITES_REACHED
Definition tx.hpp:56
static constexpr size_t SR_PAD_NOTE_HASH_TREE
Definition tx.hpp:63
static constexpr size_t SR_REM_COUNT_IS_ONE
Definition tx.hpp:50
static constexpr size_t SR_NULLIFIERS_EMITTED_IMMUTABLE_IN_PADDING
Definition tx.hpp:67
static constexpr size_t SR_INCR_READ_PI_OFFSET
Definition tx.hpp:54
static constexpr size_t SR_END_PHASE_ON_REVERT
Definition tx.hpp:46
static constexpr size_t SR_TEARDOWN_GETS_FEE
Definition tx.hpp:60
static constexpr size_t SR_MAX_L2_L1_MSG_WRITES_REACHED
Definition tx.hpp:57
static constexpr size_t SR_FEE_ZERO_UNLESS_COLLECT_FEE_OR_TEARDOWN
Definition tx.hpp:61
static constexpr size_t SR_REM_COUNT_IS_ZERO
Definition tx.hpp:49
static constexpr size_t SR_PAD_NULLIFIER_TREE
Definition tx.hpp:66
static constexpr size_t SR_START_WITH_SEL
Definition tx.hpp:44
static constexpr size_t SR_COMPUTE_FEE
Definition tx.hpp:59
static constexpr const std::string_view NAME
Definition tx.hpp:38
static constexpr std::array< size_t, 58 > SUBRELATION_PARTIAL_LENGTHS
Definition tx.hpp:17
static bool skip(const AllEntities &in)
Definition tx.hpp:22
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &, const FF &scaling_factor)
Definition tx_impl.hpp:11
ColumnAndShifts
Definition columns.hpp:34
AvmFlavorSettings::FF FF
Definition field.hpp:10
std::string to_string(bb::avm2::ValueTag tag)
Container for parameters used by the grand product (permutation, lookup) Honk relations.