Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bc_retrieval.test.cpp
Go to the documentation of this file.
1#include <gmock/gmock.h>
2#include <gtest/gtest.h>
3
4#include <cstdint>
5#include <memory>
6#include <vector>
7
45
46namespace bb::avm2::constraining {
47namespace {
48using ::testing::StrictMock;
49
52using tracegen::BytecodeTraceBuilder;
53using tracegen::ClassIdDerivationTraceBuilder;
54using tracegen::ContractInstanceRetrievalTraceBuilder;
55using tracegen::FieldGreaterThanTraceBuilder;
56using tracegen::IndexedTreeCheckTraceBuilder;
57using tracegen::Poseidon2TraceBuilder;
58using tracegen::PrecomputedTraceBuilder;
59using tracegen::TestTraceContainer;
60
61using simulation::EventEmitter;
62using simulation::FieldGreaterThan;
63using simulation::IndexedTreeCheck;
65using simulation::IndexedTreeLeafData;
66using simulation::IndexedTreeReadWriteEvent;
67using simulation::MerkleCheck;
68using simulation::MockExecutionIdManager;
69using simulation::MockGreaterThan;
70using simulation::Poseidon2;
71using simulation::Poseidon2HashEvent;
72using simulation::Poseidon2PermutationEvent;
73using simulation::Poseidon2PermutationMemoryEvent;
74using simulation::RangeCheck;
75using simulation::RetrievedBytecodesTreeCheck;
76
78using C = Column;
79using bc_retrieval = bb::avm2::bc_retrieval<FF>;
81
82class BytecodeRetrievalConstrainingTest : public ::testing::Test {
83 public:
84 static TestTraceContainer init_trace()
85 {
86 // Add first row.
87 TestTraceContainer trace({
88 { { C::precomputed_first_row, 1 } },
89 });
90 return trace;
91 }
92};
93
94TEST_F(BytecodeRetrievalConstrainingTest, EmptyRow)
95{
96 check_relation<bc_retrieval>(testing::empty_trace());
97}
98
99TEST_F(BytecodeRetrievalConstrainingTest, SuccessfulRetrieval)
100{
101 TestTraceContainer trace = init_trace();
102 BytecodeTraceBuilder builder;
103 ContractInstanceRetrievalTraceBuilder contract_instance_retrieval_builder;
104 ClassIdDerivationTraceBuilder class_id_builder;
105 IndexedTreeCheckTraceBuilder indexed_tree_check_builder;
106
107 FF nullifier_root = FF::random_element();
108 FF public_data_tree_root = FF::random_element();
109
110 ContractInstance instance = random_contract_instance();
111 uint32_t bytecode_size = 20;
112 ContractClass klass = random_contract_class(/*bytecode_size=*/bytecode_size);
113 std::vector<FF> bytecode_fields = simulation::encode_bytecode(klass.packed_bytecode);
114 std::vector<FF> hash_input = { simulation::compute_public_bytecode_first_field(klass.packed_bytecode.size()) };
115 hash_input.reserve(1 + bytecode_fields.size());
116 hash_input.insert(hash_input.end(), bytecode_fields.begin(), bytecode_fields.end());
117 // Compute the bytecode commitment separately
118 FF bytecode_commitment = RawPoseidon2::hash(hash_input);
119 builder.process_hashing({ { .bytecode_id = bytecode_commitment,
120 .bytecode_length = bytecode_size,
121 .bytecode_fields = bytecode_fields } },
122 trace);
124 .address = instance.deployer,
125 .contract_instance = { instance },
126 .nullifier_tree_root = nullifier_root,
127 .public_data_tree_root = public_data_tree_root,
128 .exists = true,
129 } },
130 trace);
131 class_id_builder.process({ { .class_id = instance.current_contract_class_id,
132 .artifact_hash = klass.artifact_hash,
133 .private_functions_root = klass.private_functions_root,
134 .public_bytecode_commitment = bytecode_commitment } },
135 trace);
136
137 AppendOnlyTreeSnapshot snapshot_before = AppendOnlyTreeSnapshot{
139 .next_available_leaf_index = AVM_RETRIEVED_BYTECODES_TREE_INITIAL_SIZE,
140 };
141
142 AppendOnlyTreeSnapshot snapshot_after = AppendOnlyTreeSnapshot{
143 .root = FF(42),
144 .next_available_leaf_index = AVM_RETRIEVED_BYTECODES_TREE_INITIAL_SIZE + 1,
145 };
146
148 { // Read the tree of the retrieved bytecodes
149 IndexedTreeReadWriteEvent{
150 .value = instance.current_contract_class_id,
151 .prev_snapshot = snapshot_before,
152 .next_snapshot = snapshot_before,
154 .low_leaf_data = IndexedTreeLeafData{ .value = 0, .next_value = 0, .next_index = 0 },
155 .low_leaf_hash = 0,
156 .low_leaf_index = 0,
157 },
158 // Insertion in the retrieved bytecodes tree
159 IndexedTreeReadWriteEvent{
160 .value = instance.current_contract_class_id,
161 .prev_snapshot = snapshot_before,
162 .next_snapshot = snapshot_after,
164 .low_leaf_data = IndexedTreeLeafData{ .value = 0, .next_value = 0, .next_index = 0 },
165 .low_leaf_hash = 0,
166 .low_leaf_index = 0,
167 .write = true,
168 } },
169 trace);
170
171 // Build a bytecode retrieval event where instance exists
172 builder.process_retrieval({ {
173 .bytecode_id = bytecode_commitment, // bytecode_id equals commitment
174 .address = instance.deployer,
175 .current_class_id = instance.current_contract_class_id,
176 .contract_class = klass,
177 .nullifier_root = nullifier_root,
178 .public_data_tree_root = public_data_tree_root,
179 .retrieved_bytecodes_snapshot_before = snapshot_before,
180 .retrieved_bytecodes_snapshot_after = snapshot_after,
181 .is_new_class = true,
182 } },
183 trace);
184
185 check_relation<bc_retrieval>(trace);
186 check_interaction<BytecodeTraceBuilder,
191}
192
193TEST_F(BytecodeRetrievalConstrainingTest, TooManyBytecodes)
194{
195 TestTraceContainer trace = init_trace();
196 BytecodeTraceBuilder builder;
197
198 FF nullifier_root = FF::random_element();
199 FF public_data_tree_root = FF::random_element();
200
201 ContractInstance instance = random_contract_instance();
202 uint32_t bytecode_size = 20;
203 ContractClass klass = random_contract_class(/*bytecode_size=*/bytecode_size);
204
205 AppendOnlyTreeSnapshot snapshot_before = AppendOnlyTreeSnapshot{
206 .root = FF(42),
207 .next_available_leaf_index =
209 };
210
211 AppendOnlyTreeSnapshot snapshot_after = AppendOnlyTreeSnapshot{
212 .root = FF(42),
213 .next_available_leaf_index =
215 };
216
217 // Build a bytecode retrieval event where instance exists
218 builder.process_retrieval({ {
219 .bytecode_id = 0, // bytecode_id equals commitment
220 .address = instance.deployer,
221 .current_class_id = instance.current_contract_class_id,
222 .nullifier_root = nullifier_root,
223 .public_data_tree_root = public_data_tree_root,
224 .retrieved_bytecodes_snapshot_before = snapshot_before,
225 .retrieved_bytecodes_snapshot_after = snapshot_after,
226 .is_new_class = true,
228 } },
229 trace);
230
231 check_relation<bc_retrieval>(trace);
232}
233
234TEST_F(BytecodeRetrievalConstrainingTest, NonExistentInstance)
235{
236
237 ContractInstanceRetrievalTraceBuilder contract_instance_retrieval_builder;
238 TestTraceContainer trace = init_trace();
239 FF contract_address = FF::random_element();
240
241 // Instance retrieval enforces current_class_id = 0 when exists = 0:
243 .address = contract_address,
244 .exists = false,
245 } },
246 trace);
247
248 // Manually set up a row where instance_exists = 0
249 // All other fields should be forced to 0 by constraints
250 trace.set(
251 1,
252 { {
253 { C::bc_retrieval_sel, 1 },
254 { C::bc_retrieval_instance_exists, 0 },
255 { C::bc_retrieval_current_class_id, 0 },
256 { C::bc_retrieval_artifact_hash, 0 },
257 { C::bc_retrieval_private_functions_root, 0 },
258 { C::bc_retrieval_bytecode_id, 0 },
259 { C::bc_retrieval_address, contract_address },
260 { C::bc_retrieval_prev_retrieved_bytecodes_tree_size, 1 },
261 { C::bc_retrieval_next_retrieved_bytecodes_tree_size, 1 },
262 { C::bc_retrieval_retrieved_bytecodes_tree_height, AVM_RETRIEVED_BYTECODES_TREE_HEIGHT },
263 { C::bc_retrieval_remaining_bytecodes_inv, FF(MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS).invert() },
264 { C::bc_retrieval_error, 1 },
265 } });
266
267 check_relation<bc_retrieval>(trace);
268
269 // mutate the current_class_id and confirm that a violation as it should be 0
270 trace.set(C::bc_retrieval_current_class_id, 1, 99);
272 (check_interaction<BytecodeTraceBuilder, lookup_bc_retrieval_contract_instance_retrieval_settings>(trace)),
273 "Failed.*LOOKUP_BC_RETRIEVAL_CONTRACT_INSTANCE_RETRIEVAL.*Could not find tuple in destination.");
274
275 trace.set(C::contract_instance_retrieval_current_class_id, 1, 99);
277 , "INSTANCE_MEMBER_CLASS_ID_IS_ZERO_IF_DNE");
278
279 // reset
280 trace.set(C::bc_retrieval_current_class_id, 1, 0);
281 trace.set(C::contract_instance_retrieval_current_class_id, 1, 0);
282
283 // mutate the bytecode_id and confirm that it is a violation
284 trace.set(C::bc_retrieval_bytecode_id, 1, 99);
285 EXPECT_THROW_WITH_MESSAGE(check_relation<bc_retrieval>(trace), "BYTECODE_ID_IS_ZERO_IF_ERROR");
286 // reset
287 trace.set(C::bc_retrieval_bytecode_id, 1, 0);
288}
289
290class BytecodeRetrievalConstrainingTestFewerMocks : public BytecodeRetrievalConstrainingTest {
291 public:
292 EventEmitter<simulation::Poseidon2HashEvent> hash_event_emitter;
293 EventEmitter<simulation::Poseidon2PermutationEvent> perm_event_emitter;
294 EventEmitter<simulation::Poseidon2PermutationMemoryEvent> perm_mem_event_emitter;
295 EventEmitter<simulation::MerkleCheckEvent> merkle_check_emitter;
296 EventEmitter<simulation::RangeCheckEvent> range_check_emitter;
297 EventEmitter<simulation::FieldGreaterThanEvent> field_gt_emitter;
298 EventEmitter<simulation::IndexedTreeCheckEvent> indexed_tree_check_event_emitter;
299
300 StrictMock<MockGreaterThan> mock_gt;
301 StrictMock<MockExecutionIdManager> mock_execution_id_manager;
302
303 Poseidon2TraceBuilder poseidon2_builder;
304
306 Poseidon2(mock_execution_id_manager, mock_gt, hash_event_emitter, perm_event_emitter, perm_mem_event_emitter);
307 MerkleCheck merkle_check = MerkleCheck(poseidon2, merkle_check_emitter);
308 RangeCheck range_check = RangeCheck(range_check_emitter);
309 FieldGreaterThan field_gt = FieldGreaterThan(range_check, field_gt_emitter);
310 IndexedTreeCheck indexed_tree_check =
311 IndexedTreeCheck(poseidon2, merkle_check, field_gt, indexed_tree_check_event_emitter);
312
313 RetrievedBytecodesTreeCheck retrieved_bytecodes_tree_check =
314 RetrievedBytecodesTreeCheck(indexed_tree_check, simulation::build_retrieved_bytecodes_tree());
315
316 BytecodeTraceBuilder builder;
317 ContractInstanceRetrievalTraceBuilder contract_instance_retrieval_builder;
318 ClassIdDerivationTraceBuilder class_id_builder;
319 IndexedTreeCheckTraceBuilder indexed_tree_check_builder;
320 FieldGreaterThanTraceBuilder field_gt_builder;
321 PrecomputedTraceBuilder precomputed_builder;
322};
323
324TEST_F(BytecodeRetrievalConstrainingTestFewerMocks, SuccessfulRetrievalFewerMocks)
325{
326 TestTraceContainer trace = init_trace();
327
328 FF nullifier_root = FF::random_element();
329 FF public_data_tree_root = FF::random_element();
330
331 ContractInstance instance = random_contract_instance();
332 uint32_t bytecode_size = 20;
333 ContractClass klass = random_contract_class(/*bytecode_size=*/bytecode_size);
334 std::vector<FF> bytecode_fields = simulation::encode_bytecode(klass.packed_bytecode);
335 std::vector<FF> hash_input = { simulation::compute_public_bytecode_first_field(klass.packed_bytecode.size()) };
336 hash_input.reserve(1 + bytecode_fields.size());
337 hash_input.insert(hash_input.end(), bytecode_fields.begin(), bytecode_fields.end());
338 // Compute the bytecode commitment separately
339 FF bytecode_commitment = poseidon2.hash(hash_input);
340 builder.process_decomposition({ { .bytecode_id = bytecode_commitment,
341 .bytecode = std::make_shared<std::vector<uint8_t>>(klass.packed_bytecode) } },
342 trace);
343 trace.set(1, { { { C::bc_decomposition_sel_packed_read_0_, 1 } } });
344 builder.process_hashing({ { .bytecode_id = bytecode_commitment,
345 .bytecode_length = bytecode_size,
346 .bytecode_fields = bytecode_fields } },
347 trace);
348 // Compute the class id separately to produce the hash event, and replace the mocked value
349 FF class_id = poseidon2.hash(
350 { DOM_SEP__CONTRACT_CLASS_ID, klass.artifact_hash, klass.private_functions_root, bytecode_commitment });
351 instance.current_contract_class_id = class_id;
352 klass.id = class_id;
354 .address = instance.deployer,
355 .contract_instance = { instance },
356 .nullifier_tree_root = nullifier_root,
357 .public_data_tree_root = public_data_tree_root,
358 .exists = true,
359 } },
360 trace);
361
362 class_id_builder.process({ { .class_id = klass.id,
363 .artifact_hash = klass.artifact_hash,
364 .private_functions_root = klass.private_functions_root,
365 .public_bytecode_commitment = bytecode_commitment } },
366 trace);
367
368 AppendOnlyTreeSnapshot snapshot_before = retrieved_bytecodes_tree_check.get_snapshot();
369
370 // Read the tree of the retrieved bytecodes
371 retrieved_bytecodes_tree_check.contains(instance.current_contract_class_id);
372
373 // Insertion in the retrieved bytecodes tree
374 retrieved_bytecodes_tree_check.insert(instance.current_contract_class_id);
375
376 AppendOnlyTreeSnapshot snapshot_after = retrieved_bytecodes_tree_check.get_snapshot();
377
379
380 // Build a bytecode retrieval event where instance exists
381 builder.process_retrieval({ {
382 .bytecode_id = bytecode_commitment, // bytecode_id equals commitment
383 .address = instance.deployer,
384 .current_class_id = instance.current_contract_class_id,
385 .contract_class = klass,
386 .nullifier_root = nullifier_root,
387 .public_data_tree_root = public_data_tree_root,
388 .retrieved_bytecodes_snapshot_before = snapshot_before,
389 .retrieved_bytecodes_snapshot_after = snapshot_after,
390 .is_new_class = true,
391 } },
392 trace);
393
397
398 check_relation<bc_retrieval>(trace);
399 check_relation<bb::avm2::bc_decomposition<FF>>(trace);
400 check_relation<bb::avm2::bc_hashing<FF>>(trace);
401 check_relation<bb::avm2::contract_instance_retrieval<FF>>(trace);
402 check_relation<bb::avm2::class_id_derivation<FF>>(trace);
403 check_relation<bb::avm2::indexed_tree_check<FF>>(trace);
404 check_all_interactions<BytecodeTraceBuilder>(trace);
405 check_all_interactions<ClassIdDerivationTraceBuilder>(trace);
406}
407
408TEST_F(BytecodeRetrievalConstrainingTestFewerMocks, SuccessfulRepeatedRetrievalFewerMocks)
409{
410 TestTraceContainer trace = init_trace();
411
412 FF nullifier_root = FF::random_element();
413 FF public_data_tree_root = FF::random_element();
414
415 ContractInstance instance = random_contract_instance();
416 uint32_t bytecode_size = 20;
417 ContractClass klass = random_contract_class(/*bytecode_size=*/bytecode_size);
418 std::vector<FF> bytecode_fields = simulation::encode_bytecode(klass.packed_bytecode);
419 std::vector<FF> hash_input = { simulation::compute_public_bytecode_first_field(klass.packed_bytecode.size()) };
420 hash_input.reserve(1 + bytecode_fields.size());
421 hash_input.insert(hash_input.end(), bytecode_fields.begin(), bytecode_fields.end());
422 // Compute the bytecode commitment separately
423 FF bytecode_commitment = poseidon2.hash(hash_input);
424 builder.process_decomposition({ { .bytecode_id = bytecode_commitment,
425 .bytecode = std::make_shared<std::vector<uint8_t>>(klass.packed_bytecode) } },
426 trace);
427 trace.set(1, { { { C::bc_decomposition_sel_packed_read_0_, 1 } } });
428 builder.process_hashing({ { .bytecode_id = bytecode_commitment,
429 .bytecode_length = bytecode_size,
430 .bytecode_fields = bytecode_fields } },
431 trace);
432
433 // Compute the class id separately to produce the hash event, and replace the mocked value
434 FF class_id = poseidon2.hash(
435 { DOM_SEP__CONTRACT_CLASS_ID, klass.artifact_hash, klass.private_functions_root, bytecode_commitment });
436 instance.current_contract_class_id = class_id;
437 klass.id = class_id;
439 .address = instance.deployer,
440 .contract_instance = { instance },
441 .nullifier_tree_root = nullifier_root,
442 .public_data_tree_root = public_data_tree_root,
443 .exists = true,
444 } },
445 trace);
446 class_id_builder.process({ { .class_id = klass.id,
447 .artifact_hash = klass.artifact_hash,
448 .private_functions_root = klass.private_functions_root,
449 .public_bytecode_commitment = bytecode_commitment } },
450 trace);
451
452 AppendOnlyTreeSnapshot snapshot_before = retrieved_bytecodes_tree_check.get_snapshot();
453
454 // Read the tree of the retrieved bytecodes
455 retrieved_bytecodes_tree_check.contains(instance.current_contract_class_id);
456
457 // Insertion in the retrieved bytecodes tree
458 retrieved_bytecodes_tree_check.insert(instance.current_contract_class_id);
459
460 AppendOnlyTreeSnapshot snapshot_after = retrieved_bytecodes_tree_check.get_snapshot();
461
462 // Retrieve the same again:
463
464 // Read the tree of the retrieved bytecodes
465 retrieved_bytecodes_tree_check.contains(instance.current_contract_class_id);
466
467 // 'Insertion' in the retrieved bytecodes tree (shouldn't write)
468 retrieved_bytecodes_tree_check.insert(instance.current_contract_class_id);
469
471
472 // Build a bytecode retrieval event where instance exists
473 builder.process_retrieval({ {
474 .bytecode_id = bytecode_commitment, // bytecode_id equals commitment
475 .address = instance.deployer,
476 .current_class_id = instance.current_contract_class_id,
477 .contract_class = klass,
478 .nullifier_root = nullifier_root,
479 .public_data_tree_root = public_data_tree_root,
480 .retrieved_bytecodes_snapshot_before = snapshot_before,
481 .retrieved_bytecodes_snapshot_after = snapshot_after,
482 .is_new_class = true,
483 },
484 {
485 .bytecode_id = bytecode_commitment, // bytecode_id equals commitment
486 .address = instance.deployer,
487 .current_class_id = instance.current_contract_class_id,
488 .contract_class = klass,
489 .nullifier_root = nullifier_root,
490 .public_data_tree_root = public_data_tree_root,
491 .retrieved_bytecodes_snapshot_before = snapshot_after,
492 .retrieved_bytecodes_snapshot_after = snapshot_after,
493 .is_new_class = false,
494 } },
495 trace);
496
500
501 check_relation<bc_retrieval>(trace);
502 check_relation<bb::avm2::bc_decomposition<FF>>(trace);
503 check_relation<bb::avm2::bc_hashing<FF>>(trace);
504 check_relation<bb::avm2::contract_instance_retrieval<FF>>(trace);
505 check_relation<bb::avm2::class_id_derivation<FF>>(trace);
506 check_relation<bb::avm2::indexed_tree_check<FF>>(trace);
507 check_all_interactions<BytecodeTraceBuilder>(trace);
508 check_all_interactions<ClassIdDerivationTraceBuilder>(trace);
509
510 // We cannot claim the second retrieval refers to a new class:
511 // (1) The lookup into the transient tree will have leaf_not_exists == 0 at the root, which is
512 // constrained in execution to either be continuous or correctly transitioned when adding a bytecode:
513 trace.set(C::bc_retrieval_is_new_class, 1, 1);
514 EXPECT_THROW_WITH_MESSAGE(check_all_interactions<BytecodeTraceBuilder>(trace), "IS_NEW_CLASS_CHECK");
515 // (2) Attempting to maliciously set not_exists == 1 will fail the transient tree's leaf checks:
516 trace.set(C::indexed_tree_check_not_exists, 2, 1);
517 trace.set(C::indexed_tree_check_exists, 2, 0);
518 check_all_interactions<BytecodeTraceBuilder>(trace);
519 check_relation<bc_retrieval>(trace);
521}
522
523} // namespace
524} // namespace bb::avm2::constraining
#define EXPECT_THROW_WITH_MESSAGE(code, expectedMessageRegex)
Definition assert.hpp:193
std::shared_ptr< Napi::ThreadSafeFunction > instance
#define AVM_RETRIEVED_BYTECODES_TREE_INITIAL_ROOT
#define AVM_RETRIEVED_BYTECODES_TREE_INITIAL_SIZE
#define MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS
#define AVM_RETRIEVED_BYTECODES_TREE_HEIGHT
#define DOM_SEP__CONTRACT_CLASS_ID
StrictMock< MockGreaterThan > mock_gt
EventEmitter< Poseidon2PermutationMemoryEvent > perm_mem_event_emitter
EventEmitter< Poseidon2PermutationEvent > perm_event_emitter
EventEmitter< Poseidon2HashEvent > hash_event_emitter
Poseidon2TraceBuilder poseidon2_builder
StrictMock< MockExecutionIdManager > mock_execution_id_manager
FieldGreaterThan field_gt
IndexedTreeCheckTraceBuilder indexed_tree_check_builder
ClassIdDerivationTraceBuilder class_id_builder
EventEmitter< simulation::MerkleCheckEvent > merkle_check_emitter
ContractInstanceRetrievalTraceBuilder contract_instance_retrieval_builder
MerkleCheck merkle_check
RetrievedBytecodesTreeCheck retrieved_bytecodes_tree_check
EventEmitter< simulation::FieldGreaterThanEvent > field_gt_emitter
IndexedTreeCheck indexed_tree_check
EventEmitter< simulation::RangeCheckEvent > range_check_emitter
EventEmitter< simulation::IndexedTreeCheckEvent > indexed_tree_check_event_emitter
RangeCheck range_check
bool contains(const FF &class_id) override
Checks whether a contract class ID exists in the retrieved bytecodes tree.
void insert(const FF &class_id) override
Inserts a contract class ID into the retrieved bytecodes tree.
AppendOnlyTreeSnapshot get_snapshot() const override
Returns the current tree snapshot.
void process(const simulation::EventEmitterInterface< simulation::ClassIdDerivationEvent >::Container &events, TraceContainer &trace)
Process class id derivation events and populate the relevant columns in the trace....
void process(const simulation::EventEmitterInterface< simulation::ContractInstanceRetrievalEvent >::Container &events, TraceContainer &trace)
void process(const simulation::EventEmitterInterface< simulation::IndexedTreeCheckEvent >::Container &events, TraceContainer &trace)
Process generic indexed tree check events and populate the relevant columns in the trace.
void process_hash(const simulation::EventEmitterInterface< simulation::Poseidon2HashEvent >::Container &hash_events, TraceContainer &trace)
Processes the hash events for the Poseidon2 hash function. It populates the columns for the poseidon2...
void process_misc(TraceContainer &trace, const uint32_t num_rows=PRECOMPUTED_TRACE_SIZE)
void set(Column col, uint32_t row, const FF &value)
static FF hash(const std::vector< FF > &input)
Hashes a vector of field elements.
PrecomputedTraceBuilder precomputed_builder
Definition alu.test.cpp:120
FieldGreaterThanTraceBuilder field_gt_builder
Definition alu.test.cpp:122
AluTraceBuilder builder
Definition alu.test.cpp:124
TestTraceContainer trace
void check_interaction(tracegen::TestTraceContainer &trace)
TEST_F(AvmRecursiveTests, TwoLayerAvmRecursionFailsWithWrongPIs)
void check_relation(const tracegen::TestTraceContainer &trace, Ts... subrelation)
RetrievedBytecodesTree build_retrieved_bytecodes_tree()
std::vector< FF > encode_bytecode(std::span< const uint8_t > bytecode)
std::variant< IndexedTreeReadWriteEvent, CheckPointEventType > IndexedTreeCheckEvent
FF compute_public_bytecode_first_field(size_t bytecode_size)
ContractClass random_contract_class(size_t bytecode_size)
Definition fixtures.cpp:175
ContractInstance random_contract_instance()
Definition fixtures.cpp:159
TestTraceContainer empty_trace()
Definition fixtures.cpp:153
lookup_settings< lookup_bc_retrieval_retrieved_bytecodes_insertion_settings_ > lookup_bc_retrieval_retrieved_bytecodes_insertion_settings
lookup_settings< lookup_bc_retrieval_contract_instance_retrieval_settings_ > lookup_bc_retrieval_contract_instance_retrieval_settings
AvmFlavorSettings::FF FF
Definition field.hpp:10
lookup_settings< lookup_bc_retrieval_class_id_derivation_settings_ > lookup_bc_retrieval_class_id_derivation_settings
lookup_settings< lookup_bc_retrieval_is_new_class_check_settings_ > lookup_bc_retrieval_is_new_class_check_settings
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
constexpr field invert() const noexcept
static field random_element(numeric::RNG *engine=nullptr) noexcept