1#include <gmock/gmock.h>
2#include <gtest/gtest.h>
35using tracegen::BytecodeTraceBuilder;
36using tracegen::PrecomputedTraceBuilder;
37using tracegen::RangeCheckTraceBuilder;
38using tracegen::TestTraceContainer;
43using instr_fetching = instr_fetching<FF>;
45using simulation::BytecodeDecompositionEvent;
47using simulation::Instruction;
48using simulation::InstructionFetchingEvent;
50using simulation::RangeCheckEvent;
52TEST(InstrFetchingConstrainingTest, EmptyRow)
58TEST(InstrFetchingConstrainingTest, Add8WithTraceGen)
60 TestTraceContainer
trace;
67 .operands = { Operand::from<uint8_t>(0x34), Operand::from<uint8_t>(0x35), Operand::from<uint8_t>(0x36) },
70 std::vector<uint8_t>
bytecode = add_8_instruction.serialize();
72 builder.process_instruction_fetching({ { .bytecode_id = 1,
74 .instruction = add_8_instruction,
80 check_relation<instr_fetching>(trace);
85TEST(InstrFetchingConstrainingTest, EcaddWithTraceGen)
87 TestTraceContainer
trace;
93 .addressing_mode = 0x1f1f,
94 .operands = { Operand::from<uint16_t>(0x1279),
95 Operand::from<uint16_t>(0x127a),
96 Operand::from<uint16_t>(0x127b),
97 Operand::from<uint16_t>(0x127c),
98 Operand::from<uint16_t>(0x127d),
99 Operand::from<uint16_t>(0x127e),
100 Operand::from<uint16_t>(0x127f) },
103 std::vector<uint8_t>
bytecode = ecadd_instruction.serialize();
104 builder.process_instruction_fetching({ { .bytecode_id = 1,
106 .instruction = ecadd_instruction,
112 check_relation<instr_fetching>(trace);
122 instructions.reserve(num_opcodes);
125 for (
size_t i = 0; i < num_opcodes; i++) {
126 pc_positions.at(i) =
static_cast<uint32_t
>(
bytecode.size());
128 instructions.emplace_back(instr);
129 const auto instruction_bytes = instr.serialize();
139 instr_events.reserve(num_opcodes);
140 for (
size_t i = 0; i < num_opcodes; i++) {
141 instr_events.emplace_back(InstructionFetchingEvent{
142 .bytecode_id = 1, .pc = pc_positions.at(i), .instruction = instructions.at(i), .bytecode = bytecode_ptr });
149TEST(InstrFetchingConstrainingTest, EachOpcodeWithTraceGen)
151 TestTraceContainer
trace;
155 builder.process_instruction_fetching(gen_instr_events_each_opcode(), trace);
160 check_relation<instr_fetching>(trace);
166TEST(InstrFetchingConstrainingTest, NegativeWrongOperand)
172 std::vector<size_t> sub_relations = {
184 C::instr_fetching_addressing_mode,
185 C::instr_fetching_op1,
186 C::instr_fetching_op2,
187 C::instr_fetching_op3,
188 C::instr_fetching_op4,
189 C::instr_fetching_op5,
190 C::instr_fetching_op6,
191 C::instr_fetching_op7,
194 for (
const auto& opcode : opcodes) {
195 TestTraceContainer
trace;
197 builder.process_instruction_fetching(
198 { { .bytecode_id = 1,
200 .instruction = instr,
205 check_relation<instr_fetching>(trace);
209 for (
size_t i = 0; i < operand_cols.size(); i++) {
210 auto mutated_trace =
trace;
211 const FF mutated_operand =
trace.
get(operand_cols.at(i), 0) + 1;
212 mutated_trace.set(operand_cols.at(i), 0, mutated_operand);
222TEST(InstrFetchingConstrainingTest, WireInstructionSpecInteractions)
224 TestTraceContainer
trace;
225 BytecodeTraceBuilder bytecode_builder;
230 bytecode_builder.process_instruction_fetching(gen_instr_events_each_opcode(), trace);
235 check_interaction<BytecodeTraceBuilder, lookup_instr_fetching_wire_instruction_info_settings>(trace);
236 check_relation<instr_fetching>(trace);
242 range_check_events.reserve(instr_events.size());
244 for (
const auto& instr_event : instr_events) {
245 range_check_events.emplace_back(RangeCheckEvent{
247 (instr_event.error.has_value() && instr_event.error == InstrDeserializationEventError::PC_OUT_OF_RANGE)
248 ? instr_event.pc - instr_event.bytecode->size()
249 : instr_event.bytecode->size() - instr_event.pc - 1,
253 return range_check_events;
258TEST(InstrFetchingConstrainingTest, BcDecompositionInteractions)
260 TestTraceContainer
trace;
261 BytecodeTraceBuilder bytecode_builder;
264 const auto instr_fetch_events = gen_instr_events_each_opcode();
265 bytecode_builder.process_instruction_fetching(instr_fetch_events, trace);
266 bytecode_builder.process_decomposition({ {
267 .bytecode_id = instr_fetch_events.at(0).bytecode_id,
268 .
bytecode = instr_fetch_events.at(0).bytecode,
280 check_relation<instr_fetching>(trace);
287 TestTraceContainer
trace;
288 BytecodeTraceBuilder bytecode_builder;
296 bytecode_builder.process_instruction_fetching(instr_events, trace);
311 check_relation<instr_fetching>(trace);
317 TestTraceContainer
trace;
318 BytecodeTraceBuilder bytecode_builder;
324 bytecode_builder.process_instruction_fetching(instr_events, trace);
337 check_relation<instr_fetching>(trace);
343TEST(InstrFetchingConstrainingTest, MultipleBytecodes)
345 const auto instr_fetch_events = gen_instr_events_each_opcode();
346 constexpr size_t num_of_bytecodes = 5;
350 for (
size_t i = 0; i < num_of_bytecodes; i++) {
352 const auto num_of_instr = i * 6;
354 for (
size_t j = 0; j < num_of_instr; j++) {
355 const auto& instr = instr_fetch_events.at(j).instruction;
356 const auto instruction_bytes = instr.serialize();
364 for (
size_t j = 0; j < num_of_instr; j++) {
365 auto instr_event = instr_fetch_events.at(j);
366 instr_event.bytecode_id =
static_cast<BytecodeId>(i);
367 instr_event.bytecode = bytecode_ptr;
368 instr_events.emplace_back(instr_event);
383TEST(InstrFetchingConstrainingTest, SingleInstructionOutOfRange)
387 .addressing_mode = 3,
388 .operands = { Operand::from<uint8_t>(0x34), Operand::from<uint8_t>(0x35), Operand::from<uint8_t>(0x36) },
391 std::vector<uint8_t>
bytecode = add_8_instruction.serialize();
399 .bytecode = bytecode_ptr,
400 .error = InstrDeserializationEventError::INSTRUCTION_OUT_OF_RANGE,
407 .bytecode = bytecode_ptr,
418TEST(InstrFetchingConstrainingTest, SingleInstructionOutOfRangeSplitOperand)
422 .addressing_mode = 0x01,
423 .operands = { Operand::from<uint16_t>(0x1279),
428 std::vector<uint8_t>
bytecode = set_ff_instruction.serialize();
436 .bytecode = bytecode_ptr,
437 .error = InstrDeserializationEventError::INSTRUCTION_OUT_OF_RANGE,
444 .bytecode = bytecode_ptr,
452TEST(InstrFetchingConstrainingTest, SingleInstructionPcOutOfRange)
456 .addressing_mode = 3,
457 .operands = { Operand::from<uint8_t>(0x34), Operand::from<uint8_t>(0x35), Operand::from<uint8_t>(0x36) },
460 std::vector<uint8_t>
bytecode = add_8_instruction.serialize();
468 .instruction = add_8_instruction,
469 .bytecode = bytecode_ptr,
473 .pc =
static_cast<uint32_t
>(bytecode_ptr->size() + 1),
475 .error = InstrDeserializationEventError::PC_OUT_OF_RANGE,
482 .bytecode = bytecode_ptr,
492TEST(InstrFetchingConstrainingTest, SingleInstructionOpcodeOutOfRange)
496 .addressing_mode = 0,
497 .operands = { Operand::from<uint16_t>(0x1234),
499 Operand::from<uint128_t>(
static_cast<uint128_t>(0xFF) << 120) },
502 std::vector<uint8_t>
bytecode = set_128_instruction.serialize();
509 .instruction = set_128_instruction,
510 .bytecode = bytecode_ptr,
515 .bytecode = bytecode_ptr,
516 .error = InstrDeserializationEventError::OPCODE_OUT_OF_RANGE,
523 .bytecode = bytecode_ptr,
533TEST(InstrFetchingConstrainingTest, SingleInstructionTagOutOfRange)
537 .addressing_mode = 0,
538 .operands = { Operand::from<uint16_t>(0x1234), Operand::from<uint8_t>(12), Operand::from<uint16_t>(0x5678) },
541 std::vector<uint8_t>
bytecode = set_16_instruction.serialize();
548 .instruction = set_16_instruction,
549 .bytecode = bytecode_ptr,
550 .error = InstrDeserializationEventError::TAG_OUT_OF_RANGE,
557 .bytecode = bytecode_ptr,
565TEST(InstrFetchingConstrainingTest, NegativeWrongWireInstructionSpecInteractions)
567 BytecodeTraceBuilder bytecode_builder;
574 for (
const auto& opcode : opcodes) {
575 TestTraceContainer
trace;
577 bytecode_builder.process_instruction_fetching(
578 { { .bytecode_id = 1,
580 .instruction = instr,
587 check_interaction<BytecodeTraceBuilder, lookup_instr_fetching_wire_instruction_info_settings>(trace);
589 ASSERT_EQ(
trace.
get(C::lookup_instr_fetching_wire_instruction_info_counts,
static_cast<uint32_t
>(opcode)), 1);
592 C::instr_fetching_exec_opcode, C::instr_fetching_instr_size, C::instr_fetching_sel_has_tag,
593 C::instr_fetching_sel_tag_is_op2, C::instr_fetching_sel_op_dc_0, C::instr_fetching_sel_op_dc_1,
594 C::instr_fetching_sel_op_dc_2, C::instr_fetching_sel_op_dc_3, C::instr_fetching_sel_op_dc_4,
595 C::instr_fetching_sel_op_dc_5, C::instr_fetching_sel_op_dc_6, C::instr_fetching_sel_op_dc_7,
596 C::instr_fetching_sel_op_dc_8, C::instr_fetching_sel_op_dc_9, C::instr_fetching_sel_op_dc_10,
597 C::instr_fetching_sel_op_dc_11, C::instr_fetching_sel_op_dc_12, C::instr_fetching_sel_op_dc_13,
598 C::instr_fetching_sel_op_dc_14, C::instr_fetching_sel_op_dc_15, C::instr_fetching_sel_op_dc_16,
602 for (
const auto& col : mutated_cols) {
603 auto mutated_trace =
trace;
604 const FF mutated_value =
trace.
get(col, 1) + 1;
605 mutated_trace.set(col, 1, mutated_value);
608 (check_interaction<BytecodeTraceBuilder, lookup_instr_fetching_wire_instruction_info_settings>(
610 "Failed.*LOOKUP_INSTR_FETCHING_WIRE_INSTRUCTION_INFO.*Could not find tuple in destination.");
616TEST(InstrFetchingConstrainingTest, NegativeWrongBcDecompositionInteractions)
618 TestTraceContainer
trace;
619 BytecodeTraceBuilder bytecode_builder;
625 for (
const auto& opcode : opcodes) {
626 TestTraceContainer
trace;
629 bytecode_builder.process_instruction_fetching({ {
632 .instruction = instr,
633 .bytecode = bytecode_ptr,
636 bytecode_builder.process_decomposition({ {
638 .bytecode = bytecode_ptr,
642 auto valid_trace =
trace;
643 check_interaction<BytecodeTraceBuilder, lookup_instr_fetching_bytes_from_bc_dec_settings>(valid_trace);
646 C::instr_fetching_pc, C::instr_fetching_bytecode_id, C::instr_fetching_bd0, C::instr_fetching_bd1,
647 C::instr_fetching_bd2, C::instr_fetching_bd3, C::instr_fetching_bd4, C::instr_fetching_bd5,
648 C::instr_fetching_bd6, C::instr_fetching_bd7, C::instr_fetching_bd8, C::instr_fetching_bd9,
649 C::instr_fetching_bd10, C::instr_fetching_bd11, C::instr_fetching_bd12, C::instr_fetching_bd13,
650 C::instr_fetching_bd14, C::instr_fetching_bd15, C::instr_fetching_bd16, C::instr_fetching_bd17,
651 C::instr_fetching_bd18, C::instr_fetching_bd19, C::instr_fetching_bd20, C::instr_fetching_bd21,
652 C::instr_fetching_bd22, C::instr_fetching_bd23, C::instr_fetching_bd24, C::instr_fetching_bd25,
653 C::instr_fetching_bd26, C::instr_fetching_bd27, C::instr_fetching_bd28, C::instr_fetching_bd29,
654 C::instr_fetching_bd30, C::instr_fetching_bd31, C::instr_fetching_bd32, C::instr_fetching_bd33,
655 C::instr_fetching_bd34, C::instr_fetching_bd35, C::instr_fetching_bd36,
659 for (
const auto& col : mutated_cols) {
660 auto mutated_trace =
trace;
661 const FF mutated_value =
trace.
get(col, 1) + 1;
662 mutated_trace.set(col, 1, mutated_value);
665 (check_interaction<BytecodeTraceBuilder, lookup_instr_fetching_bytes_from_bc_dec_settings>(
667 "Failed.*BYTES_FROM_BC_DEC. Could not find tuple in destination.");
674TEST(InstrFetchingConstrainingTest, NegativeWrongBytecodeSizeBcDecompositionInteractions)
676 TestTraceContainer
trace;
677 BytecodeTraceBuilder bytecode_builder;
680 const uint32_t pc = 15;
681 std::vector<uint8_t>
bytecode(pc, 0x23);
687 for (
const auto& opcode : opcodes) {
688 TestTraceContainer
trace;
691 const auto instr_bytecode = instr.serialize();
697 bytecode_builder.process_instruction_fetching({ {
700 .instruction = instr,
701 .bytecode = bytecode_ptr,
704 bytecode_builder.process_decomposition({ {
706 .bytecode = bytecode_ptr,
711 auto valid_trace =
trace;
712 check_interaction<BytecodeTraceBuilder, lookup_instr_fetching_bytecode_size_from_bc_dec_settings>(valid_trace);
714 auto mutated_trace =
trace;
715 const FF mutated_value =
trace.
get(C::instr_fetching_bytecode_size, 1) + 1;
716 mutated_trace.set(C::instr_fetching_bytecode_size, 1, mutated_value);
719 (check_interaction<BytecodeTraceBuilder, lookup_instr_fetching_bytecode_size_from_bc_dec_settings>(
721 "Failed.*BYTECODE_SIZE_FROM_BC_DEC. Could not find tuple in destination.");
725using ::bb::avm2::testing::InstructionBuilder;
726using simulation::EventEmitter;
727using simulation::MockExecutionIdManager;
728using simulation::MockGreaterThan;
729using simulation::Poseidon2;
730using simulation::Poseidon2HashEvent;
731using simulation::Poseidon2PermutationEvent;
732using simulation::Poseidon2PermutationMemoryEvent;
733using ::testing::StrictMock;
734using tracegen::Poseidon2TraceBuilder;
736TEST(InstrFetchingConstrainingTest, NegativeTruncatedBytecodeRepro)
738 TestTraceContainer
trace;
739 BytecodeTraceBuilder bytecode_builder;
745 StrictMock<MockGreaterThan>
mock_gt;
754 const uint32_t pc = 15;
755 std::vector<uint8_t>
bytecode(pc, 0x23);
756 const auto add_instr =
757 InstructionBuilder(
WireOpCode::SUB_8).operand<uint8_t>(5).operand<uint8_t>(5).operand<uint8_t>(0).build();
758 const auto instr_bytecode = add_instr.serialize();
764 prepended_fields.insert(prepended_fields.end(), fields.begin(), fields.end());
768 std::vector<uint8_t> trunc_bytecode(pc, 0x23);
769 trunc_bytecode.insert(trunc_bytecode.end(),
772 trunc_bytecode.resize(trunc_bytecode.size() - 1);
775 trunc_prepended_fields.insert(trunc_prepended_fields.end(), trunc_fields.begin(), trunc_fields.end());
782 ASSERT_NE(hash, trunc_hash);
787 InstructionFetchingEvent instr_event = {
790 .instruction = add_instr,
791 .bytecode = bytecode_ptr,
793 bytecode_builder.process_instruction_fetching({ instr_event },
trace);
794 bytecode_builder.process_hashing({ {
796 .bytecode_length =
static_cast<uint32_t
>(trunc_bytecode.size()),
797 .bytecode_fields = trunc_fields,
801 bytecode_builder.process_decomposition({ {
803 .bytecode = trunc_bytecode_ptr,
817 perm_builder(C::bc_decomposition_sel_packed);
818 perm_builder.process(trace);
822TEST(InstrFetchingConstrainingTest, NegativeWrongTagValidationInteractions)
824 TestTraceContainer
trace;
825 BytecodeTraceBuilder bytecode_builder;
832 for (
const auto& opcode : opcodes) {
833 TestTraceContainer
trace;
835 bytecode_builder.process_instruction_fetching(
836 { { .bytecode_id = 1,
838 .instruction = instr,
845 check_interaction<BytecodeTraceBuilder, lookup_instr_fetching_tag_value_validation_settings>(trace);
847 auto valid_trace =
trace;
850 auto mutated_trace =
trace;
851 ASSERT_EQ(
trace.
get(C::instr_fetching_tag_out_of_range, 1), 0);
852 mutated_trace.set(C::instr_fetching_tag_out_of_range, 1, 1);
855 (check_interaction<BytecodeTraceBuilder, lookup_instr_fetching_tag_value_validation_settings>(
857 "Failed.*LOOKUP_INSTR_FETCHING_TAG_VALUE_VALIDATION.*Could not find tuple in destination.");
862TEST(InstrFetchingConstrainingTest, NegativeNotTogglingInstrOutOfRange)
864 TestTraceContainer
trace({
865 { { C::precomputed_first_row, 1 } },
867 { C::instr_fetching_bytes_to_read, 11 },
868 { C::instr_fetching_instr_abs_diff, 0 },
869 { C::instr_fetching_instr_out_of_range, 1 },
870 { C::instr_fetching_instr_size, 12 },
871 { C::instr_fetching_sel, 1 },
877 trace.
set(C::instr_fetching_instr_out_of_range, 1, 0);
880 "INSTR_OUT_OF_RANGE_TOGGLE");
884TEST(InstrFetchingConstrainingTest, NegativeTogglingInstrInRange)
886 TestTraceContainer
trace({
887 { { C::precomputed_first_row, 1 } },
889 { C::instr_fetching_bytes_to_read, 12 },
890 { C::instr_fetching_instr_abs_diff, 0 },
891 { C::instr_fetching_instr_out_of_range, 0 },
892 { C::instr_fetching_instr_size, 12 },
893 { C::instr_fetching_sel, 1 },
899 trace.
set(C::instr_fetching_instr_out_of_range, 1, 1);
902 "INSTR_OUT_OF_RANGE_TOGGLE");
906TEST(InstrFetchingConstrainingTest, NegativeNotTogglingPcOutOfRange)
908 TestTraceContainer
trace({
909 { { C::precomputed_first_row, 1 } },
911 { C::instr_fetching_bytecode_size, 12 },
912 { C::instr_fetching_pc, 12 },
913 { C::instr_fetching_pc_abs_diff, 0 },
914 { C::instr_fetching_pc_out_of_range, 1 },
915 { C::instr_fetching_sel, 1 },
921 trace.
set(C::instr_fetching_pc_out_of_range, 1, 0);
924 "PC_OUT_OF_RANGE_TOGGLE");
928TEST(InstrFetchingConstrainingTest, NegativeTogglingPcInRange)
930 TestTraceContainer
trace({
931 { { C::precomputed_first_row, 1 } },
933 { C::instr_fetching_bytecode_size, 12 },
934 { C::instr_fetching_pc, 11 },
935 { C::instr_fetching_pc_abs_diff, 0 },
936 { C::instr_fetching_pc_out_of_range, 0 },
937 { C::instr_fetching_sel, 1 },
943 trace.
set(C::instr_fetching_pc_out_of_range, 1, 1);
946 "PC_OUT_OF_RANGE_TOGGLE");
949TEST(InstrFetchingConstrainingTest, ErrorFlagSetButSelParsingErrIsZero)
954 TestTraceContainer
trace({
955 { { C::precomputed_first_row, 1 } },
957 { C::instr_fetching_sel, 1 },
959 { C::instr_fetching_pc_out_of_range, 1 },
960 { C::instr_fetching_opcode_out_of_range, 0 },
961 { C::instr_fetching_instr_out_of_range, 0 },
962 { C::instr_fetching_tag_out_of_range, 0 },
964 { C::instr_fetching_sel_parsing_err, 0 },
968 { C::instr_fetching_bytecode_size, 10 },
969 { C::instr_fetching_pc, 15 },
970 { C::instr_fetching_pc_abs_diff, 5 },
971 { C::instr_fetching_pc_size_in_bits, 32 },
976 { C::instr_fetching_bytes_to_read, 10 },
977 { C::instr_fetching_instr_size, 5 },
978 { C::instr_fetching_instr_abs_diff, 5 },
983 "Relation instr_fetching, subrelation 5 failed at row 1");
990TEST(InstrFetchingConstrainingTest, CorrectBehavior_SelParsingErrMatchesErrors)
992 TestTraceContainer
trace({
993 { { C::precomputed_first_row, 1 } },
995 { C::instr_fetching_sel, 1 },
996 { C::instr_fetching_pc_out_of_range, 1 },
997 { C::instr_fetching_opcode_out_of_range, 0 },
998 { C::instr_fetching_instr_out_of_range, 0 },
999 { C::instr_fetching_tag_out_of_range, 0 },
1000 { C::instr_fetching_sel_parsing_err, 1 },
1002 { C::instr_fetching_bytecode_size, 10 },
1003 { C::instr_fetching_pc, 15 },
1004 { C::instr_fetching_pc_abs_diff, 5 },
1005 { C::instr_fetching_pc_size_in_bits, 32 },
1006 { C::instr_fetching_bytes_to_read, 10 },
1007 { C::instr_fetching_instr_size, 5 },
1008 { C::instr_fetching_instr_abs_diff, 5 },
1013 check_relation<instr_fetching>(trace);
1019TEST(InstrFetchingConstrainingTest, CorrectBehavior_NoErrorsMeansSelParsingErrIsZero)
1021 TestTraceContainer
trace({
1022 { { C::precomputed_first_row, 1 } },
1024 { C::instr_fetching_sel, 1 },
1025 { C::instr_fetching_pc_out_of_range, 0 },
1026 { C::instr_fetching_opcode_out_of_range, 0 },
1027 { C::instr_fetching_instr_out_of_range, 0 },
1028 { C::instr_fetching_tag_out_of_range, 0 },
1029 { C::instr_fetching_sel_parsing_err, 0 },
1030 { C::instr_fetching_sel_pc_in_range, 1 },
1034 { C::instr_fetching_bytecode_size, 20 },
1035 { C::instr_fetching_pc, 5 },
1036 { C::instr_fetching_pc_abs_diff, 14 },
1037 { C::instr_fetching_pc_size_in_bits, 32 },
1039 { C::instr_fetching_bytes_to_read, 15 },
1040 { C::instr_fetching_instr_size, 10 },
1041 { C::instr_fetching_instr_abs_diff, 5 },
1046 check_relation<instr_fetching>(trace);
#define EXPECT_THROW_WITH_MESSAGE(code, expectedMessageRegex)
std::shared_ptr< Napi::ThreadSafeFunction > bytecode
#define DOM_SEP__PUBLIC_BYTECODE
#define AVM_PC_SIZE_IN_BITS
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
EventEmitter< BytecodeDecompositionEvent > decomposition_events
static constexpr size_t SR_OP1_BYTES_DECOMPOSITION
static constexpr size_t SR_OP3_BYTES_DECOMPOSITION
static constexpr size_t SR_OP6_BYTES_DECOMPOSITION
static constexpr size_t SR_OP4_BYTES_DECOMPOSITION
static constexpr size_t SR_ADDRESSING_MODE_BYTES_DECOMPOSITION
static constexpr size_t SR_INSTR_OUT_OF_RANGE_TOGGLE
static std::string get_subrelation_label(size_t index)
static constexpr size_t SR_OP7_BYTES_DECOMPOSITION
static constexpr size_t SR_OP5_BYTES_DECOMPOSITION
static constexpr size_t SR_PC_OUT_OF_RANGE_TOGGLE
static constexpr size_t SR_OP2_BYTES_DECOMPOSITION
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 process_wire_instruction_spec(TraceContainer &trace)
void process_memory_tag_range(TraceContainer &trace)
void process_sel_range_16(TraceContainer &trace)
void process_sel_range_8(TraceContainer &trace)
void process(const simulation::EventEmitterInterface< simulation::RangeCheckEvent >::Container &events, TraceContainer &trace)
Processes range check events and populates the trace with decomposed value columns.
const FF & get(Column col, uint32_t row) const
uint32_t get_num_rows() const
void set(Column col, uint32_t row, const FF &value)
Native Poseidon2 hash function implementation.
static FF hash(const std::vector< FF > &input)
Hashes a vector of field elements.
RangeCheckTraceBuilder range_check_builder
PrecomputedTraceBuilder precomputed_builder
void check_interaction(tracegen::TestTraceContainer &trace)
TEST(AvmFixedVKTests, FixedVKCommitments)
Test that the fixed VK commitments agree with the ones computed from precomputed columns.
void check_relation(const tracegen::TestTraceContainer &trace, Ts... subrelation)
InstrDeserializationEventError
std::vector< FF > encode_bytecode(std::span< const uint8_t > bytecode)
FF compute_public_bytecode_first_field(size_t bytecode_size)
Instruction random_instruction(WireOpCode w_opcode)
TestTraceContainer empty_trace()
lookup_settings< lookup_instr_fetching_wire_instruction_info_settings_ > lookup_instr_fetching_wire_instruction_info_settings
lookup_settings< lookup_instr_fetching_bytecode_size_from_bc_dec_settings_ > lookup_instr_fetching_bytecode_size_from_bc_dec_settings
lookup_settings< lookup_instr_fetching_bytes_from_bc_dec_settings_ > lookup_instr_fetching_bytes_from_bc_dec_settings
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
lookup_settings< lookup_instr_fetching_instr_abs_diff_positive_settings_ > lookup_instr_fetching_instr_abs_diff_positive_settings
lookup_settings< lookup_instr_fetching_pc_abs_diff_positive_settings_ > lookup_instr_fetching_pc_abs_diff_positive_settings
lookup_settings< lookup_instr_fetching_tag_value_validation_settings_ > lookup_instr_fetching_tag_value_validation_settings
Instruction
Enumeration of VM instructions that can be executed.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
unsigned __int128 uint128_t
static constexpr uint256_t modulus_minus_two