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