106 size_t num_operations = (Size) /
sizeof(
FuzzerTuple);
107 if (num_operations == 0) {
112 std::vector<uint8_t> all_fieldvm_data(total_fieldvm_data_size);
113 for (
size_t i = 0; i < num_operations; ++i) {
119 std::vector<Fr> precomputed_scalars;
132 field_vm.
run(all_fieldvm_data.data(), total_fieldvm_data_size);
135 for (
size_t i = 0; i < 32; ++i) {
137 precomputed_scalars.push_back(scalar);
145 for (
size_t i = 0; i < 4; ++i) {
148 for (
size_t j = 0; j < 4; ++j) {
149 Fr scalar = precomputed_scalars[i * 4 + j];
150 combined_point = combined_point + (base_generators[j] * scalar);
152 points.push_back(combined_point);
162 for (
size_t i = 0; i < num_operations; ++i) {
169 size_t generator_index = (op.generator_index & 0x7F) % points.size();
170 bool should_negate = (op.generator_index & 0x80) != 0;
172 typename G1::element point_to_add = points[generator_index];
174 point_to_add = -point_to_add;
177 bool is_infinity = point_to_add.is_point_at_infinity();
178 operation_details.emplace_back(i, op_type, generator_index,
Fr(0), is_infinity, should_negate);
179 op_queue->add_accumulate(point_to_add);
184 size_t generator_index = (op.generator_index & 0x7F) % points.size();
185 bool should_negate = (op.generator_index & 0x80) != 0;
188 Fr scalar = precomputed_scalars[op.scalar_index % precomputed_scalars.size()];
190 typename G1::element point_to_multiply = points[generator_index];
192 point_to_multiply = -point_to_multiply;
195 bool is_infinity = point_to_multiply.is_point_at_infinity();
196 operation_details.emplace_back(i, op_type, generator_index, scalar, is_infinity, should_negate);
197 op_queue->mul_accumulate(point_to_multiply, scalar);
201 operation_details.emplace_back(i, op_type, 0,
Fr(0),
false,
false);
202 op_queue->eq_and_reset();
206 operation_details.emplace_back(i, op_type, 0,
Fr(0),
false,
false);
208 op_queue->eq_and_reset();
213 operation_details.emplace_back(i, op_type, 0,
Fr(0),
false,
false);
214 op_queue->empty_row_for_testing();
218 operation_details.emplace_back(i, op_type, 0,
Fr(0),
false,
false);
225 op_queue->eq_and_reset();
227 operation_details.emplace_back(num_operations + 1,
OpType::MERGE, 0,
Fr(0),
false,
false);
242 for (
size_t i = 0; i < num_operations; ++i) {
247 for (
size_t i = 0; i < num_operations; ++i) {
254 for (
const auto& op : operation_details) {
256 op.op_index, op.op_type, op.generator_index, op.scalar, op.is_infinity, op.should_negate);
260 assert(result ==
true);