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()];
197 if (converted_u256.
get_msb() <= 128) {
198 k1_u256 = converted_u256;
211 typename G1::element point_to_multiply = points[generator_index];
213 point_to_multiply = -point_to_multiply;
216 bool is_infinity = point_to_multiply.is_point_at_infinity();
217 operation_details.emplace_back(i, op_type, generator_index, scalar, is_infinity, should_negate);
218 op_queue->mul_accumulate(point_to_multiply, scalar);
222 operation_details.emplace_back(i, op_type, 0,
Fr(0),
false,
false);
223 op_queue->eq_and_reset();
227 operation_details.emplace_back(i, op_type, 0,
Fr(0),
false,
false);
229 op_queue->eq_and_reset();
234 operation_details.emplace_back(i, op_type, 0,
Fr(0),
false,
false);
235 op_queue->empty_row_for_testing();
239 operation_details.emplace_back(i, op_type, 0,
Fr(0),
false,
false);
246 op_queue->eq_and_reset();
248 operation_details.emplace_back(num_operations + 1,
OpType::MERGE, 0,
Fr(0),
false,
false);
263 for (
size_t i = 0; i < num_operations; ++i) {
268 for (
size_t i = 0; i < num_operations; ++i) {
275 for (
const auto& op : operation_details) {
277 op.op_index, op.op_type, op.generator_index, op.scalar, op.is_infinity, op.should_negate);
281 assert(result ==
true);