1#include <gmock/gmock.h>
2#include <gtest/gtest.h>
18using tracegen::TestTraceContainer;
23TEST(ExecutionConstrainingTest, EmptyRow)
41TEST(ExecutionConstrainingTest, Continuity)
44 TestTraceContainer
trace({
45 {{ C::precomputed_first_row, 1 }},
46 {{ C::execution_sel, 1 }},
47 {{ C::execution_sel, 1 }},
48 {{ C::execution_sel, 1 }, {C::execution_last, 1}},
55TEST(ExecutionConstrainingTest, ContinuityBrokenFirstRow)
58 TestTraceContainer
trace({
59 {{ C::execution_sel, 0 }},
60 {{ C::execution_sel, 1 }},
61 {{ C::execution_sel, 1 }},
62 {{ C::execution_sel, 1 }, {C::execution_last, 1}},
69TEST(ExecutionConstrainingTest, ContinuityBrokenInMiddle)
72 TestTraceContainer
trace({
73 {{ C::execution_sel, 1 }},
74 {{ C::execution_sel, 0 }},
75 {{ C::execution_sel, 1 }},
76 {{ C::execution_sel, 1 }, {C::execution_last, 1}},
83TEST(ExecutionConstrainingTest, ContinuityMultipleLast)
86 TestTraceContainer
trace({
87 {{ C::execution_sel, 1 }},
88 {{ C::execution_sel, 1 }},
89 {{ C::execution_sel, 1 }},
90 {{ C::execution_sel, 1 }, {C::execution_last, 1}},
101TEST(ExecutionConstrainingTest, TreeStateNotChanged)
103 TestTraceContainer
trace({
105 { C::precomputed_first_row, 1 },
108 { C::execution_sel, 1 },
109 { C::execution_prev_note_hash_tree_root, 10 },
110 { C::execution_prev_note_hash_tree_size, 9 },
111 { C::execution_prev_num_note_hashes_emitted, 8 },
112 { C::execution_prev_nullifier_tree_root, 7 },
113 { C::execution_prev_nullifier_tree_size, 6 },
114 { C::execution_prev_num_nullifiers_emitted, 5 },
115 { C::execution_prev_public_data_tree_root, 4 },
116 { C::execution_prev_public_data_tree_size, 3 },
117 { C::execution_prev_written_public_data_slots_tree_root, 2 },
118 { C::execution_prev_written_public_data_slots_tree_size, 1 },
119 { C::execution_note_hash_tree_root, 10 },
120 { C::execution_note_hash_tree_size, 9 },
121 { C::execution_num_note_hashes_emitted, 8 },
122 { C::execution_nullifier_tree_root, 7 },
123 { C::execution_nullifier_tree_size, 6 },
124 { C::execution_num_nullifiers_emitted, 5 },
125 { C::execution_public_data_tree_root, 4 },
126 { C::execution_public_data_tree_size, 3 },
127 { C::execution_written_public_data_slots_tree_root, 2 },
128 { C::execution_written_public_data_slots_tree_size, 1 },
132 check_relation<execution>(
trace,
145 trace.
set(C::execution_note_hash_tree_root, 1, 100);
147 "NOTE_HASH_TREE_ROOT_NOT_CHANGED");
150 trace.
set(C::execution_note_hash_tree_size, 1, 100);
152 "NOTE_HASH_TREE_SIZE_NOT_CHANGED");
155 trace.
set(C::execution_num_note_hashes_emitted, 1, 100);
157 "NUM_NOTE_HASHES_EMITTED_NOT_CHANGED");
160 trace.
set(C::execution_nullifier_tree_root, 1, 100);
162 "NULLIFIER_TREE_ROOT_NOT_CHANGED");
165 trace.
set(C::execution_nullifier_tree_size, 1, 100);
167 "NULLIFIER_TREE_SIZE_NOT_CHANGED");
170 trace.
set(C::execution_prev_num_nullifiers_emitted, 1, 100);
172 "NUM_NULLIFIERS_EMITTED_NOT_CHANGED");
175 trace.
set(C::execution_public_data_tree_root, 1, 100);
177 "PUBLIC_DATA_TREE_ROOT_NOT_CHANGED");
180 trace.
set(C::execution_public_data_tree_size, 1, 100);
182 "PUBLIC_DATA_TREE_SIZE_NOT_CHANGED");
185 trace.
set(C::execution_written_public_data_slots_tree_root, 1, 100);
188 "WRITTEN_PUBLIC_DATA_SLOTS_TREE_ROOT_NOT_CHANGED");
191 trace.
set(C::execution_written_public_data_slots_tree_size, 1, 100);
194 "WRITTEN_PUBLIC_DATA_SLOTS_TREE_SIZE_NOT_CHANGED");
197TEST(ExecutionConstrainingTest, SideEffectStateNotChanged)
199 TestTraceContainer
trace({
201 { C::precomputed_first_row, 1 },
204 { C::execution_sel, 1 },
205 { C::execution_prev_num_unencrypted_logs, 10 },
206 { C::execution_prev_num_l2_to_l1_messages, 11 },
207 { C::execution_num_unencrypted_logs, 10 },
208 { C::execution_num_l2_to_l1_messages, 11 },
212 check_relation<execution>(
216 trace.
set(C::execution_num_unencrypted_logs, 1, 100);
218 "NUM_UNENCRYPTED_LOGS_NOT_CHANGED");
221 trace.
set(C::execution_num_l2_to_l1_messages, 1, 100);
223 "NUM_L2_TO_L1_MESSAGES_NOT_CHANGED");
static constexpr size_t SR_NUM_L2_TO_L1_MESSAGES_NOT_CHANGED
static constexpr size_t SR_WRITTEN_PUBLIC_DATA_SLOTS_TREE_SIZE_NOT_CHANGED
static constexpr size_t SR_NULLIFIER_TREE_SIZE_NOT_CHANGED
static constexpr size_t SR_LAST_IS_LAST
static constexpr size_t SR_NUM_NULLIFIERS_EMITTED_NOT_CHANGED
static constexpr size_t SR_PUBLIC_DATA_TREE_SIZE_NOT_CHANGED
static constexpr size_t SR_NOTE_HASH_TREE_ROOT_NOT_CHANGED
static constexpr size_t SR_TRACE_CONTINUITY
static constexpr size_t SR_NULLIFIER_TREE_ROOT_NOT_CHANGED
static constexpr size_t SR_NUM_UNENCRYPTED_LOGS_NOT_CHANGED
static constexpr size_t SR_PUBLIC_DATA_TREE_ROOT_NOT_CHANGED
static constexpr size_t SR_WRITTEN_PUBLIC_DATA_SLOTS_TREE_ROOT_NOT_CHANGED
static constexpr size_t SR_NOTE_HASH_TREE_SIZE_NOT_CHANGED
static constexpr size_t SR_NUM_NOTE_HASHES_EMITTED_NOT_CHANGED
void set(Column col, uint32_t row, const FF &value)
#define EXPECT_THROW_WITH_MESSAGE(code, expectedMessage)
TEST(TxExecutionConstrainingTest, WriteTreeValue)
TestTraceContainer empty_trace()
NiceMock< MockExecution > execution