ark-r1cs-std/tests/arithmetic_tests.rs
tests/arithmetic_tests.rsRaw
1use ark_bls12_381::Bls12_381;
2use ark_ec::PairingEngine;
3use ark_ff::{BigInteger, PrimeField};
4use ark_mnt4_298::MNT4_298;
5use ark_mnt4_753::MNT4_753;
6use ark_mnt6_298::MNT6_298;
7use ark_mnt6_753::MNT6_753;
8
9use ark_r1cs_std::fields::nonnative::{AllocatedNonNativeFieldVar, NonNativeFieldVar};
10use ark_r1cs_std::{alloc::AllocVar, eq::EqGadget, fields::FieldVar, R1CSVar};
11use ark_relations::r1cs::{ConstraintSystem, ConstraintSystemRef};
12use ark_std::rand::RngCore;
13
14#[cfg(not(ci))]
15const NUM_REPETITIONS: usize = 100;
16#[cfg(ci)]
17const NUM_REPETITIONS: usize = 1;
18
19#[cfg(not(ci))]
20const TEST_COUNT: usize = 100;
21#[cfg(ci)]
22const TEST_COUNT: usize = 1;
23
24fn allocation_test<TargetField: PrimeField, BaseField: PrimeField, R: RngCore>(
25 cs: ConstraintSystemRef<BaseField>,
26 rng: &mut R,
27) {
28 let a_native = TargetField::rand(rng);
29 let a = NonNativeFieldVar::<TargetField, BaseField>::new_witness(
30 ark_relations::ns!(cs, "alloc a"),
31 || Ok(a_native),
32 )
33 .unwrap();
34
35 let a_actual = a.value().unwrap();
36 let a_expected = a_native;
37 assert!(
38 a_actual.eq(&a_expected),
39 "allocated value does not equal the expected value"
40 );
41
42 let (_a, a_bits) =
43 AllocatedNonNativeFieldVar::<TargetField, BaseField>::new_witness_with_le_bits(
44 ark_relations::ns!(cs, "alloc a2"),
45 || Ok(a_native),
46 )
47 .unwrap();
48
49 let a_bits_actual: Vec<bool> = a_bits.into_iter().map(|b| b.value().unwrap()).collect();
50 let mut a_bits_expected = a_native.into_bigint().to_bits_le();
51 a_bits_expected.truncate(TargetField::MODULUS_BIT_SIZE as usize);
52 assert_eq!(
53 a_bits_actual, a_bits_expected,
54 "allocated bits does not equal the expected bits"
55 );
56}
57
58fn addition_test<TargetField: PrimeField, BaseField: PrimeField, R: RngCore>(
59 cs: ConstraintSystemRef<BaseField>,
60 rng: &mut R,
61) {
62 let a_native = TargetField::rand(rng);
63 let a = NonNativeFieldVar::<TargetField, BaseField>::new_witness(
64 ark_relations::ns!(cs, "alloc a"),
65 || Ok(a_native),
66 )
67 .unwrap();
68
69 let b_native = TargetField::rand(rng);
70 let b = NonNativeFieldVar::<TargetField, BaseField>::new_witness(
71 ark_relations::ns!(cs, "alloc b"),
72 || Ok(b_native),
73 )
74 .unwrap();
75
76 let a_plus_b = a + &b;
77
78 let a_plus_b_actual = a_plus_b.value().unwrap();
79 let a_plus_b_expected = a_native + &b_native;
80 assert!(a_plus_b_actual.eq(&a_plus_b_expected), "a + b failed");
81}
82
83fn multiplication_test<TargetField: PrimeField, BaseField: PrimeField, R: RngCore>(
84 cs: ConstraintSystemRef<BaseField>,
85 rng: &mut R,
86) {
87 let a_native = TargetField::rand(rng);
88 let a = NonNativeFieldVar::<TargetField, BaseField>::new_witness(
89 ark_relations::ns!(cs, "alloc a"),
90 || Ok(a_native),
91 )
92 .unwrap();
93
94 let b_native = TargetField::rand(rng);
95 let b = NonNativeFieldVar::<TargetField, BaseField>::new_witness(
96 ark_relations::ns!(cs, "alloc b"),
97 || Ok(b_native),
98 )
99 .unwrap();
100
101 let a_times_b = a * &b;
102
103 let a_times_b_actual = a_times_b.value().unwrap();
104 let a_times_b_expected = a_native * &b_native;
105
106 assert!(
107 a_times_b_actual.eq(&a_times_b_expected),
108 "a_times_b = {:?}, a_times_b_actual = {:?}, a_times_b_expected = {:?}",
109 a_times_b,
110 a_times_b_actual.into_bigint().as_ref(),
111 a_times_b_expected.into_bigint().as_ref()
112 );
113}
114
115fn equality_test<TargetField: PrimeField, BaseField: PrimeField, R: RngCore>(
116 cs: ConstraintSystemRef<BaseField>,
117 rng: &mut R,
118) {
119 let a_native = TargetField::rand(rng);
120 let a = NonNativeFieldVar::<TargetField, BaseField>::new_witness(
121 ark_relations::ns!(cs, "alloc a"),
122 || Ok(a_native),
123 )
124 .unwrap();
125
126 let b_native = TargetField::rand(rng);
127 let b = NonNativeFieldVar::<TargetField, BaseField>::new_witness(
128 ark_relations::ns!(cs, "alloc b"),
129 || Ok(b_native),
130 )
131 .unwrap();
132
133 let a_times_b = a * &b;
134
135 let a_times_b_expected = a_native * &b_native;
136 let a_times_b_expected_gadget = NonNativeFieldVar::<TargetField, BaseField>::new_witness(
137 ark_relations::ns!(cs, "alloc a * b"),
138 || Ok(a_times_b_expected),
139 )
140 .unwrap();
141
142 a_times_b.enforce_equal(&a_times_b_expected_gadget).unwrap();
143}
144
145fn edge_cases_test<TargetField: PrimeField, BaseField: PrimeField, R: RngCore>(
146 cs: ConstraintSystemRef<BaseField>,
147 rng: &mut R,
148) {
149 let zero_native = TargetField::zero();
150 let zero = NonNativeFieldVar::<TargetField, BaseField>::zero();
151 let one = NonNativeFieldVar::<TargetField, BaseField>::one();
152
153 let a_native = TargetField::rand(rng);
154 let minus_a_native = TargetField::zero() - &a_native;
155 let a = NonNativeFieldVar::<TargetField, BaseField>::new_witness(
156 ark_relations::ns!(cs, "alloc a"),
157 || Ok(a_native),
158 )
159 .unwrap();
160
161 let a_plus_zero = &a + &zero;
162 let a_minus_zero = &a - &zero;
163 let zero_minus_a = &zero - &a;
164 let a_times_zero = &a * &zero;
165
166 let zero_plus_a = &zero + &a;
167 let zero_times_a = &zero * &a;
168
169 let a_times_one = &a * &one;
170 let one_times_a = &one * &a;
171
172 let a_plus_zero_native = a_plus_zero.value().unwrap();
173 let a_minus_zero_native = a_minus_zero.value().unwrap();
174 let zero_minus_a_native = zero_minus_a.value().unwrap();
175 let a_times_zero_native = a_times_zero.value().unwrap();
176 let zero_plus_a_native = zero_plus_a.value().unwrap();
177 let zero_times_a_native = zero_times_a.value().unwrap();
178 let a_times_one_native = a_times_one.value().unwrap();
179 let one_times_a_native = one_times_a.value().unwrap();
180
181 assert!(
182 a_plus_zero_native.eq(&a_native),
183 "a_plus_zero = {:?}, a = {:?}",
184 a_plus_zero_native.into_bigint().as_ref(),
185 a_native.into_bigint().as_ref()
186 );
187 assert!(
188 a_minus_zero_native.eq(&a_native),
189 "a_minus_zero = {:?}, a = {:?}",
190 a_minus_zero_native.into_bigint().as_ref(),
191 a_native.into_bigint().as_ref()
192 );
193 assert!(
194 zero_minus_a_native.eq(&minus_a_native),
195 "zero_minus_a = {:?}, minus_a = {:?}",
196 zero_minus_a_native.into_bigint().as_ref(),
197 minus_a_native.into_bigint().as_ref()
198 );
199 assert!(
200 a_times_zero_native.eq(&zero_native),
201 "a_times_zero = {:?}, zero = {:?}",
202 a_times_zero_native.into_bigint().as_ref(),
203 zero_native.into_bigint().as_ref()
204 );
205 assert!(
206 zero_plus_a_native.eq(&a_native),
207 "zero_plus_a = {:?}, a = {:?}",
208 zero_plus_a_native.into_bigint().as_ref(),
209 a_native.into_bigint().as_ref()
210 );
211 assert!(
212 zero_times_a_native.eq(&zero_native),
213 "zero_times_a = {:?}, zero = {:?}",
214 zero_times_a_native.into_bigint().as_ref(),
215 zero_native.into_bigint().as_ref()
216 );
217 assert!(
218 a_times_one_native.eq(&a_native),
219 "a_times_one = {:?}, a = {:?}",
220 a_times_one_native.into_bigint().as_ref(),
221 a_native.into_bigint().as_ref()
222 );
223 assert!(
224 one_times_a_native.eq(&a_native),
225 "one_times_a = {:?}, a = {:?}",
226 one_times_a_native.into_bigint().as_ref(),
227 a_native.into_bigint().as_ref()
228 );
229}
230
231fn distribution_law_test<TargetField: PrimeField, BaseField: PrimeField, R: RngCore>(
232 cs: ConstraintSystemRef<BaseField>,
233 rng: &mut R,
234) {
235 let a_native = TargetField::rand(rng);
236 let b_native = TargetField::rand(rng);
237 let c_native = TargetField::rand(rng);
238
239 let a_plus_b_native = a_native.clone() + &b_native;
240 let a_times_c_native = a_native.clone() * &c_native;
241 let b_times_c_native = b_native.clone() * &c_native;
242 let a_plus_b_times_c_native = a_plus_b_native.clone() * &c_native;
243 let a_times_c_plus_b_times_c_native = a_times_c_native + &b_times_c_native;
244
245 assert!(
246 a_plus_b_times_c_native.eq(&a_times_c_plus_b_times_c_native),
247 "(a + b) * c doesn't equal (a * c) + (b * c)"
248 );
249
250 let a = NonNativeFieldVar::<TargetField, BaseField>::new_witness(
251 ark_relations::ns!(cs, "a"),
252 || Ok(a_native),
253 )
254 .unwrap();
255 let b = NonNativeFieldVar::<TargetField, BaseField>::new_witness(
256 ark_relations::ns!(cs, "b"),
257 || Ok(b_native),
258 )
259 .unwrap();
260 let c = NonNativeFieldVar::<TargetField, BaseField>::new_witness(
261 ark_relations::ns!(cs, "c"),
262 || Ok(c_native),
263 )
264 .unwrap();
265
266 let a_plus_b = &a + &b;
267 let a_times_c = &a * &c;
268 let b_times_c = &b * &c;
269 let a_plus_b_times_c = &a_plus_b * &c;
270 let a_times_c_plus_b_times_c = &a_times_c + &b_times_c;
271
272 assert!(
273 a_plus_b.value().unwrap().eq(&a_plus_b_native),
274 "a + b doesn't match"
275 );
276 assert!(
277 a_times_c.value().unwrap().eq(&a_times_c_native),
278 "a * c doesn't match"
279 );
280 assert!(
281 b_times_c.value().unwrap().eq(&b_times_c_native),
282 "b * c doesn't match"
283 );
284 assert!(
285 a_plus_b_times_c
286 .value()
287 .unwrap()
288 .eq(&a_plus_b_times_c_native),
289 "(a + b) * c doesn't match"
290 );
291 assert!(
292 a_times_c_plus_b_times_c
293 .value()
294 .unwrap()
295 .eq(&a_times_c_plus_b_times_c_native),
296 "(a * c) + (b * c) doesn't match"
297 );
298 assert!(
299 a_plus_b_times_c_native.eq(&a_times_c_plus_b_times_c_native),
300 "(a + b) * c != (a * c) + (b * c)"
301 );
302}
303
304fn randomized_arithmetic_test<TargetField: PrimeField, BaseField: PrimeField, R: RngCore>(
305 cs: ConstraintSystemRef<BaseField>,
306 rng: &mut R,
307) {
308 let mut operations: Vec<u32> = Vec::new();
309 for _ in 0..TEST_COUNT {
310 operations.push(rng.next_u32() % 3);
311 }
312
313 let mut num_native = TargetField::rand(rng);
314 let mut num = NonNativeFieldVar::<TargetField, BaseField>::new_witness(
315 ark_relations::ns!(cs, "initial num"),
316 || Ok(num_native),
317 )
318 .unwrap();
319 for op in operations.iter() {
320 let next_native = TargetField::rand(rng);
321 let next = NonNativeFieldVar::<TargetField, BaseField>::new_witness(
322 ark_relations::ns!(cs, "next num for repetition"),
323 || Ok(next_native),
324 )
325 .unwrap();
326 match op {
327 0 => {
328 num_native += &next_native;
329 num += &next;
330 },
331 1 => {
332 num_native *= &next_native;
333 num *= &next;
334 },
335 2 => {
336 num_native -= &next_native;
337 num -= &next;
338 },
339 _ => (),
340 };
341
342 assert!(
343 num.value().unwrap().eq(&num_native),
344 "randomized arithmetic failed:"
345 );
346 }
347}
348
349fn addition_stress_test<TargetField: PrimeField, BaseField: PrimeField, R: RngCore>(
350 cs: ConstraintSystemRef<BaseField>,
351 rng: &mut R,
352) {
353 let mut num_native = TargetField::rand(rng);
354 let mut num =
355 NonNativeFieldVar::new_witness(ark_relations::ns!(cs, "initial num"), || Ok(num_native))
356 .unwrap();
357 for _ in 0..TEST_COUNT {
358 let next_native = TargetField::rand(rng);
359 let next = NonNativeFieldVar::<TargetField, BaseField>::new_witness(
360 ark_relations::ns!(cs, "next num for repetition"),
361 || Ok(next_native),
362 )
363 .unwrap();
364 num_native += &next_native;
365 num += &next;
366
367 assert!(num.value().unwrap().eq(&num_native));
368 }
369}
370
371fn multiplication_stress_test<TargetField: PrimeField, BaseField: PrimeField, R: RngCore>(
372 cs: ConstraintSystemRef<BaseField>,
373 rng: &mut R,
374) {
375 let mut num_native = TargetField::rand(rng);
376 let mut num = NonNativeFieldVar::<TargetField, BaseField>::new_witness(
377 ark_relations::ns!(cs, "initial num"),
378 || Ok(num_native),
379 )
380 .unwrap();
381 for _ in 0..TEST_COUNT {
382 let next_native = TargetField::rand(rng);
383 let next = NonNativeFieldVar::<TargetField, BaseField>::new_witness(
384 ark_relations::ns!(cs, "next num for repetition"),
385 || Ok(next_native),
386 )
387 .unwrap();
388 num_native *= &next_native;
389 num *= &next;
390
391 assert!(num.value().unwrap().eq(&num_native));
392 }
393}
394
395fn mul_and_add_stress_test<TargetField: PrimeField, BaseField: PrimeField, R: RngCore>(
396 cs: ConstraintSystemRef<BaseField>,
397 rng: &mut R,
398) {
399 let mut num_native = TargetField::rand(rng);
400 let mut num = NonNativeFieldVar::<TargetField, BaseField>::new_witness(
401 ark_relations::ns!(cs, "initial num"),
402 || Ok(num_native),
403 )
404 .unwrap();
405 for _ in 0..TEST_COUNT {
406 let next_add_native = TargetField::rand(rng);
407 let next_add = NonNativeFieldVar::<TargetField, BaseField>::new_witness(
408 ark_relations::ns!(cs, "next to add num for repetition"),
409 || Ok(next_add_native),
410 )
411 .unwrap();
412 let next_mul_native = TargetField::rand(rng);
413 let next_mul = NonNativeFieldVar::<TargetField, BaseField>::new_witness(
414 ark_relations::ns!(cs, "next to mul num for repetition"),
415 || Ok(next_mul_native),
416 )
417 .unwrap();
418
419 num_native = num_native * &next_mul_native + &next_add_native;
420 num = num * &next_mul + &next_add;
421
422 assert!(num.value().unwrap().eq(&num_native));
423 }
424}
425
426fn square_mul_add_stress_test<TargetField: PrimeField, BaseField: PrimeField, R: RngCore>(
427 cs: ConstraintSystemRef<BaseField>,
428 rng: &mut R,
429) {
430 let mut num_native = TargetField::rand(rng);
431 let mut num = NonNativeFieldVar::<TargetField, BaseField>::new_witness(
432 ark_relations::ns!(cs, "initial num"),
433 || Ok(num_native),
434 )
435 .unwrap();
436 for _ in 0..TEST_COUNT {
437 let next_add_native = TargetField::rand(rng);
438 let next_add = NonNativeFieldVar::<TargetField, BaseField>::new_witness(
439 ark_relations::ns!(cs, "next to add num for repetition"),
440 || Ok(next_add_native),
441 )
442 .unwrap();
443 let next_mul_native = TargetField::rand(rng);
444 let next_mul = NonNativeFieldVar::<TargetField, BaseField>::new_witness(
445 ark_relations::ns!(cs, "next to mul num for repetition"),
446 || Ok(next_mul_native),
447 )
448 .unwrap();
449
450 num_native = num_native * &num_native * &next_mul_native + &next_add_native;
451 num = &num * &num * &next_mul + &next_add;
452
453 assert!(num.value().unwrap().eq(&num_native));
454 }
455}
456
457fn double_stress_test_1<TargetField: PrimeField, BaseField: PrimeField, R: RngCore>(
458 cs: ConstraintSystemRef<BaseField>,
459 rng: &mut R,
460) {
461 let mut num_native = TargetField::rand(rng);
462 let mut num = NonNativeFieldVar::<TargetField, BaseField>::new_witness(
463 ark_relations::ns!(cs, "initial num"),
464 || Ok(num_native),
465 )
466 .unwrap();
467 // Add to at least BaseField::size_in_bits() to ensure that we teat the overflowing
468 for _ in 0..TEST_COUNT + BaseField::MODULUS_BIT_SIZE as usize {
469 // double
470 num_native = num_native + &num_native;
471 num = &num + #
472
473 assert!(num.value().unwrap().eq(&num_native), "result incorrect");
474 }
475}
476
477fn double_stress_test_2<TargetField: PrimeField, BaseField: PrimeField, R: RngCore>(
478 cs: ConstraintSystemRef<BaseField>,
479 rng: &mut R,
480) {
481 let mut num_native = TargetField::rand(rng);
482 let mut num = NonNativeFieldVar::<TargetField, BaseField>::new_witness(
483 ark_relations::ns!(cs, "initial num"),
484 || Ok(num_native),
485 )
486 .unwrap();
487 for _ in 0..TEST_COUNT {
488 // double
489 num_native = num_native + &num_native;
490 num = &num + #
491
492 assert!(num.value().unwrap().eq(&num_native));
493
494 // square
495 let num_square_native = num_native * &num_native;
496 let num_square = &num * #
497 assert!(num_square.value().unwrap().eq(&num_square_native));
498 }
499}
500
501fn double_stress_test_3<TargetField: PrimeField, BaseField: PrimeField, R: RngCore>(
502 cs: ConstraintSystemRef<BaseField>,
503 rng: &mut R,
504) {
505 let mut num_native = TargetField::rand(rng);
506 let mut num = NonNativeFieldVar::<TargetField, BaseField>::new_witness(
507 ark_relations::ns!(cs, "initial num"),
508 || Ok(num_native),
509 )
510 .unwrap();
511 for _ in 0..TEST_COUNT {
512 // double
513 num_native = num_native + &num_native;
514 num = &num + #
515
516 assert!(num.value().unwrap().eq(&num_native));
517
518 // square
519 let num_square_native = num_native * &num_native;
520 let num_square = &num * #
521 let num_square_native_gadget = NonNativeFieldVar::<TargetField, BaseField>::new_witness(
522 ark_relations::ns!(cs, "repetition: alloc_native num"),
523 || Ok(num_square_native),
524 )
525 .unwrap();
526
527 num_square.enforce_equal(&num_square_native_gadget).unwrap();
528 }
529}
530
531fn inverse_stress_test<TargetField: PrimeField, BaseField: PrimeField, R: RngCore>(
532 cs: ConstraintSystemRef<BaseField>,
533 rng: &mut R,
534) {
535 for _ in 0..TEST_COUNT {
536 let num_native = TargetField::rand(rng);
537 let num = NonNativeFieldVar::<TargetField, BaseField>::new_witness(
538 ark_relations::ns!(cs, "num"),
539 || Ok(num_native),
540 )
541 .unwrap();
542
543 if num_native == TargetField::zero() {
544 continue;
545 }
546
547 let num_native_inverse = num_native.inverse().unwrap();
548 let num_inverse = num.inverse().unwrap();
549
550 assert!(num_inverse.value().unwrap().eq(&num_native_inverse));
551 }
552}
553
554macro_rules! nonnative_test_individual {
555 ($test_method:ident, $test_name:ident, $test_target_field:ty, $test_base_field:ty) => {
556 paste::item! {
557 #[test]
558 fn [<$test_method _ $test_name:lower>]() {
559 let rng = &mut ark_std::test_rng();
560
561 for _ in 0..NUM_REPETITIONS {
562 let cs = ConstraintSystem::<$test_base_field>::new_ref();
563 $test_method::<$test_target_field, $test_base_field, _>(cs.clone(), rng);
564 assert!(cs.is_satisfied().unwrap());
565 }
566 }
567 }
568 };
569}
570
571macro_rules! nonnative_test {
572 ($test_name:ident, $test_target_field:ty, $test_base_field:ty) => {
573 nonnative_test_individual!(
574 allocation_test,
575 $test_name,
576 $test_target_field,
577 $test_base_field
578 );
579 nonnative_test_individual!(
580 addition_test,
581 $test_name,
582 $test_target_field,
583 $test_base_field
584 );
585 nonnative_test_individual!(
586 multiplication_test,
587 $test_name,
588 $test_target_field,
589 $test_base_field
590 );
591 nonnative_test_individual!(
592 equality_test,
593 $test_name,
594 $test_target_field,
595 $test_base_field
596 );
597 nonnative_test_individual!(
598 edge_cases_test,
599 $test_name,
600 $test_target_field,
601 $test_base_field
602 );
603 nonnative_test_individual!(
604 distribution_law_test,
605 $test_name,
606 $test_target_field,
607 $test_base_field
608 );
609 nonnative_test_individual!(
610 addition_stress_test,
611 $test_name,
612 $test_target_field,
613 $test_base_field
614 );
615 nonnative_test_individual!(
616 double_stress_test_1,
617 $test_name,
618 $test_target_field,
619 $test_base_field
620 );
621 nonnative_test_individual!(
622 double_stress_test_2,
623 $test_name,
624 $test_target_field,
625 $test_base_field
626 );
627 nonnative_test_individual!(
628 double_stress_test_3,
629 $test_name,
630 $test_target_field,
631 $test_base_field
632 );
633 nonnative_test_individual!(
634 randomized_arithmetic_test,
635 $test_name,
636 $test_target_field,
637 $test_base_field
638 );
639 nonnative_test_individual!(
640 multiplication_stress_test,
641 $test_name,
642 $test_target_field,
643 $test_base_field
644 );
645 nonnative_test_individual!(
646 mul_and_add_stress_test,
647 $test_name,
648 $test_target_field,
649 $test_base_field
650 );
651 nonnative_test_individual!(
652 square_mul_add_stress_test,
653 $test_name,
654 $test_target_field,
655 $test_base_field
656 );
657 nonnative_test_individual!(
658 inverse_stress_test,
659 $test_name,
660 $test_target_field,
661 $test_base_field
662 );
663 };
664}
665
666nonnative_test!(
667 MNT46Small,
668 <MNT4_298 as PairingEngine>::Fr,
669 <MNT6_298 as PairingEngine>::Fr
670);
671nonnative_test!(
672 MNT64Small,
673 <MNT6_298 as PairingEngine>::Fr,
674 <MNT4_298 as PairingEngine>::Fr
675);
676nonnative_test!(
677 MNT46Big,
678 <MNT4_753 as PairingEngine>::Fr,
679 <MNT6_753 as PairingEngine>::Fr
680);
681nonnative_test!(
682 MNT64Big,
683 <MNT6_753 as PairingEngine>::Fr,
684 <MNT4_753 as PairingEngine>::Fr
685);
686nonnative_test!(
687 BLS12MNT4Small,
688 <Bls12_381 as PairingEngine>::Fr,
689 <MNT4_298 as PairingEngine>::Fr
690);
691nonnative_test!(
692 BLS12,
693 <Bls12_381 as PairingEngine>::Fq,
694 <Bls12_381 as PairingEngine>::Fr
695);
696#[cfg(not(ci))]
697nonnative_test!(
698 MNT6BigMNT4Small,
699 <MNT6_753 as PairingEngine>::Fr,
700 <MNT4_298 as PairingEngine>::Fr
701);
702nonnative_test!(
703 PallasFrMNT6Fr,
704 ark_pallas::Fr,
705 <MNT6_753 as PairingEngine>::Fr
706);
707nonnative_test!(
708 MNT6FrPallasFr,
709 <MNT6_753 as PairingEngine>::Fr,
710 ark_pallas::Fr
711);
712nonnative_test!(PallasFqFr, ark_pallas::Fq, ark_pallas::Fr);
713nonnative_test!(PallasFrFq, ark_pallas::Fr, ark_pallas::Fq);