1#include <gmock/gmock.h>
2#include <gtest/gtest.h>
8#include "barretenberg/aztec/aztec_constants.hpp"
37using tracegen::BytecodeTraceBuilder;
38using tracegen::PrecomputedTraceBuilder;
39using tracegen::RangeCheckTraceBuilder;
40using tracegen::TestTraceContainer;
45using instr_fetching = instr_fetching<FF>;
47using simulation::BytecodeDecompositionEvent;
49using simulation::Instruction;
50using simulation::InstructionFetchingEvent;
52using simulation::RangeCheckEvent;
54TEST(InstrFetchingConstrainingTest, EmptyRow)
60TEST(InstrFetchingConstrainingTest, Add8WithTraceGen)
62 TestTraceContainer
trace;
69 .operands = { Operand::from<uint8_t>(0x34), Operand::from<uint8_t>(0x35), Operand::from<uint8_t>(0x36) },
72 std::vector<uint8_t>
bytecode = add_8_instruction.serialize();
74 builder.process_instruction_fetching({ { .bytecode_id = 1,
76 .instruction = add_8_instruction,
82 check_relation<instr_fetching>(trace);
87TEST(InstrFetchingConstrainingTest, EcaddWithTraceGen)
89 TestTraceContainer
trace;
95 .addressing_mode = 0x1f1f,
96 .operands = { Operand::from<uint16_t>(0x1279),
97 Operand::from<uint16_t>(0x127a),
98 Operand::from<uint16_t>(0x127b),
99 Operand::from<uint16_t>(0x127c),
100 Operand::from<uint16_t>(0x127d), },
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 = {
182 C::instr_fetching_addressing_mode,
183 C::instr_fetching_op1,
184 C::instr_fetching_op2,
185 C::instr_fetching_op3,
186 C::instr_fetching_op4,
187 C::instr_fetching_op5,
190 for (
const auto& opcode : opcodes) {
191 TestTraceContainer
trace;
193 builder.process_instruction_fetching(
194 { { .bytecode_id = 1,
196 .instruction = instr,
201 check_relation<instr_fetching>(trace);
205 for (
size_t i = 0; i < operand_cols.size(); i++) {
206 auto mutated_trace =
trace;
207 const FF mutated_operand =
trace.
get(operand_cols.at(i), 0) + 1;
208 mutated_trace.set(operand_cols.at(i), 0, mutated_operand);
218TEST(InstrFetchingConstrainingTest, WireInstructionSpecInteractions)
220 TestTraceContainer
trace;
221 BytecodeTraceBuilder bytecode_builder;
226 bytecode_builder.process_instruction_fetching(gen_instr_events_each_opcode(), trace);
231 check_interaction<BytecodeTraceBuilder, lookup_instr_fetching_wire_instruction_info_settings>(trace);
232 check_relation<instr_fetching>(trace);
238 range_check_events.reserve(instr_events.size());
240 for (
const auto& instr_event : instr_events) {
241 range_check_events.emplace_back(RangeCheckEvent{
243 (instr_event.error.has_value() && instr_event.error == InstrDeserializationEventError::PC_OUT_OF_RANGE)
244 ? instr_event.pc - instr_event.bytecode->size()
245 : instr_event.bytecode->size() - instr_event.pc - 1,
246 .num_bits = AVM_PC_SIZE_IN_BITS,
249 return range_check_events;
254TEST(InstrFetchingConstrainingTest, BcDecompositionInteractions)
256 TestTraceContainer
trace;
257 BytecodeTraceBuilder bytecode_builder;
260 const auto instr_fetch_events = gen_instr_events_each_opcode();
261 bytecode_builder.process_instruction_fetching(instr_fetch_events, trace);
262 bytecode_builder.process_decomposition({ {
263 .bytecode_id = instr_fetch_events.at(0).bytecode_id,
264 .
bytecode = instr_fetch_events.at(0).bytecode,
276 check_relation<instr_fetching>(trace);
283 TestTraceContainer
trace;
284 BytecodeTraceBuilder bytecode_builder;
292 bytecode_builder.process_instruction_fetching(instr_events, trace);
307 check_relation<instr_fetching>(trace);
313 TestTraceContainer
trace;
314 BytecodeTraceBuilder bytecode_builder;
320 bytecode_builder.process_instruction_fetching(instr_events, trace);
333 check_relation<instr_fetching>(trace);
339TEST(InstrFetchingConstrainingTest, MultipleBytecodes)
341 const auto instr_fetch_events = gen_instr_events_each_opcode();
342 constexpr size_t num_of_bytecodes = 5;
346 for (
size_t i = 0; i < num_of_bytecodes; i++) {
348 const auto num_of_instr = i * 6;
350 for (
size_t j = 0; j < num_of_instr; j++) {
351 const auto& instr = instr_fetch_events.at(j).instruction;
352 const auto instruction_bytes = instr.serialize();
360 for (
size_t j = 0; j < num_of_instr; j++) {
361 auto instr_event = instr_fetch_events.at(j);
362 instr_event.bytecode_id =
static_cast<BytecodeId>(i);
363 instr_event.bytecode = bytecode_ptr;
364 instr_events.emplace_back(instr_event);
379TEST(InstrFetchingConstrainingTest, SingleInstructionOutOfRange)
383 .addressing_mode = 3,
384 .operands = { Operand::from<uint8_t>(0x34), Operand::from<uint8_t>(0x35), Operand::from<uint8_t>(0x36) },
387 std::vector<uint8_t>
bytecode = add_8_instruction.serialize();
395 .bytecode = bytecode_ptr,
396 .error = InstrDeserializationEventError::INSTRUCTION_OUT_OF_RANGE,
403 .bytecode = bytecode_ptr,
414TEST(InstrFetchingConstrainingTest, SingleInstructionOutOfRangeSplitOperand)
418 .addressing_mode = 0x01,
419 .operands = { Operand::from<uint16_t>(0x1279),
424 std::vector<uint8_t>
bytecode = set_ff_instruction.serialize();
432 .bytecode = bytecode_ptr,
433 .error = InstrDeserializationEventError::INSTRUCTION_OUT_OF_RANGE,
440 .bytecode = bytecode_ptr,
448TEST(InstrFetchingConstrainingTest, SingleInstructionPcOutOfRange)
452 .addressing_mode = 3,
453 .operands = { Operand::from<uint8_t>(0x34), Operand::from<uint8_t>(0x35), Operand::from<uint8_t>(0x36) },
456 std::vector<uint8_t>
bytecode = add_8_instruction.serialize();
464 .instruction = add_8_instruction,
465 .bytecode = bytecode_ptr,
469 .pc =
static_cast<uint32_t
>(bytecode_ptr->size() + 1),
471 .error = InstrDeserializationEventError::PC_OUT_OF_RANGE,
478 .bytecode = bytecode_ptr,
488TEST(InstrFetchingConstrainingTest, SingleInstructionOpcodeOutOfRange)
492 .addressing_mode = 0,
493 .operands = { Operand::from<uint16_t>(0x1234),
495 Operand::from<uint128_t>(
static_cast<uint128_t>(0xFF) << 120) },
498 std::vector<uint8_t>
bytecode = set_128_instruction.serialize();
505 .instruction = set_128_instruction,
506 .bytecode = bytecode_ptr,
511 .bytecode = bytecode_ptr,
512 .error = InstrDeserializationEventError::OPCODE_OUT_OF_RANGE,
519 .bytecode = bytecode_ptr,
529TEST(InstrFetchingConstrainingTest, SingleInstructionTagOutOfRange)
533 .addressing_mode = 0,
534 .operands = { Operand::from<uint16_t>(0x1234), Operand::from<uint8_t>(12), Operand::from<uint16_t>(0x5678) },
537 std::vector<uint8_t>
bytecode = set_16_instruction.serialize();
544 .instruction = set_16_instruction,
545 .bytecode = bytecode_ptr,
546 .error = InstrDeserializationEventError::TAG_OUT_OF_RANGE,
553 .bytecode = bytecode_ptr,
561TEST(InstrFetchingConstrainingTest, NegativeWrongWireInstructionSpecInteractions)
563 BytecodeTraceBuilder bytecode_builder;
570 for (
const auto& opcode : opcodes) {
571 TestTraceContainer
trace;
573 bytecode_builder.process_instruction_fetching(
574 { { .bytecode_id = 1,
576 .instruction = instr,
583 check_interaction<BytecodeTraceBuilder, lookup_instr_fetching_wire_instruction_info_settings>(trace);
585 ASSERT_EQ(
trace.
get(C::lookup_instr_fetching_wire_instruction_info_counts,
static_cast<uint32_t
>(opcode)), 1);
588 C::instr_fetching_exec_opcode, C::instr_fetching_instr_size, C::instr_fetching_sel_has_tag,
589 C::instr_fetching_sel_tag_is_op2, C::instr_fetching_sel_op_dc_0, C::instr_fetching_sel_op_dc_1,
590 C::instr_fetching_sel_op_dc_2, C::instr_fetching_sel_op_dc_3, C::instr_fetching_sel_op_dc_4,
591 C::instr_fetching_sel_op_dc_5, C::instr_fetching_sel_op_dc_6, C::instr_fetching_sel_op_dc_7,
592 C::instr_fetching_sel_op_dc_8, C::instr_fetching_sel_op_dc_9, C::instr_fetching_sel_op_dc_10,
593 C::instr_fetching_sel_op_dc_11, C::instr_fetching_sel_op_dc_12, C::instr_fetching_sel_op_dc_13,
594 C::instr_fetching_sel_op_dc_14, C::instr_fetching_sel_op_dc_15
598 for (
const auto& col : mutated_cols) {
599 auto mutated_trace =
trace;
600 const FF mutated_value =
trace.
get(col, 0) + 1;
601 mutated_trace.set(col, 0, mutated_value);
604 (check_interaction<BytecodeTraceBuilder, lookup_instr_fetching_wire_instruction_info_settings>(
606 "Failed.*LOOKUP_INSTR_FETCHING_WIRE_INSTRUCTION_INFO.*Could not find tuple in destination.");
612TEST(InstrFetchingConstrainingTest, NegativeWrongBcDecompositionInteractions)
614 TestTraceContainer
trace;
615 BytecodeTraceBuilder bytecode_builder;
621 for (
const auto& opcode : opcodes) {
622 TestTraceContainer
trace;
625 bytecode_builder.process_instruction_fetching({ {
628 .instruction = instr,
629 .bytecode = bytecode_ptr,
632 bytecode_builder.process_decomposition({ {
634 .bytecode = bytecode_ptr,
638 auto valid_trace =
trace;
639 check_interaction<BytecodeTraceBuilder, lookup_instr_fetching_bytes_from_bc_dec_settings>(valid_trace);
642 C::instr_fetching_pc, C::instr_fetching_bytecode_id, C::instr_fetching_bd0, C::instr_fetching_bd1,
643 C::instr_fetching_bd2, C::instr_fetching_bd3, C::instr_fetching_bd4, C::instr_fetching_bd5,
644 C::instr_fetching_bd6, C::instr_fetching_bd7, C::instr_fetching_bd8, C::instr_fetching_bd9,
645 C::instr_fetching_bd10, C::instr_fetching_bd11, C::instr_fetching_bd12, C::instr_fetching_bd13,
646 C::instr_fetching_bd14, C::instr_fetching_bd15, C::instr_fetching_bd16, C::instr_fetching_bd17,
647 C::instr_fetching_bd18, C::instr_fetching_bd19, C::instr_fetching_bd20, C::instr_fetching_bd21,
648 C::instr_fetching_bd22, C::instr_fetching_bd23, C::instr_fetching_bd24, C::instr_fetching_bd25,
649 C::instr_fetching_bd26, C::instr_fetching_bd27, C::instr_fetching_bd28, C::instr_fetching_bd29,
650 C::instr_fetching_bd30, C::instr_fetching_bd31, C::instr_fetching_bd32, C::instr_fetching_bd33,
651 C::instr_fetching_bd34, C::instr_fetching_bd35, C::instr_fetching_bd36,
655 for (
const auto& col : mutated_cols) {
656 auto mutated_trace =
trace;
657 const FF mutated_value =
trace.
get(col, 0) + 1;
658 mutated_trace.set(col, 0, mutated_value);
661 (check_interaction<BytecodeTraceBuilder, lookup_instr_fetching_bytes_from_bc_dec_settings>(
663 "Failed.*BYTES_FROM_BC_DEC. Could not find tuple in destination.");
670TEST(InstrFetchingConstrainingTest, NegativeWrongBytecodeSizeBcDecompositionInteractions)
672 TestTraceContainer
trace;
673 BytecodeTraceBuilder bytecode_builder;
676 const uint32_t pc = 15;
677 std::vector<uint8_t>
bytecode(pc, 0x23);
683 for (
const auto& opcode : opcodes) {
684 TestTraceContainer
trace;
687 const auto instr_bytecode = instr.serialize();
693 bytecode_builder.process_instruction_fetching({ {
696 .instruction = instr,
697 .bytecode = bytecode_ptr,
700 bytecode_builder.process_decomposition({ {
702 .bytecode = bytecode_ptr,
707 auto valid_trace =
trace;
708 check_interaction<BytecodeTraceBuilder, lookup_instr_fetching_bytecode_size_from_bc_dec_settings>(valid_trace);
710 auto mutated_trace =
trace;
711 const FF mutated_value =
trace.
get(C::instr_fetching_bytecode_size, 0) + 1;
712 mutated_trace.set(C::instr_fetching_bytecode_size, 0, mutated_value);
715 (check_interaction<BytecodeTraceBuilder, lookup_instr_fetching_bytecode_size_from_bc_dec_settings>(
717 "Failed.*BYTECODE_SIZE_FROM_BC_DEC. Could not find tuple in destination.");
721using ::bb::avm2::testing::InstructionBuilder;
722using simulation::EventEmitter;
723using simulation::MockExecutionIdManager;
724using simulation::MockGreaterThan;
725using simulation::Poseidon2;
726using simulation::Poseidon2HashEvent;
727using simulation::Poseidon2PermutationEvent;
728using simulation::Poseidon2PermutationMemoryEvent;
729using ::testing::StrictMock;
730using tracegen::Poseidon2TraceBuilder;
732TEST(InstrFetchingConstrainingTest, NegativeTruncatedBytecodeRepro)
734 TestTraceContainer
trace;
735 BytecodeTraceBuilder bytecode_builder;
741 StrictMock<MockGreaterThan>
mock_gt;
750 const uint32_t pc = 15;
751 std::vector<uint8_t>
bytecode(pc, 0x23);
752 const auto add_instr =
753 InstructionBuilder(
WireOpCode::SUB_8).operand<uint8_t>(5).operand<uint8_t>(5).operand<uint8_t>(0).build();
754 const auto instr_bytecode = add_instr.serialize();
760 prepended_fields.insert(prepended_fields.end(), fields.begin(), fields.end());
764 std::vector<uint8_t> trunc_bytecode(pc, 0x23);
765 trunc_bytecode.insert(trunc_bytecode.end(),
768 trunc_bytecode.resize(trunc_bytecode.size() - 1);
770 std::vector<FF> trunc_prepended_fields = { DOM_SEP__PUBLIC_BYTECODE };
771 trunc_prepended_fields.insert(trunc_prepended_fields.end(), trunc_fields.begin(), trunc_fields.end());
778 ASSERT_NE(hash, trunc_hash);
783 InstructionFetchingEvent instr_event = {
786 .instruction = add_instr,
787 .bytecode = bytecode_ptr,
789 bytecode_builder.process_instruction_fetching({ instr_event },
trace);
790 bytecode_builder.process_hashing({ {
792 .bytecode_length_in_bytes =
static_cast<uint32_t
>(trunc_bytecode.size()),
793 .bytecode_fields = trunc_fields,
797 bytecode_builder.process_decomposition({ {
799 .bytecode = trunc_bytecode_ptr,
813 perm_builder(C::bc_decomposition_sel_packed);
814 perm_builder.process(trace);
816 check_relation<bb::avm2::bc_hashing<FF>>(
trace);
818 (check_interaction<BytecodeTraceBuilder, lookup_bc_hashing_poseidon2_hash_settings>(trace)),
819 "Failed.*LOOKUP_BC_HASHING_POSEIDON2_HASH. Could not find tuple in destination.");
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, 0), 0);
852 mutated_trace.set(C::instr_fetching_tag_out_of_range, 0, 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, NegativeTagOutOfRangeNoTag)
864 TestTraceContainer
trace;
865 BytecodeTraceBuilder bytecode_builder;
872 bytecode_builder.process_instruction_fetching(
873 { { .bytecode_id = 1,
875 .instruction = instr,
882 check_interaction<BytecodeTraceBuilder, lookup_instr_fetching_tag_value_validation_settings>(trace);
885 ASSERT_EQ(
trace.
get(C::instr_fetching_tag_out_of_range, 1), 0);
886 ASSERT_EQ(
trace.
get(C::instr_fetching_sel_has_tag, 1), 0);
887 trace.
set(C::instr_fetching_tag_out_of_range, 1, 1);
894TEST(InstrFetchingConstrainingTest, NegativeNotTogglingInstrOutOfRange)
896 TestTraceContainer
trace({
898 { C::instr_fetching_bytes_to_read, 11 },
899 { C::instr_fetching_instr_abs_diff, 0 },
900 { C::instr_fetching_instr_out_of_range, 1 },
901 { C::instr_fetching_instr_size, 12 },
902 { C::instr_fetching_sel, 1 },
908 trace.
set(C::instr_fetching_instr_out_of_range, 0, 0);
915TEST(InstrFetchingConstrainingTest, NegativeTogglingInstrInRange)
917 TestTraceContainer
trace({
919 { C::instr_fetching_bytes_to_read, 12 },
920 { C::instr_fetching_instr_abs_diff, 0 },
921 { C::instr_fetching_instr_out_of_range, 0 },
922 { C::instr_fetching_instr_size, 12 },
923 { C::instr_fetching_sel, 1 },
929 trace.
set(C::instr_fetching_instr_out_of_range, 0, 1);
936TEST(InstrFetchingConstrainingTest, NegativeNotTogglingPcOutOfRange)
938 TestTraceContainer
trace({
940 { C::instr_fetching_bytecode_size, 12 },
941 { C::instr_fetching_pc, 12 },
942 { C::instr_fetching_pc_abs_diff, 0 },
943 { C::instr_fetching_pc_out_of_range, 1 },
944 { C::instr_fetching_sel, 1 },
950 trace.
set(C::instr_fetching_pc_out_of_range, 0, 0);
957TEST(InstrFetchingConstrainingTest, NegativeTagSelPcOutOfRange)
959 TestTraceContainer
trace({
960 { { C::precomputed_first_row, 1 } },
962 { C::instr_fetching_bytecode_size, 12 },
963 { C::instr_fetching_pc, 12 },
964 { C::instr_fetching_pc_abs_diff, 0 },
965 { C::instr_fetching_pc_out_of_range, 1 },
966 { C::instr_fetching_sel_pc_in_range, 0 },
967 { C::instr_fetching_sel_has_tag, 0 },
968 { C::instr_fetching_sel, 1 },
974 trace.
set(C::instr_fetching_sel_has_tag, 1, 1);
981TEST(InstrFetchingConstrainingTest, NegativeTogglingPcInRange)
983 TestTraceContainer
trace({
985 { C::instr_fetching_bytecode_size, 12 },
986 { C::instr_fetching_pc, 11 },
987 { C::instr_fetching_pc_abs_diff, 0 },
988 { C::instr_fetching_pc_out_of_range, 0 },
989 { C::instr_fetching_sel, 1 },
995 trace.
set(C::instr_fetching_pc_out_of_range, 0, 1);
1001TEST(InstrFetchingConstrainingTest, ErrorFlagSetButSelParsingErrIsZero)
1006 TestTraceContainer
trace({
1008 { C::instr_fetching_sel, 1 },
1010 { C::instr_fetching_pc_out_of_range, 1 },
1011 { C::instr_fetching_opcode_out_of_range, 0 },
1012 { C::instr_fetching_instr_out_of_range, 0 },
1013 { C::instr_fetching_tag_out_of_range, 0 },
1015 { C::instr_fetching_sel_parsing_err, 0 },
1019 { C::instr_fetching_bytecode_size, 10 },
1020 { C::instr_fetching_pc, 15 },
1021 { C::instr_fetching_pc_abs_diff, 5 },
1022 { C::instr_fetching_pc_size_in_bits, 32 },
1027 { C::instr_fetching_bytes_to_read, 10 },
1028 { C::instr_fetching_instr_size, 5 },
1029 { C::instr_fetching_instr_abs_diff, 5 },
1034 "Relation instr_fetching, subrelation .* failed at row 0");
1041TEST(InstrFetchingConstrainingTest, CorrectBehaviorSelParsingErrMatchesErrors)
1043 TestTraceContainer
trace({
1045 { C::instr_fetching_sel, 1 },
1046 { C::instr_fetching_pc_out_of_range, 1 },
1047 { C::instr_fetching_opcode_out_of_range, 0 },
1048 { C::instr_fetching_instr_out_of_range, 0 },
1049 { C::instr_fetching_tag_out_of_range, 0 },
1050 { C::instr_fetching_sel_parsing_err, 1 },
1052 { C::instr_fetching_bytecode_size, 10 },
1053 { C::instr_fetching_pc, 15 },
1054 { C::instr_fetching_pc_abs_diff, 5 },
1055 { C::instr_fetching_pc_size_in_bits, 32 },
1056 { C::instr_fetching_bytes_to_read, 10 },
1057 { C::instr_fetching_instr_size, 5 },
1058 { C::instr_fetching_instr_abs_diff, 5 },
1063 check_relation<instr_fetching>(trace);
1069TEST(InstrFetchingConstrainingTest, CorrectBehaviorNoErrorsMeansSelParsingErrIsZero)
1071 TestTraceContainer
trace({
1073 { C::instr_fetching_sel, 1 },
1074 { C::instr_fetching_pc_out_of_range, 0 },
1075 { C::instr_fetching_opcode_out_of_range, 0 },
1076 { C::instr_fetching_instr_out_of_range, 0 },
1077 { C::instr_fetching_tag_out_of_range, 0 },
1078 { C::instr_fetching_sel_parsing_err, 0 },
1079 { C::instr_fetching_sel_pc_in_range, 1 },
1083 { C::instr_fetching_bytecode_size, 20 },
1084 { C::instr_fetching_pc, 5 },
1085 { C::instr_fetching_pc_abs_diff, 14 },
1086 { C::instr_fetching_pc_size_in_bits, 32 },
1088 { C::instr_fetching_bytes_to_read, 15 },
1089 { C::instr_fetching_instr_size, 10 },
1090 { C::instr_fetching_instr_abs_diff, 5 },
1095 check_relation<instr_fetching>(trace);
#define EXPECT_THROW_WITH_MESSAGE(code, expectedMessageRegex)
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_OP4_BYTES_DECOMPOSITION
static constexpr size_t SR_TAG_OUT_OF_RANGE_ZERO
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_OP5_BYTES_DECOMPOSITION
static constexpr size_t SR_PC_OUT_OF_RANGE_TOGGLE
static constexpr size_t SR_OP2_BYTES_DECOMPOSITION
static constexpr size_t SR_SEL_HAS_TAG_ZERO
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)
Populate miscellaneous precomputed columns: first_row selector and idx (row index).
void process_wire_instruction_spec(TraceContainer &trace)
Populate the wire-level instruction specification table.
void process_memory_tag_range(TraceContainer &trace)
Populate the memory tag out-of-range selector.
void process_sel_range_16(TraceContainer &trace)
Generate a selector column that activates the first 2^16 (65536) rows.
void process_sel_range_8(TraceContainer &trace)
Generate a selector column that activates the first 2^8 (256) rows.
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, bool use_atomic_limbs=false)
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
std::vector< uint8_t > bytecode
void check_interaction(tracegen::TestTraceContainer &trace)
TEST(AvmFixedVKTests, FixedVKCommitments)
Test that the fixed VK commitments agree with the ones computed from precomputed columns.
InstrDeserializationEventError
std::vector< FF > encode_bytecode(std::span< const uint8_t > bytecode)
Encodes the bytecode into a vector of field elements. Each field element represents 31 bytes of the b...
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