1#include <gmock/gmock.h>
2#include <gtest/gtest.h>
29using ::testing::StrictMock;
35using simulation::EventEmitter;
36using simulation::MockExecutionIdManager;
37using simulation::MockGreaterThan;
38using simulation::Poseidon2;
39using simulation::Poseidon2HashEvent;
40using simulation::Poseidon2PermutationEvent;
41using simulation::Poseidon2PermutationMemoryEvent;
42using tracegen::BytecodeTraceBuilder;
43using tracegen::Poseidon2TraceBuilder;
44using tracegen::PrecomputedTraceBuilder;
45using tracegen::TestTraceContainer;
52class BytecodeHashingConstrainingTest :
public ::testing::Test {
66class BytecodeHashingConstrainingTestTraceHelper :
public BytecodeHashingConstrainingTest {
68 TestTraceContainer process_bc_hashing_trace(std::vector<std::vector<FF>> all_bytecode_fields,
69 std::vector<FF> bytecode_ids,
70 std::vector<size_t> bytecode_size_in_bytes)
75 TestTraceContainer
trace({
76 { { C::precomputed_first_row, 1 } },
79 for (uint32_t j = 0; j < all_bytecode_fields.size(); j++) {
80 uint32_t pc_index = 0;
81 auto bytecode_fields = all_bytecode_fields[j];
82 auto bytecode_id = bytecode_ids[j];
83 bytecode_fields.insert(bytecode_fields.begin(),
86 auto bytecode_field_at = [&bytecode_fields](
size_t i) ->
FF {
87 return i < bytecode_fields.size() ? bytecode_fields[i] : 0;
89 auto padding_amount = (3 - (bytecode_fields.size() % 3)) % 3;
90 auto num_rounds = (bytecode_fields.size() + padding_amount) / 3;
91 for (uint32_t i = 0; i < bytecode_fields.size(); i += 3) {
93 bool end = i + 3 >= bytecode_fields.size();
94 auto pc_index_1 = start ? 0 : pc_index + 31;
97 { C::bc_hashing_bytecode_id, bytecode_id },
98 { C::bc_hashing_latch, end },
99 { C::bc_hashing_output_hash, hash },
100 { C::bc_hashing_size_in_bytes, bytecode_size_in_bytes[j] },
101 { C::bc_hashing_input_len, bytecode_fields.size() },
102 { C::bc_hashing_rounds_rem, num_rounds },
103 { C::bc_hashing_packed_fields_0, bytecode_field_at(i) },
104 { C::bc_hashing_packed_fields_1, bytecode_field_at(i + 1) },
105 { C::bc_hashing_packed_fields_2, bytecode_field_at(i + 2) },
106 { C::bc_hashing_pc_index, pc_index },
107 { C::bc_hashing_pc_index_1, pc_index_1 },
108 { C::bc_hashing_pc_index_2, pc_index_1 + 31 },
109 { C::bc_hashing_sel, 1 },
110 { C::bc_hashing_sel_not_padding_1, end && padding_amount == 2 ? 0 : 1 },
111 { C::bc_hashing_sel_not_padding_2, end && padding_amount > 0 ? 0 : 1 },
112 { C::bc_hashing_sel_not_start, !start },
113 { C::bc_hashing_start, start },
117 FF pc_at_final_field =
123 : pc_index_1 + (31 * (1 - padding_amount));
126 { C::bc_hashing_pc_at_final_field, pc_at_final_field },
131 pc_index = pc_index_1 + 62;
140TEST_F(BytecodeHashingConstrainingTest, EmptyRow)
145TEST_F(BytecodeHashingConstrainingTest, SingleBytecodeHashOneRow)
149 std::vector<FF> bytecode_fields = { 1, 2 };
152 for (
auto bytecode_field : bytecode_fields) {
160 auto trace = TestTraceContainer({
161 { { C::precomputed_first_row, 1 } },
163 { C::bc_hashing_size_in_bytes,
bytecode.size() },
164 { C::bc_hashing_input_len, 3 },
165 { C::bc_hashing_latch, 1 },
166 { C::bc_hashing_packed_fields_0, sep },
167 { C::bc_hashing_packed_fields_1, 1 },
168 { C::bc_hashing_packed_fields_2, 2 },
169 { C::bc_hashing_pc_at_final_field, 31 },
170 { C::bc_hashing_pc_index_1, 0 },
171 { C::bc_hashing_pc_index_2, 31 },
172 { C::bc_hashing_sel_not_padding_1, 1 },
173 { C::bc_hashing_sel_not_padding_2, 1 },
174 { C::bc_hashing_bytecode_id, hash },
175 { C::bc_hashing_output_hash, hash },
176 { C::bc_hashing_pc_index, 0 },
177 { C::bc_hashing_rounds_rem, 1 },
178 { C::bc_hashing_sel, 1 },
179 { C::bc_hashing_start, 1 },
188 check_relation<bc_hashing>(trace);
189 check_all_interactions<BytecodeTraceBuilder>(trace);
192TEST_F(BytecodeHashingConstrainingTestTraceHelper, SingleBytecodeHash100Fields)
195 FF hash =
FF(
"0x09348974e76c3602893d7a4b4bb52c2ec746f1ade5004ac471d0fbb4587a81a6");
197 std::vector<FF> bytecode_fields = {};
198 for (uint32_t i = 1; i < 100; i++) {
199 bytecode_fields.push_back(
FF(i));
202 for (
auto bytecode_field : bytecode_fields) {
207 TestTraceContainer
trace = process_bc_hashing_trace({ bytecode_fields }, { hash }, {
bytecode.size() });
212 check_relation<bc_hashing>(trace);
213 check_all_interactions<BytecodeTraceBuilder>(trace);
214 EXPECT_EQ(
trace.
get(C::bc_hashing_output_hash, 1), hash);
217TEST_F(BytecodeHashingConstrainingTestTraceHelper, SingleBytecodeHashMax)
222 prepended_fields.insert(prepended_fields.end(), bytecode_fields.begin(), bytecode_fields.end());
225 TestTraceContainer
trace = process_bc_hashing_trace({ bytecode_fields }, { hash }, {
bytecode.size() });
229 check_relation<bc_hashing>(trace);
230 check_all_interactions<BytecodeTraceBuilder>(trace);
233TEST_F(BytecodeHashingConstrainingTestTraceHelper, MultipleBytecodeHash)
240 std::vector<FF> hashes;
241 std::vector<size_t> byte_sizes;
242 for (uint32_t i = 0; i < all_bytecode.size(); i++) {
245 prepended_fields.insert(prepended_fields.end(), all_bytecode_fields[i].begin(), all_bytecode_fields[i].end());
247 byte_sizes.push_back(all_bytecode[i].size());
250 TestTraceContainer
trace = process_bc_hashing_trace(all_bytecode_fields, hashes, byte_sizes);
253 for (uint32_t j = 0; j < all_bytecode.size(); j++) {
254 const auto&
bytecode = all_bytecode[j];
255 decomp_events.push_back(simulation::BytecodeDecompositionEvent{
258 builder.process_decomposition({ decomp_events },
trace);
260 check_relation<bc_hashing>(trace);
261 check_all_interactions<BytecodeTraceBuilder>(trace);
264TEST_F(BytecodeHashingConstrainingTest, BytecodeInteractions)
266 TestTraceContainer
trace({
267 { { C::precomputed_first_row, 1 } },
273 prepended_fields.insert(prepended_fields.end(), fields.begin(), fields.end());
276 builder.process_hashing({ { .bytecode_id = hash,
277 .bytecode_length =
static_cast<uint32_t
>(
bytecode.size()),
278 .bytecode_fields = fields } },
286 perm_builder(C::bc_decomposition_sel_packed);
287 perm_builder.process(trace);
289 check_interaction<BytecodeTraceBuilder, lookup_bc_hashing_check_final_bytes_remaining_settings>(trace);
294 check_relation<bc_hashing>(trace);
295 check_relation<bb::avm2::bc_decomposition<FF>>(
trace);
299TEST_F(BytecodeHashingConstrainingTest, NegativeLatchNotSel)
301 TestTraceContainer
trace;
304 { C::bc_hashing_latch, 1 },
305 { C::bc_hashing_sel, 1 },
311 "SEL_TOGGLED_AT_LATCH");
314TEST_F(BytecodeHashingConstrainingTest, NegativeInvalidStartAfterLatch)
316 TestTraceContainer
trace({
317 { { C::precomputed_first_row, 1 } },
319 builder.process_hashing({ { .bytecode_id = 1, .bytecode_length = 62, .bytecode_fields =
random_fields(2) },
320 { .bytecode_id = 2, .bytecode_length = 93, .bytecode_fields =
random_fields(3) } },
325 trace.
set(Column::bc_hashing_start, 2, 0);
329TEST_F(BytecodeHashingConstrainingTest, NegativeInvalidPCIncrement)
331 TestTraceContainer
trace({
332 { { C::precomputed_first_row, 1 } },
336 { .bytecode_id = 1, .bytecode_length = 124, .bytecode_fields =
random_fields(4) },
342 trace.
set(Column::bc_hashing_pc_index, 2, 10);
348 trace.
set(Column::bc_hashing_pc_index_2, 2, 10);
352TEST_F(BytecodeHashingConstrainingTest, NegativeStartIsSeparator)
354 TestTraceContainer
trace({
355 { { C::precomputed_first_row, 1 } },
357 builder.process_hashing({ { .bytecode_id = 1, .bytecode_length = 62, .bytecode_fields = { 1, 2 } } },
trace);
361 trace.
set(Column::bc_hashing_packed_fields_0, 1, 1);
363 "START_IS_FIRST_FIELD");
366TEST_F(BytecodeHashingConstrainingTest, NegativeBytecodeInteraction)
368 TestTraceContainer
trace({
369 { { C::precomputed_first_row, 1 } },
375 prepended_fields.insert(prepended_fields.end(), fields.begin(), fields.end());
378 builder.process_hashing({ { .bytecode_id = hash, .bytecode_length = 150, .bytecode_fields = fields } },
trace);
384 perm_builder(C::bc_decomposition_sel_packed);
385 perm_builder.process(trace);
389 trace.
set(Column::bc_hashing_pc_index, 2, 0);
394 "Failed.*GET_PACKED_FIELD_0. Could not find tuple in destination.");
395 trace.
set(Column::bc_hashing_pc_index, 2, 62);
397 trace.
set(Column::bc_hashing_packed_fields_1, 2, 0);
402 "Failed.*GET_PACKED_FIELD_1. Could not find tuple in destination.");
403 trace.
set(Column::bc_hashing_packed_fields_1, 2, prepended_fields[4]);
406 trace.
set(Column::bc_hashing_pc_index_2, 2, 0);
411 "Failed.*GET_PACKED_FIELD_2. Could not find tuple in destination.");
414 trace.
set(Column::bc_hashing_pc_index_2, 2, 124);
421 trace.
set(Column::bc_hashing_bytecode_id, 2, 0);
426 "Failed.*GET_PACKED_FIELD_.*. Could not find tuple in destination.");
429TEST_F(BytecodeHashingConstrainingTestTraceHelper, NegativePaddingSelectors)
435 TestTraceContainer
trace = process_bc_hashing_trace({ fields }, { 1 }, {
bytecode.size() });
441 trace.
set(Column::bc_hashing_latch, 2, 0);
443 trace.
set(Column::bc_hashing_latch, 2, 1);
446 trace.
set(Column::bc_hashing_sel_not_padding_2, 2, 1);
448 "PADDING_CONSISTENCY");
449 trace.
set(Column::bc_hashing_sel_not_padding_2, 2, 0);
452 trace.
set(Column::bc_hashing_packed_fields_1, 2, 1);
454 trace.
set(Column::bc_hashing_packed_fields_2, 2, 1);
458TEST_F(BytecodeHashingConstrainingTestTraceHelper, NegativePaddingUnder)
464 prepended_fields.insert(prepended_fields.end(), fields.begin(), fields.end());
467 TestTraceContainer
trace = process_bc_hashing_trace({ fields }, { hash }, {
bytecode.size() });
473 trace.
set(Column::bc_hashing_sel_not_padding_1, 2, 1);
476 "PADDING_CORRECTNESS");
478 trace.
set(Column::bc_hashing_pc_at_final_field, 2, 93);
485 "Failed.*GET_PACKED_FIELD_1. Could not find tuple in destination.");
488 (check_interaction<BytecodeTraceBuilder, lookup_bc_hashing_check_final_bytes_remaining_settings>(trace)),
489 "Failed.*CHECK_FINAL_BYTES_REMAINING. Could not find tuple in destination.");
492TEST_F(BytecodeHashingConstrainingTestTraceHelper, NegativePaddingOver)
498 TestTraceContainer
trace = process_bc_hashing_trace({ fields }, { 1 }, {
bytecode.size() });
504 trace.
set(Column::bc_hashing_sel_not_padding_1, 2, 0);
507 trace.
set(Column::bc_hashing_packed_fields_1, 2, 0);
508 trace.
set(Column::bc_hashing_pc_at_final_field, 2, 62);
511 (check_interaction<BytecodeTraceBuilder, lookup_bc_hashing_check_final_bytes_remaining_settings>(trace)),
512 "Failed.*CHECK_FINAL_BYTES_REMAINING. Could not find tuple in destination.");
515TEST_F(BytecodeHashingConstrainingTestTraceHelper, NegativeInputLen)
521 TestTraceContainer
trace = process_bc_hashing_trace({ fields }, { 1 }, {
bytecode.size() });
526 trace.
set(Column::bc_hashing_input_len, 1, 0);
528 (check_interaction<BytecodeTraceBuilder, lookup_bc_hashing_poseidon2_hash_settings>(trace)),
529 "LOOKUP_BC_HASHING_POSEIDON2_HASH");
531 trace.
set(Column::bc_hashing_input_len, 1, 4);
534 trace.
set(Column::bc_hashing_input_len, 2, 0);
536 "BYTECODE_LENGTH_FIELDS");
539TEST_F(BytecodeHashingConstrainingTestTraceHelper, NegativeRounds)
545 TestTraceContainer
trace = process_bc_hashing_trace({ fields }, { 1 }, {
bytecode.size() });
550 trace.
set(Column::bc_hashing_rounds_rem, 1, 3);
554 trace.
set(Column::bc_hashing_rounds_rem, 2, 2);
558TEST_F(BytecodeHashingConstrainingTestTraceHelper, NegativeOutputHash)
562 prepended_fields.insert(prepended_fields.end(), bytecode_fields.begin(), bytecode_fields.end());
564 TestTraceContainer
trace = process_bc_hashing_trace({ bytecode_fields }, { hash }, { bytecode_fields.size() * 31 });
566 check_relation<bc_hashing>(trace);
567 check_interaction<BytecodeTraceBuilder, lookup_bc_hashing_poseidon2_hash_settings>(trace);
570 trace.
set(Column::bc_hashing_output_hash, 2, 123);
572 (check_interaction<BytecodeTraceBuilder, lookup_bc_hashing_poseidon2_hash_settings>(trace)),
573 "LOOKUP_BC_HASHING_POSEIDON2_HASH");
576TEST_F(BytecodeHashingConstrainingTest, NegativeSingleBytecodeHashIncrements)
588 auto bad_hash =
poseidon2.
hash({ sep, bytecode_fields[1], bytecode_fields[2] });
590 auto trace = TestTraceContainer({
591 { { C::precomputed_first_row, 1 } },
593 { C::bc_hashing_latch, 1 },
594 { C::bc_hashing_packed_fields_0, sep },
595 { C::bc_hashing_packed_fields_1, bytecode_fields[1] },
596 { C::bc_hashing_packed_fields_2, bytecode_fields[2] },
597 { C::bc_hashing_pc_at_final_field, 62 },
598 { C::bc_hashing_pc_index_1, 31 },
599 { C::bc_hashing_pc_index_2, 62 },
600 { C::bc_hashing_sel_not_padding_1, 1 },
601 { C::bc_hashing_sel_not_padding_2, 1 },
602 { C::bc_hashing_bytecode_id, 1 },
603 { C::bc_hashing_output_hash, bad_hash },
604 { C::bc_hashing_pc_index, 31 },
605 { C::bc_hashing_sel, 1 },
606 { C::bc_hashing_sel_not_start, 0 },
607 { C::bc_hashing_start, 1 },
619TEST_F(BytecodeHashingConstrainingTest, NegativeSingleBytecodeHashLength)
630 auto bad_hash =
poseidon2.
hash({ 0xa, 0xb, 0xc, sep, bytecode_fields[0], bytecode_fields[1], bytecode_fields[2] });
632 auto trace = TestTraceContainer({
633 { { C::precomputed_first_row, 1 } },
635 { C::bc_hashing_input_len, 7 },
636 { C::bc_hashing_packed_fields_0, sep },
637 { C::bc_hashing_packed_fields_1, bytecode_fields[0] },
638 { C::bc_hashing_packed_fields_2, bytecode_fields[1] },
639 { C::bc_hashing_pc_index_1, 0 },
640 { C::bc_hashing_pc_index_2, 31 },
641 { C::bc_hashing_sel_not_padding_1, 1 },
642 { C::bc_hashing_sel_not_padding_2, 1 },
643 { C::bc_hashing_bytecode_id, 1 },
644 { C::bc_hashing_output_hash, bad_hash },
645 { C::bc_hashing_pc_index, 0 },
646 { C::bc_hashing_rounds_rem, 2 },
647 { C::bc_hashing_sel, 1 },
648 { C::bc_hashing_start, 1 },
651 { C::bc_hashing_input_len, 7 },
652 { C::bc_hashing_latch, 1 },
653 { C::bc_hashing_packed_fields_0, bytecode_fields[2] },
654 { C::bc_hashing_packed_fields_1, 0 },
655 { C::bc_hashing_packed_fields_2, 0 },
656 { C::bc_hashing_pc_at_final_field, 62 },
657 { C::bc_hashing_pc_index_1, 93 },
658 { C::bc_hashing_pc_index_2, 124 },
659 { C::bc_hashing_bytecode_id, 1 },
660 { C::bc_hashing_output_hash, bad_hash },
661 { C::bc_hashing_pc_index, 62 },
662 { C::bc_hashing_rounds_rem, 1 },
663 { C::bc_hashing_sel, 1 },
664 { C::bc_hashing_sel_not_start, 1 },
676 (check_interaction<BytecodeTraceBuilder, lookup_bc_hashing_poseidon2_hash_settings>(trace)),
677 "LOOKUP_BC_HASHING_POSEIDON2_HASH");
680 "BYTECODE_LENGTH_FIELDS");
683TEST_F(BytecodeHashingConstrainingTest, NegativeSingleBytecodeHashLengthBytes)
695 auto bad_hash =
poseidon2.
hash({ sep, bytecode_fields[0], bytecode_fields[1], bytecode_fields[2] });
697 auto trace = TestTraceContainer({
698 { { C::precomputed_first_row, 1 } },
700 { C::bc_hashing_size_in_bytes, 92 },
701 { C::bc_hashing_input_len, 4 },
702 { C::bc_hashing_packed_fields_0, sep },
703 { C::bc_hashing_packed_fields_1, bytecode_fields[0] },
704 { C::bc_hashing_packed_fields_2, bytecode_fields[1] },
705 { C::bc_hashing_pc_index_1, 0 },
706 { C::bc_hashing_pc_index_2, 31 },
707 { C::bc_hashing_sel_not_padding_1, 1 },
708 { C::bc_hashing_sel_not_padding_2, 1 },
709 { C::bc_hashing_bytecode_id, 1 },
710 { C::bc_hashing_output_hash, bad_hash },
711 { C::bc_hashing_pc_index, 0 },
712 { C::bc_hashing_rounds_rem, 2 },
713 { C::bc_hashing_sel, 1 },
714 { C::bc_hashing_start, 1 },
717 { C::bc_hashing_input_len, 4 },
718 { C::bc_hashing_latch, 1 },
719 { C::bc_hashing_packed_fields_0, bytecode_fields[2] },
720 { C::bc_hashing_packed_fields_1, 0 },
721 { C::bc_hashing_packed_fields_2, 0 },
722 { C::bc_hashing_pc_at_final_field, 62 },
723 { C::bc_hashing_pc_index_1, 93 },
724 { C::bc_hashing_pc_index_2, 124 },
725 { C::bc_hashing_bytecode_id, 1 },
726 { C::bc_hashing_output_hash, bad_hash },
727 { C::bc_hashing_pc_index, 62 },
728 { C::bc_hashing_rounds_rem, 1 },
729 { C::bc_hashing_sel, 1 },
730 { C::bc_hashing_sel_not_start, 1 },
744 (check_interaction<BytecodeTraceBuilder, perm_bc_hashing_bytecode_length_bytes_settings>(trace)),
745 "PERM_BC_HASHING_BYTECODE_LENGTH_BYTES");
748TEST_F(BytecodeHashingConstrainingTest, NegativeSingleBytecodeHashOutputConsistency)
760 { sep, bytecode_fields[0], bytecode_fields[1], bytecode_fields[2], bytecode_fields[3], bytecode_fields[4] });
761 auto bad_hash =
poseidon2.
hash({ 0xa, 0xb, 0xc, bytecode_fields[2], bytecode_fields[3], bytecode_fields[4] });
763 auto trace = TestTraceContainer({
764 { { C::precomputed_first_row, 1 } },
766 { C::bc_hashing_size_in_bytes,
bytecode.size() },
767 { C::bc_hashing_input_len, 6 },
768 { C::bc_hashing_packed_fields_0, sep },
769 { C::bc_hashing_packed_fields_1, bytecode_fields[0] },
770 { C::bc_hashing_packed_fields_2, bytecode_fields[1] },
771 { C::bc_hashing_pc_index_1, 0 },
772 { C::bc_hashing_pc_index_2, 31 },
773 { C::bc_hashing_sel_not_padding_1, 1 },
774 { C::bc_hashing_sel_not_padding_2, 1 },
775 { C::bc_hashing_bytecode_id, good_hash },
776 { C::bc_hashing_output_hash, good_hash },
777 { C::bc_hashing_pc_index, 0 },
778 { C::bc_hashing_rounds_rem, 2 },
779 { C::bc_hashing_sel, 1 },
780 { C::bc_hashing_start, 1 },
783 { C::bc_hashing_input_len, 6 },
784 { C::bc_hashing_latch, 1 },
785 { C::bc_hashing_packed_fields_0, bytecode_fields[2] },
786 { C::bc_hashing_packed_fields_1, bytecode_fields[3] },
787 { C::bc_hashing_packed_fields_2, bytecode_fields[4] },
788 { C::bc_hashing_pc_at_final_field, 124 },
789 { C::bc_hashing_pc_index_1, 93 },
790 { C::bc_hashing_pc_index_2, 124 },
791 { C::bc_hashing_sel_not_padding_1, 1 },
792 { C::bc_hashing_sel_not_padding_2, 1 },
793 { C::bc_hashing_bytecode_id, good_hash },
794 { C::bc_hashing_output_hash, bad_hash },
795 { C::bc_hashing_pc_index, 62 },
796 { C::bc_hashing_rounds_rem, 1 },
797 { C::bc_hashing_sel, 1 },
798 { C::bc_hashing_sel_not_start, 1 },
808 check_all_interactions<BytecodeTraceBuilder>(trace);
812 trace.
set(Column::bc_hashing_bytecode_id, 2, bad_hash);
815 (check_interaction<BytecodeTraceBuilder, lookup_bc_hashing_check_final_bytes_remaining_settings>(trace)),
816 "Failed.*CHECK_FINAL_BYTES_REMAINING. Could not find tuple in destination.");
826TEST_F(BytecodeHashingConstrainingTest, NegativeGhostRowInjectionBlocked)
830 TestTraceContainer
trace({
831 { { C::precomputed_first_row, 1 } },
833 { C::bc_hashing_sel, 0 },
834 { C::bc_hashing_sel_not_padding_1, 1 },
835 { C::bc_hashing_sel_not_padding_2, 0 },
843 trace.
set(C::bc_hashing_sel_not_padding_1, 1, 0);
844 trace.
set(C::bc_hashing_sel_not_padding_2, 1, 1);
#define EXPECT_THROW_WITH_MESSAGE(code, expectedMessageRegex)
std::shared_ptr< Napi::ThreadSafeFunction > bytecode
#define MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS
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
static constexpr size_t SR_SEL_TOGGLED_AT_LATCH
static constexpr size_t SR_PADDING_CONSISTENCY
static constexpr size_t SR_ROUNDS_DECREMENT
static constexpr size_t SR_PADDING_END
static constexpr size_t SR_PC_INCREMENTS_2
static constexpr size_t SR_START_IS_FIRST_FIELD
static constexpr size_t SR_START_AFTER_LATCH
static constexpr size_t SR_PADDED_BY_ZERO_2
static constexpr size_t SR_PADDING_CORRECTNESS
static constexpr size_t SR_HASH_IS_ID
static constexpr size_t SR_ID_PROPAGATION
static constexpr size_t SR_PADDED_BY_ZERO_1
static constexpr size_t SR_PC_INCREMENTS
static constexpr size_t SR_BYTECODE_LENGTH_FIELDS
static constexpr size_t SR_PC_INCREMENTS_1
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)
const FF & get(Column col, uint32_t row) const
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
void check_multipermutation_interaction(tracegen::TestTraceContainer &trace)
TEST_F(AvmRecursiveTests, TwoLayerAvmRecursionFailsWithWrongPIs)
std::vector< FF > encode_bytecode(std::span< const uint8_t > bytecode)
FF compute_public_bytecode_first_field(size_t bytecode_size)
std::vector< uint8_t > random_bytes(size_t n)
TestTraceContainer empty_trace()
std::vector< FF > random_fields(size_t n)
permutation_settings< perm_bc_hashing_get_packed_field_2_settings_ > perm_bc_hashing_get_packed_field_2_settings
permutation_settings< perm_bc_hashing_get_packed_field_1_settings_ > perm_bc_hashing_get_packed_field_1_settings
permutation_settings< perm_bc_hashing_get_packed_field_0_settings_ > perm_bc_hashing_get_packed_field_0_settings
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
std::vector< uint8_t > to_buffer(T const &value)