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